UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 3.56 kB
{"ast":null,"code":"\"use strict\";\n\nimport * as React from 'react';\nimport { NavigationBuilderContext } from \"./NavigationBuilderContext.js\";\nexport function useFocusedListenersChildrenAdapter({\n navigation,\n focusedListeners\n}) {\n const {\n addListener\n } = React.useContext(NavigationBuilderContext);\n const listener = React.useCallback(callback => {\n if (navigation.isFocused()) {\n for (const listener of focusedListeners) {\n const {\n handled,\n result\n } = listener(callback);\n if (handled) {\n return {\n handled,\n result\n };\n }\n }\n return {\n handled: true,\n result: callback(navigation)\n };\n } else {\n return {\n handled: false,\n result: null\n };\n }\n }, [focusedListeners, navigation]);\n React.useEffect(() => addListener?.('focus', listener), [addListener, listener]);\n}","map":{"version":3,"names":["React","NavigationBuilderContext","useFocusedListenersChildrenAdapter","navigation","focusedListeners","addListener","useContext","listener","useCallback","callback","isFocused","handled","result","useEffect"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/core/src/useFocusedListenersChildrenAdapter.tsx"],"sourcesContent":["import type { ParamListBase } from '@react-navigation/routers';\nimport * as React from 'react';\n\nimport {\n type FocusedNavigationCallback,\n type FocusedNavigationListener,\n NavigationBuilderContext,\n} from './NavigationBuilderContext';\nimport type { NavigationHelpers } from './types';\n\ntype Options = {\n navigation: NavigationHelpers<ParamListBase>;\n focusedListeners: FocusedNavigationListener[];\n};\n\n/**\n * Hook for passing focus callback to children\n */\nexport function useFocusedListenersChildrenAdapter({\n navigation,\n focusedListeners,\n}: Options) {\n const { addListener } = React.useContext(NavigationBuilderContext);\n\n const listener = React.useCallback(\n (callback: FocusedNavigationCallback<any>) => {\n if (navigation.isFocused()) {\n for (const listener of focusedListeners) {\n const { handled, result } = listener(callback);\n\n if (handled) {\n return { handled, result };\n }\n }\n\n return { handled: true, result: callback(navigation) };\n } else {\n return { handled: false, result: null };\n }\n },\n [focusedListeners, navigation]\n );\n\n React.useEffect(\n () => addListener?.('focus', listener),\n [addListener, listener]\n );\n}\n"],"mappings":";;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAGEC,wBAAwB;AAY1B,OAAO,SAASC,kCAAkCA,CAAC;EACjDC,UAAU;EACVC;AACO,CAAC,EAAE;EACV,MAAM;IAAEC;EAAY,CAAC,GAAGL,KAAK,CAACM,UAAU,CAACL,wBAAwB,CAAC;EAElE,MAAMM,QAAQ,GAAGP,KAAK,CAACQ,WAAW,CAC/BC,QAAwC,IAAK;IAC5C,IAAIN,UAAU,CAACO,SAAS,CAAC,CAAC,EAAE;MAC1B,KAAK,MAAMH,QAAQ,IAAIH,gBAAgB,EAAE;QACvC,MAAM;UAAEO,OAAO;UAAEC;QAAO,CAAC,GAAGL,QAAQ,CAACE,QAAQ,CAAC;QAE9C,IAAIE,OAAO,EAAE;UACX,OAAO;YAAEA,OAAO;YAAEC;UAAO,CAAC;QAC5B;MACF;MAEA,OAAO;QAAED,OAAO,EAAE,IAAI;QAAEC,MAAM,EAAEH,QAAQ,CAACN,UAAU;MAAE,CAAC;IACxD,CAAC,MAAM;MACL,OAAO;QAAEQ,OAAO,EAAE,KAAK;QAAEC,MAAM,EAAE;MAAK,CAAC;IACzC;EACF,CAAC,EACD,CAACR,gBAAgB,EAAED,UAAU,CAC/B,CAAC;EAEDH,KAAK,CAACa,SAAS,CACb,MAAMR,WAAW,GAAG,OAAO,EAAEE,QAAQ,CAAC,EACtC,CAACF,WAAW,EAAEE,QAAQ,CACxB,CAAC;AACH","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}