expo-router 4.0.0-preview.0 → 4.0.0-preview.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +2 -0
- package/build/ExpoRoot.js.map +1 -1
- package/build/exports.d.ts +2 -2
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js.map +1 -1
- package/build/fork/createMemoryHistory.d.ts +1 -1
- package/build/fork/createMemoryHistory.d.ts.map +1 -1
- package/build/fork/createMemoryHistory.js.map +1 -1
- package/build/fork/extractPathFromURL.d.ts.map +1 -1
- package/build/fork/extractPathFromURL.js +10 -1
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/useBackButton.d.ts +1 -1
- package/build/fork/useBackButton.d.ts.map +1 -1
- package/build/fork/useBackButton.js.map +1 -1
- package/build/fork/useBackButton.native.d.ts +1 -1
- package/build/fork/useBackButton.native.d.ts.map +1 -1
- package/build/fork/useBackButton.native.js.map +1 -1
- package/build/fork/useDocumentTitle.d.ts +1 -2
- package/build/fork/useDocumentTitle.d.ts.map +1 -1
- package/build/fork/useDocumentTitle.js.map +1 -1
- package/build/fork/useLinking.d.ts +5 -6
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js +6 -6
- package/build/fork/useLinking.js.map +1 -1
- package/build/fork/useLinking.native.d.ts +5 -5
- package/build/fork/useLinking.native.d.ts.map +1 -1
- package/build/fork/useLinking.native.js +3 -3
- package/build/fork/useLinking.native.js.map +1 -1
- package/build/getRoutesCore.js +22 -4
- package/build/getRoutesCore.js.map +1 -1
- package/build/global-state/router-store.d.ts +1 -0
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +2 -0
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +1 -0
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +33 -1
- package/build/global-state/routing.js.map +1 -1
- package/build/head/ExpoHead.ios.js +2 -2
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +2 -1
- package/build/hooks.js.map +1 -1
- package/build/imperative-api.d.ts +5 -0
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js +1 -0
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/Stack.d.ts.map +1 -1
- package/build/layouts/Stack.js +1 -0
- package/build/layouts/Stack.js.map +1 -1
- package/build/layouts/Tabs.d.ts +8 -0
- package/build/layouts/Tabs.d.ts.map +1 -1
- package/build/layouts/Tabs.js +1 -0
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +2 -2
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +3 -6
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +1 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/useDomComponentNavigation.d.ts +9 -0
- package/build/link/useDomComponentNavigation.d.ts.map +1 -0
- package/build/link/useDomComponentNavigation.js +69 -0
- package/build/link/useDomComponentNavigation.js.map +1 -0
- package/build/link/useLinkToPathProps.d.ts.map +1 -1
- package/build/link/useLinkToPathProps.js +4 -0
- package/build/link/useLinkToPathProps.js.map +1 -1
- package/build/primitives.js +3 -3
- package/build/primitives.js.map +1 -1
- package/build/rsc/router/client.d.ts +0 -1
- package/build/rsc/router/client.d.ts.map +1 -1
- package/build/rsc/router/client.js +1 -1
- package/build/rsc/router/client.js.map +1 -1
- package/build/rsc/router/noopRouter.d.ts +7 -0
- package/build/rsc/router/noopRouter.d.ts.map +1 -0
- package/build/rsc/router/noopRouter.js +7 -0
- package/build/rsc/router/noopRouter.js.map +1 -0
- package/build/useFocusEffect.d.ts.map +1 -1
- package/build/useFocusEffect.js +1 -0
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.d.ts.map +1 -1
- package/build/useNavigation.js +1 -0
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +1 -0
- package/build/useScreens.js.map +1 -1
- package/build/utils/url.js +2 -2
- package/build/utils/url.js.map +1 -1
- package/build/views/Splash.d.ts.map +1 -1
- package/build/views/Splash.js +1 -0
- package/build/views/Splash.js.map +1 -1
- package/entry-classic.js +6 -0
- package/package.json +10 -8
- package/plugin/build/index.js +3 -1
- package/ui.d.ts +1 -0
- package/ui.js +1 -0
package/build/ExpoRoot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAK7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAK7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtE,CAAC;AAYF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAqBtF"}
|
package/build/ExpoRoot.js
CHANGED
|
@@ -31,6 +31,7 @@ const react_native_safe_area_context_1 = require("react-native-safe-area-context
|
|
|
31
31
|
const NavigationContainer_1 = require("./fork/NavigationContainer");
|
|
32
32
|
const router_store_1 = require("./global-state/router-store");
|
|
33
33
|
const serverLocationContext_1 = require("./global-state/serverLocationContext");
|
|
34
|
+
const useDomComponentNavigation_1 = require("./link/useDomComponentNavigation");
|
|
34
35
|
const statusbar_1 = require("./utils/statusbar");
|
|
35
36
|
const Splash_1 = require("./views/Splash");
|
|
36
37
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
@@ -106,6 +107,7 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
|
|
|
106
107
|
...linking,
|
|
107
108
|
serverUrl,
|
|
108
109
|
});
|
|
110
|
+
(0, useDomComponentNavigation_1.useDomComponentNavigation)(store);
|
|
109
111
|
if (store.shouldShowTutorial()) {
|
|
110
112
|
Splash_1.SplashScreen.hideAsync();
|
|
111
113
|
if (process.env.NODE_ENV === 'development') {
|
package/build/ExpoRoot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,oEAAgG;AAEhG,8DAAsE;AACtE,gFAAwF;AAExF,iDAA8E;AAC9E,2CAA8C;AAgB9C,MAAM,SAAS,GAAG,OAAO,CA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,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAChE,oCAAoC,CAAC;QAErC,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,OAAO,EAAE,IAAI,EAAE;oBACjB,OAAO,IAAI,kCAAkC,OAAO,CAAC,IAAI,IAAI,CAAC;iBAC/D;qBAAM;oBACL,OAAO,IAAI,gFAAgF,CAAC;iBAC7F;gBAED,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,KAAK,CAAC;YACX,KAAK,YAAY;gBACf,OAAO,IAAI,wCAAwC,CAAC;gBACpD,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,cAAc,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;SACT;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;CACH;KAAM;IACL,iBAAiB,GAAG,cAAa,CAAC,CAAC;CACpC","sourcesContent":["'use client';\n\nimport { LinkingOptions, NavigationAction } from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { RequireContext } from './types';\nimport { hasViewControllerBasedStatusBarAppearance } from './utils/statusbar';\nimport { SplashScreen } from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useInitializeExpoRouter(context, {\n ...linking,\n serverUrl,\n });\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,oEAAgG;AAEhG,8DAAsE;AACtE,gFAAwF;AACxF,gFAA6E;AAE7E,iDAA8E;AAC9E,2CAA8C;AAgB9C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAElD,MAAM,eAAe,GACnB,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,SAAS;IAChC,CAAC,CAAC;QACE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QAC1C,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;KACjD;IACH,CAAC,CAAC,SAAS,CAAC;AAEhB;;GAEG;AACH,SAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,gBAAQ,EAAE,GAAG,KAAK,EAAiB;IACrF;;;;OAIG;IACH,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAqB,EAAE,EAAE;QAClD,OAAO,CACL,CAAC,aAAa,CACZ;QAAA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eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;SACT;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;CACH;KAAM;IACL,iBAAiB,GAAG,cAAa,CAAC,CAAC;CACpC","sourcesContent":["'use client';\n\nimport { LinkingOptions, NavigationAction } from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { useDomComponentNavigation } from './link/useDomComponentNavigation';\nimport { RequireContext } from './types';\nimport { hasViewControllerBasedStatusBarAppearance } from './utils/statusbar';\nimport { SplashScreen } from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useInitializeExpoRouter(context, {\n ...linking,\n serverUrl,\n });\n\n useDomComponentNavigation(store);\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
|
package/build/exports.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export { ExpoRoot } from './ExpoRoot';
|
|
|
8
8
|
export { Unmatched } from './views/Unmatched';
|
|
9
9
|
export { ErrorBoundaryProps } from './views/Try';
|
|
10
10
|
export { ErrorBoundary } from './views/ErrorBoundary';
|
|
11
|
-
export { ScreenProps } from './useScreens';
|
|
11
|
+
export type { ScreenProps } from './useScreens';
|
|
12
12
|
/**
|
|
13
13
|
* @hidden
|
|
14
14
|
*/
|
|
15
15
|
export { SplashScreen } from './views/Splash';
|
|
16
16
|
export { useNavigation } from './useNavigation';
|
|
17
17
|
export { useFocusEffect, EffectCallback } from './useFocusEffect';
|
|
18
|
-
export { ResultState } from './fork/getStateFromPath';
|
|
18
|
+
export type { ResultState } from './fork/getStateFromPath';
|
|
19
19
|
export type * from './types';
|
|
20
20
|
//# sourceMappingURL=exports.d.ts.map
|
package/build/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS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,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAAkD;AAAzC,wGAAA,MAAM,OAAA;AAEf,oCAAwE;AAA/D,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAGtB,WAAW;AACX;;GAEG;AACH,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkE;AAAzD,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router, Router } from './imperative-api';\n\nexport { Link, Redirect, LinkProps, WebAnchorProps } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, EffectCallback } from './useFocusEffect';\nexport { ResultState } from './fork/getStateFromPath';\n\nexport type * from './types';\n"]}
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;AAAA,kBAAkB;AAClB,iDAAoD;AAmB3C,0FAnBA,qBAAS,OAmBA;AAAE,qFAnBA,gBAAI,OAmBA;AAjBxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAAkD;AAAzC,wGAAA,MAAM,OAAA;AAEf,oCAAwE;AAA/D,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAGtB,WAAW;AACX;;GAEG;AACH,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkE;AAAzD,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router, Router } from './imperative-api';\n\nexport { Link, Redirect, LinkProps, WebAnchorProps } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport type { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, EffectCallback } from './useFocusEffect';\nexport type { ResultState } from './fork/getStateFromPath';\n\nexport type * from './types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,KAAK,aAAa,GAAG;IAEnB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,eAAe,CAAC;IAEvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,mBAAmB;;eAiCpB,MAAM;;cAIW,MAAM;;;cAaJ,MAAM;eAAS,eAAe;;;cAmB3B,MAAM;eAAS,eAAe;;UAsCzD,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;;AAMA,kDAA2C;AAW3C,SAAgB,mBAAmB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAu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CAAC,MAAM,EAAE;oBAClB,wEAAwE;oBACxE,OAAO;iBACR;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAvND,kDAuNC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Forked behaviour:\n// - Remove custom management of the URL hash\nimport type { NavigationState } from '@react-navigation/core';\nimport { nanoid } from 'nanoid/non-secure';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n const pathWithHash = path;\n\n // ------- START OF FORK\n\n // if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // // There are two scenarios for creating an array with only one history record:\n // // - When loaded id not found in the items array, this function by default will replace\n // // the first item. We need to keep only the new updated object, otherwise it will break\n // // the page when navigating forward in history.\n // // - This is the first time any state modifications are done\n // // So we need to push the entry as there's nothing to replace\n // pathWithHash = pathWithHash + location.hash;\n // items = [{ path: pathWithHash, state, id }];\n // index = 0;\n // } else {\n // if (items[index].path === path) {\n // pathWithHash = pathWithHash + location.hash;\n // }\n // items[index] = { path, state, id };\n // }\n\n // ------- END OF FORK\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;;AAMA,kDAA2C;AAW3C,SAAgB,mBAAmB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAuF;QACvF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACjB,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,IAAI,KAAK;YACP,kDAAkD;YAClD,oEAAoE;YACpE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAEpC,IAAI,EAAE,EAAE;gBACN,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBAExD,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAA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AC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;oBAE/D,iDAAiD;oBACjD,2DAA2D;oBAC3D,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;oBAElC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;oBAE3B,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;oBACnD,IAAI,EAAE,EAAE,EAAE,CAAC;gBACb,CAAC,CAAC;gBAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;gBAChD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,gGAAgG;QAChG,iFAAiF;QACjF,4GAA4G;QAC5G,MAAM,CAAC,QAAoB;YACzB,MAAM,UAAU,GAAG,GAAG,EAAE;gBACtB,IAAI,OAAO,CAAC,MAAM,EAAE;oBAClB,wEAAwE;oBACxE,OAAO;iBACR;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAvND,kDAuNC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Forked behavior:\n// - Remove custom management of the URL hash\nimport type { NavigationState } from '@react-navigation/native';\nimport { nanoid } from 'nanoid/non-secure';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n const pathWithHash = path;\n\n // ------- START OF FORK\n\n // if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // // There are two scenarios for creating an array with only one history record:\n // // - When loaded id not found in the items array, this function by default will replace\n // // the first item. We need to keep only the new updated object, otherwise it will break\n // // the page when navigating forward in history.\n // // - This is the first time any state modifications are done\n // // So we need to push the entry as there's nothing to replace\n // pathWithHash = pathWithHash + location.hash;\n // items = [{ path: pathWithHash, state, id }];\n // index = 0;\n // } else {\n // if (items[index].path === path) {\n // pathWithHash = pathWithHash + location.hash;\n // }\n // items[index] = { path, state, id };\n // }\n\n // ------- END OF FORK\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAAA,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAUA;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI3D;
|
|
1
|
+
{"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAAA,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAUA;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI3D;AAsGD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAW,UAM3E"}
|
|
@@ -64,7 +64,16 @@ function fromDeepLink(url) {
|
|
|
64
64
|
res = new URL(url);
|
|
65
65
|
}
|
|
66
66
|
catch {
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* We failed to parse the URL. This can occur for a variety of reasons, including:
|
|
69
|
+
* - Its a partial URL (e.g. `/route?query=param`).
|
|
70
|
+
* - It has a valid App scheme, but the scheme isn't a valid URL scheme (e.g. `my_app://`)
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* App schemes are not valid URL schemes, so they will fail to parse.
|
|
74
|
+
* We need to strip the scheme from these URLs
|
|
75
|
+
*/
|
|
76
|
+
return url.replace(/^[^:]+:\/\//, '');
|
|
68
77
|
}
|
|
69
78
|
if (isExpoDevelopmentClient(res)) {
|
|
70
79
|
if (!res.searchParams.get('url')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":";;;AAAA,SAAgB,gCAAgC,CAAC,GAAW;IAI1D,+EAA+E;IAC/E,oFAAoF;IAEpF,MAAM,IAAI,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC7C,OAAO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IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAChC,OAAO,EAAE,CAAC;SACX;QACD,MAAM,WAAW,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QACjD,OAAO,uBAAuB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;KACxD;IAED,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC;KACrB;IAED,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC;KACzB;IAED,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM;QACpB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,wEAAwE;YACxE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/F,IAAI,EAAE,EAAE;QACN,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;KACrB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,sBAAsB,CAAC,SAAmB,EAAE,MAAc,EAAE;IAC1E,OAAO,CACL,uBAAuB,CAAC,GAAG,CAAC;QAC1B,sEAAsE;SACrE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,CAAC;AACJ,CAAC;AAND,wDAMC","sourcesContent":["export function parsePathAndParamsFromExpoGoLink(url: string): {\n pathname: string;\n queryString: string;\n} {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n\n const href = parsePathFromExpoGoLink(url);\n const results = href.match(/([^?]*)(\\?.*)?/);\n return {\n pathname: results?.[1] ?? '',\n queryString: results?.[2] ?? '',\n };\n}\n\nexport function parsePathFromExpoGoLink(url: string): string {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n return url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1] ?? '';\n}\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href, hostname } = new URL(url);\n\n if (hostname === 'exp.host' || hostname === 'u.expo.dev') {\n // These are QR code generate deep-link that always like to the '/' path\n // TODO: In the future, QR code may link to a specific path and this logic will need to be udpated\n return '';\n }\n\n return href.replace(origin, '');\n }\n\n const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n isExpoGo &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = parsePathFromExpoGoLink(url);\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n // Match the `?.*` segment of the URL.\n const queryParams = url.match(/exps?:\\/\\/.*\\?(.*)/)?.[1];\n if (queryParams) {\n return fromDeepLink('a://?' + queryParams);\n }\n\n return '';\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL | null;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n /**\n * We failed to parse the URL. This can occur for a variety of reasons, including:\n * - Its a partial URL (e.g. `/route?query=param`).\n * - It has a valid App scheme, but the scheme isn't a valid URL scheme (e.g. `my_app://`)\n */\n\n /**\n * App schemes are not valid URL schemes, so they will fail to parse.\n * We need to strip the scheme from these URLs\n */\n return url.replace(/^[^:]+:\\/\\//, '');\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(decodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(_prefixes: string[], url: string = '') {\n return (\n extractExactPathFromURL(url)\n // TODO: We should get rid of this, dropping specificities is not good\n .replace(/^\\//, '')\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/
|
|
2
|
+
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/native';
|
|
3
3
|
export declare function useBackButton(_: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
|
|
4
4
|
//# sourceMappingURL=useBackButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackButton.d.ts","sourceRoot":"","sources":["../../src/fork/useBackButton.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useBackButton.d.ts","sourceRoot":"","sources":["../../src/fork/useBackButton.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEtF,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,QAGtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackButton.js","sourceRoot":"","sources":["../../src/fork/useBackButton.ts"],"names":[],"mappings":";;;AAKA,SAAgB,aAAa,CAAC,CAAyD;IACrF,QAAQ;IACR,sCAAsC;AACxC,CAAC;AAHD,sCAGC","sourcesContent":["/*\n * This file is unchanged, except for removing eslint comments\n */\nimport type { NavigationContainerRef, ParamListBase } from '@react-navigation/
|
|
1
|
+
{"version":3,"file":"useBackButton.js","sourceRoot":"","sources":["../../src/fork/useBackButton.ts"],"names":[],"mappings":";;;AAKA,SAAgB,aAAa,CAAC,CAAyD;IACrF,QAAQ;IACR,sCAAsC;AACxC,CAAC;AAHD,sCAGC","sourcesContent":["/*\n * This file is unchanged, except for removing eslint comments\n */\nimport type { NavigationContainerRef, ParamListBase } from '@react-navigation/native';\n\nexport function useBackButton(_: React.RefObject<NavigationContainerRef<ParamListBase>>) {\n // No-op\n // BackHandler is not available on web\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file is unchanged, except for removing eslint comments
|
|
3
3
|
*/
|
|
4
|
-
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/
|
|
4
|
+
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/native';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
export declare function useBackButton(ref: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
|
|
7
7
|
//# sourceMappingURL=useBackButton.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackButton.native.d.ts","sourceRoot":"","sources":["../../src/fork/useBackButton.native.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useBackButton.native.d.ts","sourceRoot":"","sources":["../../src/fork/useBackButton.native.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,wBAAgB,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,QAoBxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackButton.native.js","sourceRoot":"","sources":["../../src/fork/useBackButton.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,6CAA+B;AAC/B,+CAA2C;AAE3C,SAAgB,aAAa,CAAC,GAA2D;IACvF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,YAAY,GAAG,0BAAW,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC1E,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC;YAE/B,IAAI,UAAU,IAAI,IAAI,EAAE;gBACtB,OAAO,KAAK,CAAC;aACd;YAED,IAAI,UAAU,CAAC,SAAS,EAAE,EAAE;gBAC1B,UAAU,CAAC,MAAM,EAAE,CAAC;gBAEpB,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC;AApBD,sCAoBC","sourcesContent":["/**\n * This file is unchanged, except for removing eslint comments\n */\nimport type { NavigationContainerRef, ParamListBase } from '@react-navigation/
|
|
1
|
+
{"version":3,"file":"useBackButton.native.js","sourceRoot":"","sources":["../../src/fork/useBackButton.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,6CAA+B;AAC/B,+CAA2C;AAE3C,SAAgB,aAAa,CAAC,GAA2D;IACvF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,YAAY,GAAG,0BAAW,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC1E,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC;YAE/B,IAAI,UAAU,IAAI,IAAI,EAAE;gBACtB,OAAO,KAAK,CAAC;aACd;YAED,IAAI,UAAU,CAAC,SAAS,EAAE,EAAE;gBAC1B,UAAU,CAAC,MAAM,EAAE,CAAC;gBAEpB,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC;AApBD,sCAoBC","sourcesContent":["/**\n * This file is unchanged, except for removing eslint comments\n */\nimport type { NavigationContainerRef, ParamListBase } from '@react-navigation/native';\nimport * as React from 'react';\nimport { BackHandler } from 'react-native';\n\nexport function useBackButton(ref: React.RefObject<NavigationContainerRef<ParamListBase>>) {\n React.useEffect(() => {\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n const navigation = ref.current;\n\n if (navigation == null) {\n return false;\n }\n\n if (navigation.canGoBack()) {\n navigation.goBack();\n\n return true;\n }\n\n return false;\n });\n\n return () => subscription.remove();\n }, [ref]);\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/
|
|
2
|
-
import type { DocumentTitleOptions } from '@react-navigation/native';
|
|
1
|
+
import type { DocumentTitleOptions, NavigationContainerRef, ParamListBase } from '@react-navigation/native';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
/**
|
|
5
4
|
* Set the document title for the active screen
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentTitle.d.ts","sourceRoot":"","sources":["../../src/fork/useDocumentTitle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useDocumentTitle.d.ts","sourceRoot":"","sources":["../../src/fork/useDocumentTitle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,SAA6D,GAC9D,GAAE,oBAAyB,QAqB7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentTitle.js","sourceRoot":"","sources":["../../src/fork/useDocumentTitle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useDocumentTitle.js","sourceRoot":"","sources":["../../src/fork/useDocumentTitle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,6CAA+B;AAE/B,uDAAuD;AAEvD;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,GAA2D,EAC3D,EACE,OAAO,GAAG,IAAI,EACd,SAAS,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,IAAI,MACrC,EAAE;IAE5B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC;QAE/B,IAAI,UAAU,EAAE;YACd,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,iBAAiB,EAAE,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;YAEtF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;SACxB;QAED,OAAO,UAAU,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YAC9C,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;YAEvE,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA1BD,4CA0BC","sourcesContent":["/*\n * This file is unchanged, except for fixing imports and removing eslint comments\n */\nimport type {\n DocumentTitleOptions,\n NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/native';\nimport * as React from 'react';\n\n// import type { DocumentTitleOptions } from './types';\n\n/**\n * Set the document title for the active screen\n */\nexport function useDocumentTitle(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n enabled = true,\n formatter = (options, route) => options?.title ?? route?.name,\n }: DocumentTitleOptions = {}\n) {\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n\n if (navigation) {\n const title = formatter(navigation.getCurrentOptions(), navigation.getCurrentRoute());\n\n document.title = title;\n }\n\n return navigation?.addListener('options', (e) => {\n const title = formatter(e.data.options, navigation?.getCurrentRoute());\n\n document.title = title;\n });\n });\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/
|
|
2
|
-
import { LinkingOptions } from '@react-navigation/native';
|
|
1
|
+
import { LinkingOptions, type NavigationContainerRef, type ParamListBase } from '@react-navigation/native';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
/**
|
|
5
4
|
* Run async function in series as it's called.
|
|
@@ -12,24 +11,24 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
12
11
|
index: number;
|
|
13
12
|
routeNames: string[];
|
|
14
13
|
history?: unknown[] | undefined;
|
|
15
|
-
routes: import("@react-navigation/
|
|
14
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
16
15
|
type: string;
|
|
17
16
|
stale: false;
|
|
18
17
|
}>, "stale" | "routes">> & Readonly<{
|
|
19
18
|
stale?: true | undefined;
|
|
20
|
-
routes: import("@react-navigation/
|
|
19
|
+
routes: import("@react-navigation/native").PartialRoute<import("@react-navigation/native").Route<string, object | undefined>>[];
|
|
21
20
|
}> & {
|
|
22
21
|
state?: (Partial<Omit<Readonly<{
|
|
23
22
|
key: string;
|
|
24
23
|
index: number;
|
|
25
24
|
routeNames: string[];
|
|
26
25
|
history?: unknown[] | undefined;
|
|
27
|
-
routes: import("@react-navigation/
|
|
26
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
28
27
|
type: string;
|
|
29
28
|
stale: false;
|
|
30
29
|
}>, "stale" | "routes">> & Readonly<{
|
|
31
30
|
stale?: true | undefined;
|
|
32
|
-
routes: import("@react-navigation/
|
|
31
|
+
routes: import("@react-navigation/native").PartialRoute<import("@react-navigation/native").Route<string, object | undefined>>[];
|
|
33
32
|
}> & any) | undefined;
|
|
34
33
|
}) | undefined>;
|
|
35
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAKd,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+C/B;;GAEG;AACH,eAAO,MAAM,MAAM,OAAQ,MAAM,QAAQ,IAAI,CAAC,eAM7C,CAAC;AAIF,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EAmVtE"}
|
package/build/fork/useLinking.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.useLinking = exports.series = void 0;
|
|
30
|
-
const
|
|
30
|
+
const native_1 = require("@react-navigation/native");
|
|
31
31
|
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
32
32
|
const React = __importStar(require("react"));
|
|
33
33
|
const createMemoryHistory_1 = require("./createMemoryHistory");
|
|
@@ -73,8 +73,8 @@ const series = (cb) => {
|
|
|
73
73
|
};
|
|
74
74
|
exports.series = series;
|
|
75
75
|
const linkingHandlers = [];
|
|
76
|
-
function useLinking(ref, { enabled = true, config, getStateFromPath =
|
|
77
|
-
const independent = (0,
|
|
76
|
+
function useLinking(ref, { enabled = true, config, getStateFromPath = native_1.getStateFromPath, getPathFromState = native_1.getPathFromState, getActionFromState = native_1.getActionFromState, }, onUnhandledLinking) {
|
|
77
|
+
const independent = (0, native_1.useNavigationIndependentTree)();
|
|
78
78
|
React.useEffect(() => {
|
|
79
79
|
if (process.env.NODE_ENV === 'production') {
|
|
80
80
|
return undefined;
|
|
@@ -220,7 +220,7 @@ function useLinking(ref, { enabled = true, config, getStateFromPath = core_1.get
|
|
|
220
220
|
if (route?.path) {
|
|
221
221
|
const stateForPath = getStateFromPathRef.current(route.path, configRef.current);
|
|
222
222
|
if (stateForPath) {
|
|
223
|
-
const focusedRoute = (0,
|
|
223
|
+
const focusedRoute = (0, native_1.findFocusedRoute)(stateForPath);
|
|
224
224
|
if (focusedRoute &&
|
|
225
225
|
focusedRoute.name === route.name &&
|
|
226
226
|
(0, fast_deep_equal_1.default)({ ...focusedRoute.params }, { ...route.params })) {
|
|
@@ -253,7 +253,7 @@ function useLinking(ref, { enabled = true, config, getStateFromPath = core_1.get
|
|
|
253
253
|
// This will allow the initial state to be in the history entry
|
|
254
254
|
const state = ref.current.getRootState();
|
|
255
255
|
if (state) {
|
|
256
|
-
const route = (0,
|
|
256
|
+
const route = (0, native_1.findFocusedRoute)(state);
|
|
257
257
|
const path = getPathForRoute(route, state);
|
|
258
258
|
if (previousStateRef.current === undefined) {
|
|
259
259
|
previousStateRef.current = state;
|
|
@@ -273,7 +273,7 @@ function useLinking(ref, { enabled = true, config, getStateFromPath = core_1.get
|
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
const pendingPath = pendingPopStatePathRef.current;
|
|
276
|
-
const route = (0,
|
|
276
|
+
const route = (0, native_1.findFocusedRoute)(state);
|
|
277
277
|
const path = getPathForRoute(route, state);
|
|
278
278
|
previousStateRef.current = state;
|
|
279
279
|
pendingPopStatePathRef.current = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.js","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDASgC;AAEhC,sEAAsC;AACtC,6CAA+B;AAE/B,+DAA4D;AAC5D,iFAAsE;AAItE;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CACxB,CAAgB,EAChB,CAAgB,EACgB,EAAE;IAClC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,EAAE;QACzD,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;KAC/B;IAED,uFAAuF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ACA,2FAA2F;4BAC3F,MAAM,OAAO,CAAC,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC;yBAC5C;6BAAM;4BACL,kFAAkF;4BAClF,wEAAwE;4BACxE,gEAAgE;4BAChE,MAAM,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;yBAChC;wBAED,+DAA+D;wBAC/D,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;qBAClC;oBAAC,MAAM;wBACN,iCAAiC;qBAClC;iBACF;qBAAM;oBACL,0DAA0D;oBAC1D,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;iBAClC;aACF;iBAAM;gBACL,iEAAiE;gBACjE,6EAA6E;gBAC7E,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;aAClC;QACH,CAAC,CAAC;QAEF,+FAA+F;QAC/F,0DAA0D;QAC1D,qGAAqG;QACrG,OAAO,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,IAAA,cAAM,EAAC,aAAa,CAAC,CAAC,CAAC;IAClE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IAE5B,OAAO;QACL,eAAe;KAChB,CAAC;AACJ,CAAC;AA5VD,gCA4VC","sourcesContent":["import {\n findFocusedRoute,\n getActionFromState as getActionFromStateDefault,\n getPathFromState as getPathFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n type NavigationContainerRef,\n type NavigationState,\n type ParamListBase,\n useNavigationIndependentTree,\n} from '@react-navigation/core';\nimport { LinkingOptions } from '@react-navigation/native';\nimport isEqual from 'fast-deep-equal';\nimport * as React from 'react';\n\nimport { createMemoryHistory } from './createMemoryHistory';\nimport { ServerContext } from '../global-state/serverLocationContext';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\n/**\n * Find the matching navigation state that changed between 2 navigation states\n * e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state\n */\nconst findMatchingState = <T extends NavigationState>(\n a: T | undefined,\n b: T | undefined\n): [T | undefined, T | undefined] => {\n if (a === undefined || b === undefined || a.key !== b.key) {\n return [undefined, undefined];\n }\n\n // Tab and drawer will have `history` property, but stack will have history in `routes`\n const aHistoryLength = a.history ? a.history.length : a.routes.length;\n const bHistoryLength = b.history ? b.history.length : b.routes.length;\n\n const aRoute = a.routes[a.index];\n const bRoute = b.routes[b.index];\n\n const aChildState = aRoute.state as T | undefined;\n const bChildState = bRoute.state as T | undefined;\n\n // Stop here if this is the state object that changed:\n // - history length is different\n // - focused routes are different\n // - one of them doesn't have child state\n // - child state keys are different\n if (\n aHistoryLength !== bHistoryLength ||\n aRoute.key !== bRoute.key ||\n aChildState === undefined ||\n bChildState === undefined ||\n aChildState.key !== bChildState.key\n ) {\n return [a, b];\n }\n\n return findMatchingState(aChildState, bChildState);\n};\n\n/**\n * Run async function in series as it's called.\n */\nexport const series = (cb: () => Promise<void>) => {\n let queue = Promise.resolve();\n const callback = () => {\n queue = queue.then(cb);\n };\n return callback;\n};\n\nconst linkingHandlers: symbol[] = [];\n\ntype Options = LinkingOptions<ParamListBase>;\n\nexport function useLinking(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n enabled = true,\n config,\n getStateFromPath = getStateFromPathDefault,\n getPathFromState = getPathFromStateDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options,\n onUnhandledLinking: (lastUnhandledLining: string | undefined) => void\n) {\n const independent = useNavigationIndependentTree();\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n const [history] = React.useState(createMemoryHistory);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = React.useRef(enabled);\n const configRef = React.useRef(config);\n const getStateFromPathRef = React.useRef(getStateFromPath);\n const getPathFromStateRef = React.useRef(getPathFromState);\n const getActionFromStateRef = React.useRef(getActionFromState);\n\n React.useEffect(() => {\n enabledRef.current = enabled;\n configRef.current = config;\n getStateFromPathRef.current = getStateFromPath;\n getPathFromStateRef.current = getPathFromState;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const validateRoutesNotExistInRootState = React.useCallback(\n (state: ResultState) => {\n const navigation = ref.current;\n const rootState = navigation?.getRootState();\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n return state?.routes.some((r) => !rootState?.routeNames.includes(r.name));\n },\n [ref]\n );\n\n const server = React.useContext(ServerContext);\n\n const getInitialState = React.useCallback(() => {\n let value: ResultState | undefined;\n\n if (enabledRef.current) {\n const location =\n server?.location ?? (typeof window !== 'undefined' ? window.location : undefined);\n\n const path = location ? location.pathname + location.search : undefined;\n\n if (path) {\n value = getStateFromPathRef.current(path, configRef.current);\n }\n\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(value) : value);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const previousIndexRef = React.useRef<number | undefined>(undefined);\n const previousStateRef = React.useRef<NavigationState | undefined>(undefined);\n const pendingPopStatePathRef = React.useRef<string | undefined>(undefined);\n\n React.useEffect(() => {\n previousIndexRef.current = history.index;\n\n return history.listen(() => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const { location } = window;\n\n const path = location.pathname + location.search + location.hash;\n const index = history.index;\n\n const previousIndex = previousIndexRef.current ?? 0;\n\n previousIndexRef.current = index;\n pendingPopStatePathRef.current = path;\n\n // When browser back/forward is clicked, we first need to check if state object for this index exists\n // If it does we'll reset to that state object\n // Otherwise, we'll handle it like a regular deep link\n const record = history.get(index);\n\n if (record?.path === path && record?.state) {\n navigation.resetRoot(record.state);\n return;\n }\n\n const state = getStateFromPathRef.current(path, configRef.current);\n\n // We should only dispatch an action when going forward\n // Otherwise the action will likely add items to history, which would mess things up\n if (state) {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n if (validateRoutesNotExistInRootState(state)) {\n return;\n }\n\n if (index > previousIndex) {\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${path}': ${\n typeof e === 'object' && e != null && 'message' in e ? e.message : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n // if current path didn't return any state, we should revert to initial state\n navigation.resetRoot(state);\n }\n });\n }, [enabled, history, onUnhandledLinking, ref, validateRoutesNotExistInRootState]);\n\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const getPathForRoute = (\n route: ReturnType<typeof findFocusedRoute>,\n state: NavigationState\n ): string => {\n let path;\n\n // If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match\n // This makes sure that we preserve the original URL for wildcard routes\n if (route?.path) {\n const stateForPath = getStateFromPathRef.current(route.path, configRef.current);\n\n if (stateForPath) {\n const focusedRoute = findFocusedRoute(stateForPath);\n\n if (\n focusedRoute &&\n focusedRoute.name === route.name &&\n isEqual({ ...focusedRoute.params }, { ...route.params })\n ) {\n path = route.path;\n }\n }\n }\n\n if (path == null) {\n path = getPathFromStateRef.current(state, configRef.current);\n }\n\n // START FORK - ExpoRouter manually handles hashes\n // const previousRoute = previousStateRef.current\n // ? findFocusedRoute(previousStateRef.current)\n // : undefined;\n\n // Preserve the hash if the route didn't change\n // if (\n // previousRoute &&\n // route &&\n // 'key' in previousRoute &&\n // 'key' in route &&\n // previousRoute.key === route.key\n // ) {\n // path = path + location.hash;\n // }\n // END FORK\n\n return path;\n };\n\n if (ref.current) {\n // We need to record the current metadata on the first render if they aren't set\n // This will allow the initial state to be in the history entry\n const state = ref.current.getRootState();\n\n if (state) {\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n if (previousStateRef.current === undefined) {\n previousStateRef.current = state;\n }\n\n history.replace({ path, state });\n }\n }\n\n const onStateChange = async () => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const previousState = previousStateRef.current;\n const state = navigation.getRootState();\n\n // root state may not available, for example when root navigators switch inside the container\n if (!state) {\n return;\n }\n\n const pendingPath = pendingPopStatePathRef.current;\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n previousStateRef.current = state;\n pendingPopStatePathRef.current = undefined;\n\n // To detect the kind of state change, we need to:\n // - Find the common focused navigation state in previous and current state\n // - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace\n // - If no common focused navigation state found, it's a replace\n const [previousFocusedState, focusedState] = findMatchingState(previousState, state);\n\n if (\n previousFocusedState &&\n focusedState &&\n // We should only handle push/pop if path changed from what was in last `popstate`\n // Otherwise it's likely a change triggered by `popstate`\n path !== pendingPath\n ) {\n const historyDelta =\n (focusedState.history ? focusedState.history.length : focusedState.routes.length) -\n (previousFocusedState.history\n ? previousFocusedState.history.length\n : previousFocusedState.routes.length);\n\n if (historyDelta > 0) {\n // If history length is increased, we should pushState\n // Note that path might not actually change here, for example, drawer open should pushState\n history.push({ path, state });\n } else if (historyDelta < 0) {\n // If history length is decreased, i.e. entries were removed, we want to go back\n\n const nextIndex = history.backIndex({ path });\n const currentIndex = history.index;\n\n try {\n if (\n nextIndex !== -1 &&\n nextIndex < currentIndex &&\n // We should only go back if the entry exists and it's less than current index\n history.get(nextIndex - currentIndex)\n ) {\n // An existing entry for this path exists and it's less than current index, go back to that\n await history.go(nextIndex - currentIndex);\n } else {\n // We couldn't find an existing entry to go back to, so we'll go back by the delta\n // This won't be correct if multiple routes were pushed in one go before\n // Usually this shouldn't happen and this is a fallback for that\n await history.go(historyDelta);\n }\n\n // Store the updated state as well as fix the path if incorrect\n history.replace({ path, state });\n } catch {\n // The navigation was interrupted\n }\n } else {\n // If history length is unchanged, we want to replaceState\n history.replace({ path, state });\n }\n } else {\n // If no common navigation state was found, assume it's a replace\n // This would happen if the user did a reset/conditionally changed navigators\n history.replace({ path, state });\n }\n };\n\n // We debounce onStateChange coz we don't want multiple state changes to be handled at one time\n // This could happen since `history.go(n)` is asynchronous\n // If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up\n return ref.current?.addListener('state', series(onStateChange));\n }, [enabled, history, ref]);\n\n return {\n getInitialState,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useLinking.js","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAUkC;AAClC,sEAAsC;AACtC,6CAA+B;AAE/B,+DAA4D;AAC5D,iFAAsE;AAItE;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CACxB,CAAgB,EAChB,CAAgB,EACgB,EAAE;IAClC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAA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4BAChB,SAAS,GAAG,YAAY;4BACxB,8EAA8E;4BAC9E,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,YAAY,CAAC,EACrC;4BACA,2FAA2F;4BAC3F,MAAM,OAAO,CAAC,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC;yBAC5C;6BAAM;4BACL,kFAAkF;4BAClF,wEAAwE;4BACxE,gEAAgE;4BAChE,MAAM,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;yBAChC;wBAED,+DAA+D;wBAC/D,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;qBAClC;oBAAC,MAAM;wBACN,iCAAiC;qBAClC;iBACF;qBAAM;oBACL,0DAA0D;oBAC1D,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;iBAClC;aACF;iBAAM;gBACL,iEAAiE;gBACjE,6EAA6E;gBAC7E,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;aAClC;QACH,CAAC,CAAC;QAEF,+FAA+F;QAC/F,0DAA0D;QAC1D,qGAAqG;QACrG,OAAO,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,IAAA,cAAM,EAAC,aAAa,CAAC,CAAC,CAAC;IAClE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IAE5B,OAAO;QACL,eAAe;KAChB,CAAC;AACJ,CAAC;AA5VD,gCA4VC","sourcesContent":["import {\n LinkingOptions,\n findFocusedRoute,\n getActionFromState as getActionFromStateDefault,\n getPathFromState as getPathFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n type NavigationContainerRef,\n type NavigationState,\n type ParamListBase,\n useNavigationIndependentTree,\n} from '@react-navigation/native';\nimport isEqual from 'fast-deep-equal';\nimport * as React from 'react';\n\nimport { createMemoryHistory } from './createMemoryHistory';\nimport { ServerContext } from '../global-state/serverLocationContext';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\n/**\n * Find the matching navigation state that changed between 2 navigation states\n * e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state\n */\nconst findMatchingState = <T extends NavigationState>(\n a: T | undefined,\n b: T | undefined\n): [T | undefined, T | undefined] => {\n if (a === undefined || b === undefined || a.key !== b.key) {\n return [undefined, undefined];\n }\n\n // Tab and drawer will have `history` property, but stack will have history in `routes`\n const aHistoryLength = a.history ? a.history.length : a.routes.length;\n const bHistoryLength = b.history ? b.history.length : b.routes.length;\n\n const aRoute = a.routes[a.index];\n const bRoute = b.routes[b.index];\n\n const aChildState = aRoute.state as T | undefined;\n const bChildState = bRoute.state as T | undefined;\n\n // Stop here if this is the state object that changed:\n // - history length is different\n // - focused routes are different\n // - one of them doesn't have child state\n // - child state keys are different\n if (\n aHistoryLength !== bHistoryLength ||\n aRoute.key !== bRoute.key ||\n aChildState === undefined ||\n bChildState === undefined ||\n aChildState.key !== bChildState.key\n ) {\n return [a, b];\n }\n\n return findMatchingState(aChildState, bChildState);\n};\n\n/**\n * Run async function in series as it's called.\n */\nexport const series = (cb: () => Promise<void>) => {\n let queue = Promise.resolve();\n const callback = () => {\n queue = queue.then(cb);\n };\n return callback;\n};\n\nconst linkingHandlers: symbol[] = [];\n\ntype Options = LinkingOptions<ParamListBase>;\n\nexport function useLinking(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n enabled = true,\n config,\n getStateFromPath = getStateFromPathDefault,\n getPathFromState = getPathFromStateDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options,\n onUnhandledLinking: (lastUnhandledLining: string | undefined) => void\n) {\n const independent = useNavigationIndependentTree();\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n const [history] = React.useState(createMemoryHistory);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = React.useRef(enabled);\n const configRef = React.useRef(config);\n const getStateFromPathRef = React.useRef(getStateFromPath);\n const getPathFromStateRef = React.useRef(getPathFromState);\n const getActionFromStateRef = React.useRef(getActionFromState);\n\n React.useEffect(() => {\n enabledRef.current = enabled;\n configRef.current = config;\n getStateFromPathRef.current = getStateFromPath;\n getPathFromStateRef.current = getPathFromState;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const validateRoutesNotExistInRootState = React.useCallback(\n (state: ResultState) => {\n const navigation = ref.current;\n const rootState = navigation?.getRootState();\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n return state?.routes.some((r) => !rootState?.routeNames.includes(r.name));\n },\n [ref]\n );\n\n const server = React.useContext(ServerContext);\n\n const getInitialState = React.useCallback(() => {\n let value: ResultState | undefined;\n\n if (enabledRef.current) {\n const location =\n server?.location ?? (typeof window !== 'undefined' ? window.location : undefined);\n\n const path = location ? location.pathname + location.search : undefined;\n\n if (path) {\n value = getStateFromPathRef.current(path, configRef.current);\n }\n\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(value) : value);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const previousIndexRef = React.useRef<number | undefined>(undefined);\n const previousStateRef = React.useRef<NavigationState | undefined>(undefined);\n const pendingPopStatePathRef = React.useRef<string | undefined>(undefined);\n\n React.useEffect(() => {\n previousIndexRef.current = history.index;\n\n return history.listen(() => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const { location } = window;\n\n const path = location.pathname + location.search + location.hash;\n const index = history.index;\n\n const previousIndex = previousIndexRef.current ?? 0;\n\n previousIndexRef.current = index;\n pendingPopStatePathRef.current = path;\n\n // When browser back/forward is clicked, we first need to check if state object for this index exists\n // If it does we'll reset to that state object\n // Otherwise, we'll handle it like a regular deep link\n const record = history.get(index);\n\n if (record?.path === path && record?.state) {\n navigation.resetRoot(record.state);\n return;\n }\n\n const state = getStateFromPathRef.current(path, configRef.current);\n\n // We should only dispatch an action when going forward\n // Otherwise the action will likely add items to history, which would mess things up\n if (state) {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n if (validateRoutesNotExistInRootState(state)) {\n return;\n }\n\n if (index > previousIndex) {\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${path}': ${\n typeof e === 'object' && e != null && 'message' in e ? e.message : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n // if current path didn't return any state, we should revert to initial state\n navigation.resetRoot(state);\n }\n });\n }, [enabled, history, onUnhandledLinking, ref, validateRoutesNotExistInRootState]);\n\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const getPathForRoute = (\n route: ReturnType<typeof findFocusedRoute>,\n state: NavigationState\n ): string => {\n let path;\n\n // If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match\n // This makes sure that we preserve the original URL for wildcard routes\n if (route?.path) {\n const stateForPath = getStateFromPathRef.current(route.path, configRef.current);\n\n if (stateForPath) {\n const focusedRoute = findFocusedRoute(stateForPath);\n\n if (\n focusedRoute &&\n focusedRoute.name === route.name &&\n isEqual({ ...focusedRoute.params }, { ...route.params })\n ) {\n path = route.path;\n }\n }\n }\n\n if (path == null) {\n path = getPathFromStateRef.current(state, configRef.current);\n }\n\n // START FORK - ExpoRouter manually handles hashes\n // const previousRoute = previousStateRef.current\n // ? findFocusedRoute(previousStateRef.current)\n // : undefined;\n\n // Preserve the hash if the route didn't change\n // if (\n // previousRoute &&\n // route &&\n // 'key' in previousRoute &&\n // 'key' in route &&\n // previousRoute.key === route.key\n // ) {\n // path = path + location.hash;\n // }\n // END FORK\n\n return path;\n };\n\n if (ref.current) {\n // We need to record the current metadata on the first render if they aren't set\n // This will allow the initial state to be in the history entry\n const state = ref.current.getRootState();\n\n if (state) {\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n if (previousStateRef.current === undefined) {\n previousStateRef.current = state;\n }\n\n history.replace({ path, state });\n }\n }\n\n const onStateChange = async () => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const previousState = previousStateRef.current;\n const state = navigation.getRootState();\n\n // root state may not available, for example when root navigators switch inside the container\n if (!state) {\n return;\n }\n\n const pendingPath = pendingPopStatePathRef.current;\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n previousStateRef.current = state;\n pendingPopStatePathRef.current = undefined;\n\n // To detect the kind of state change, we need to:\n // - Find the common focused navigation state in previous and current state\n // - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace\n // - If no common focused navigation state found, it's a replace\n const [previousFocusedState, focusedState] = findMatchingState(previousState, state);\n\n if (\n previousFocusedState &&\n focusedState &&\n // We should only handle push/pop if path changed from what was in last `popstate`\n // Otherwise it's likely a change triggered by `popstate`\n path !== pendingPath\n ) {\n const historyDelta =\n (focusedState.history ? focusedState.history.length : focusedState.routes.length) -\n (previousFocusedState.history\n ? previousFocusedState.history.length\n : previousFocusedState.routes.length);\n\n if (historyDelta > 0) {\n // If history length is increased, we should pushState\n // Note that path might not actually change here, for example, drawer open should pushState\n history.push({ path, state });\n } else if (historyDelta < 0) {\n // If history length is decreased, i.e. entries were removed, we want to go back\n\n const nextIndex = history.backIndex({ path });\n const currentIndex = history.index;\n\n try {\n if (\n nextIndex !== -1 &&\n nextIndex < currentIndex &&\n // We should only go back if the entry exists and it's less than current index\n history.get(nextIndex - currentIndex)\n ) {\n // An existing entry for this path exists and it's less than current index, go back to that\n await history.go(nextIndex - currentIndex);\n } else {\n // We couldn't find an existing entry to go back to, so we'll go back by the delta\n // This won't be correct if multiple routes were pushed in one go before\n // Usually this shouldn't happen and this is a fallback for that\n await history.go(historyDelta);\n }\n\n // Store the updated state as well as fix the path if incorrect\n history.replace({ path, state });\n } catch {\n // The navigation was interrupted\n }\n } else {\n // If history length is unchanged, we want to replaceState\n history.replace({ path, state });\n }\n } else {\n // If no common navigation state was found, assume it's a replace\n // This would happen if the user did a reset/conditionally changed navigators\n history.replace({ path, state });\n }\n };\n\n // We debounce onStateChange coz we don't want multiple state changes to be handled at one time\n // This could happen since `history.go(n)` is asynchronous\n // If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up\n return ref.current?.addListener('state', series(onStateChange));\n }, [enabled, history, ref]);\n\n return {\n getInitialState,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/
|
|
1
|
+
import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/native';
|
|
2
2
|
import { LinkingOptions } from '@react-navigation/native';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
type Options = LinkingOptions<ParamListBase>;
|
|
@@ -8,24 +8,24 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
8
8
|
index: number;
|
|
9
9
|
routeNames: string[];
|
|
10
10
|
history?: unknown[] | undefined;
|
|
11
|
-
routes: import("@react-navigation/
|
|
11
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
12
12
|
type: string;
|
|
13
13
|
stale: false;
|
|
14
14
|
}>, "stale" | "routes">> & Readonly<{
|
|
15
15
|
stale?: true | undefined;
|
|
16
|
-
routes: import("@react-navigation/
|
|
16
|
+
routes: import("@react-navigation/native").PartialRoute<import("@react-navigation/native").Route<string, object | undefined>>[];
|
|
17
17
|
}> & {
|
|
18
18
|
state?: (Partial<Omit<Readonly<{
|
|
19
19
|
key: string;
|
|
20
20
|
index: number;
|
|
21
21
|
routeNames: string[];
|
|
22
22
|
history?: unknown[] | undefined;
|
|
23
|
-
routes: import("@react-navigation/
|
|
23
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
24
24
|
type: string;
|
|
25
25
|
stale: false;
|
|
26
26
|
}>, "stale" | "routes">> & Readonly<{
|
|
27
27
|
stale?: true | undefined;
|
|
28
|
-
routes: import("@react-navigation/
|
|
28
|
+
routes: import("@react-navigation/native").PartialRoute<import("@react-navigation/native").Route<string, object | undefined>>[];
|
|
29
29
|
}> & any) | undefined;
|
|
30
30
|
}) | undefined>;
|
|
31
31
|
};
|