You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
1.9 KiB
1 line
1.9 KiB
{"ast":null,"code":"import * as React from 'react';\nimport NavigationContainerRefContext from \"./NavigationContainerRefContext\";\nimport NavigationContext from \"./NavigationContext\";\nexport default function useNavigation() {\n var root = React.useContext(NavigationContainerRefContext);\n var navigation = React.useContext(NavigationContext);\n if (navigation === undefined && root === undefined) {\n throw new Error(\"Couldn't find a navigation object. Is your component inside NavigationContainer?\");\n }\n return navigation != null ? navigation : root;\n}","map":{"version":3,"sources":["useNavigation.tsx"],"names":["React","NavigationContainerRefContext","NavigationContext","useNavigation","root","useContext","navigation","undefined","Error"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,6BAA6B;AACpC,OAAOC,iBAAiB;AAQxB,eAAe,SAASC,aAAa,GAE9B;EACL,IAAMC,IAAI,GAAGJ,KAAK,CAACK,UAAU,CAACJ,6BAA6B,CAAC;EAC5D,IAAMK,UAAU,GAAGN,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC;EAEtD,IAAII,UAAU,KAAKC,SAAS,IAAIH,IAAI,KAAKG,SAAS,EAAE;IAClD,MAAM,IAAIC,KAAK,CACb,kFAAkF,CACnF;EACH;EAGA,OAAQF,UAAU,WAAVA,UAAU,GAAIF,IAAI;AAC5B","sourceRoot":"../../src","sourcesContent":["import * as React from 'react';\nimport NavigationContainerRefContext from './NavigationContainerRefContext';\nimport NavigationContext from './NavigationContext';\n/**\n * Hook to access the navigation prop of the parent screen anywhere.\n *\n * @returns Navigation prop of the parent screen.\n */\nexport default function useNavigation() {\n const root = React.useContext(NavigationContainerRefContext);\n const navigation = React.useContext(NavigationContext);\n if (navigation === undefined && root === undefined) {\n throw new Error(\"Couldn't find a navigation object. Is your component inside NavigationContainer?\");\n }\n\n // FIXME: Figure out a better way to do this\n return navigation ?? root;\n}\n//# sourceMappingURL=useNavigation.js.map"]},"metadata":{},"sourceType":"module"} |