expo-router 3.5.0 → 3.5.2
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.js +2 -1
- package/build/ExpoRoot.js.map +1 -1
- package/build/LocationProvider.js +3 -2
- package/build/LocationProvider.js.map +1 -1
- package/build/Route.js +4 -4
- package/build/Route.js.map +1 -1
- package/build/fork/NavigationContainer.d.ts +8 -2
- package/build/fork/NavigationContainer.d.ts.map +1 -1
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/NavigationContainer.native.d.ts +8 -2
- package/build/fork/NavigationContainer.native.d.ts.map +1 -1
- package/build/fork/NavigationContainer.native.js.map +1 -1
- package/build/fork/extractPathFromURL.d.ts +5 -4
- package/build/fork/extractPathFromURL.d.ts.map +1 -1
- package/build/fork/extractPathFromURL.js +29 -43
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/findFocusedRoute.js +2 -1
- package/build/fork/findFocusedRoute.js.map +1 -1
- package/build/fork/getPathFromState.js +5 -4
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/fork/getStateFromPath.js +5 -4
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/useLinking.d.ts +42 -3
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js +1 -1
- package/build/fork/useLinking.js.map +1 -1
- package/build/fork/useLinking.native.js +1 -1
- package/build/fork/useLinking.native.js.map +1 -1
- package/build/fork/validatePathConfig.js +1 -1
- package/build/fork/validatePathConfig.js.map +1 -1
- package/build/getDevServer/index.js.map +1 -1
- package/build/getLinkingConfig.js +3 -3
- package/build/getLinkingConfig.js.map +1 -1
- package/build/getReactNavigationConfig.js +3 -2
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutes.js +8 -7
- package/build/getRoutes.js.map +1 -1
- package/build/getServerManifest.js +3 -2
- package/build/getServerManifest.js.map +1 -1
- package/build/global-state/router-store.js +5 -5
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.js +11 -10
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/serverLocationContext.d.ts +1 -0
- package/build/global-state/serverLocationContext.d.ts.map +1 -1
- package/build/global-state/sort-routes.js +2 -1
- package/build/global-state/sort-routes.js.map +1 -1
- package/build/head/ExpoHead.android.js +2 -1
- package/build/head/ExpoHead.android.js.map +1 -1
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/head/ExpoHeadModule.js.map +1 -1
- package/build/head/url.js +2 -1
- package/build/head/url.js.map +1 -1
- package/build/hooks.js +11 -10
- package/build/hooks.js.map +1 -1
- package/build/layouts/Drawer.d.ts +1 -0
- package/build/layouts/Drawer.d.ts.map +1 -1
- package/build/layouts/Stack.d.ts +1 -0
- package/build/layouts/Stack.d.ts.map +1 -1
- package/build/layouts/Tabs.d.ts +4 -4
- package/build/layouts/Tabs.d.ts.map +1 -1
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.js +3 -2
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -2
- package/build/link/Link.js.map +1 -1
- package/build/link/href.d.ts.map +1 -1
- package/build/link/href.js.map +1 -1
- package/build/link/linking.d.ts.map +1 -1
- package/build/link/linking.js +31 -41
- package/build/link/linking.js.map +1 -1
- package/build/link/path.js +2 -1
- package/build/link/path.js.map +1 -1
- package/build/link/useLinkToPathProps.d.ts.map +1 -1
- package/build/link/useLinkToPathProps.js +1 -1
- package/build/link/useLinkToPathProps.js.map +1 -1
- package/build/link/useLoadedNavigation.d.ts.map +1 -1
- package/build/link/useLoadedNavigation.js +3 -2
- package/build/link/useLoadedNavigation.js.map +1 -1
- package/build/loadStaticParamsAsync.js +3 -2
- package/build/loadStaticParamsAsync.js.map +1 -1
- package/build/matchers.js +13 -12
- package/build/matchers.js.map +1 -1
- package/build/onboard/Tutorial.d.ts +1 -0
- package/build/onboard/Tutorial.d.ts.map +1 -1
- package/build/onboard/Tutorial.js +2 -1
- package/build/onboard/Tutorial.js.map +1 -1
- package/build/onboard/createEntryFile.js +3 -2
- package/build/onboard/createEntryFile.js.map +1 -1
- package/build/primitives.d.ts +1 -0
- package/build/primitives.d.ts.map +1 -1
- package/build/qualified-entry.d.ts +1 -0
- package/build/qualified-entry.d.ts.map +1 -1
- package/build/qualified-entry.js +2 -1
- package/build/qualified-entry.js.map +1 -1
- package/build/renderRootComponent.js +2 -1
- package/build/renderRootComponent.js.map +1 -1
- package/build/routes-manifest.js +2 -1
- package/build/routes-manifest.js.map +1 -1
- package/build/sortRoutes.js +3 -2
- package/build/sortRoutes.js.map +1 -1
- package/build/static/getRootComponent.js +2 -1
- package/build/static/getRootComponent.js.map +1 -1
- package/build/static/html.js +3 -2
- package/build/static/html.js.map +1 -1
- package/build/static/renderStaticContent.js +4 -2
- package/build/static/renderStaticContent.js.map +1 -1
- package/build/testing-library/context-stubs.d.ts +1 -0
- package/build/testing-library/context-stubs.d.ts.map +1 -1
- package/build/testing-library/context-stubs.js +3 -3
- package/build/testing-library/context-stubs.js.map +1 -1
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js +2 -2
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mock-config.js +3 -2
- package/build/testing-library/mock-config.js.map +1 -1
- package/build/testing-library/mocks.js +2 -1
- package/build/testing-library/mocks.js.map +1 -1
- package/build/testing-library/require-context-ponyfill.js +1 -1
- package/build/testing-library/require-context-ponyfill.js.map +1 -1
- package/build/typed-routes/generate.js +2 -1
- package/build/typed-routes/generate.js.map +1 -1
- package/build/typed-routes/index.d.ts.map +1 -1
- package/build/typed-routes/index.js +2 -2
- package/build/typed-routes/index.js.map +1 -1
- package/build/useDeprecated.js +3 -2
- package/build/useDeprecated.js.map +1 -1
- package/build/useFocusEffect.js +2 -1
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.js +3 -2
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.d.ts +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +4 -3
- package/build/useScreens.js.map +1 -1
- package/build/utils/url.js +4 -3
- package/build/utils/url.js.map +1 -1
- package/build/views/EmptyRoute.d.ts +1 -0
- package/build/views/EmptyRoute.d.ts.map +1 -1
- package/build/views/EmptyRoute.js +2 -1
- package/build/views/EmptyRoute.js.map +1 -1
- package/build/views/ErrorBoundary.d.ts +1 -0
- package/build/views/ErrorBoundary.d.ts.map +1 -1
- package/build/views/ErrorBoundary.js +2 -1
- package/build/views/ErrorBoundary.js.map +1 -1
- package/build/views/Navigator.d.ts +5 -5
- package/build/views/Navigator.d.ts.map +1 -1
- package/build/views/Navigator.js +7 -7
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Pressable.d.ts.map +1 -1
- package/build/views/Screen.js +2 -1
- package/build/views/Screen.js.map +1 -1
- package/build/views/Sitemap.d.ts +1 -0
- package/build/views/Sitemap.d.ts.map +1 -1
- package/build/views/Sitemap.js +3 -2
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/SuspenseFallback.d.ts +1 -0
- package/build/views/SuspenseFallback.d.ts.map +1 -1
- package/build/views/SuspenseFallback.js +2 -1
- package/build/views/SuspenseFallback.js.map +1 -1
- package/build/views/Toast.js +3 -3
- package/build/views/Toast.js.map +1 -1
- package/build/views/Try.js.map +1 -1
- package/build/views/Unmatched.d.ts +1 -0
- package/build/views/Unmatched.d.ts.map +1 -1
- package/build/views/Unmatched.js +2 -1
- package/build/views/Unmatched.js.map +1 -1
- package/package.json +4 -4
package/build/ExpoRoot.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ExpoRoot =
|
|
30
|
+
exports.ExpoRoot = void 0;
|
|
31
31
|
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
32
32
|
const expo_status_bar_1 = require("expo-status-bar");
|
|
33
33
|
const react_1 = __importStar(require("react"));
|
|
@@ -65,6 +65,7 @@ function ExpoRoot({ wrapper: ParentWrapper = react_1.Fragment, ...props }) {
|
|
|
65
65
|
};
|
|
66
66
|
return <ContextNavigator {...props} wrapper={wrapper}/>;
|
|
67
67
|
}
|
|
68
|
+
exports.ExpoRoot = ExpoRoot;
|
|
68
69
|
const initialUrl = react_native_1.Platform.OS === 'web' && typeof window !== 'undefined'
|
|
69
70
|
? new URL(window.location.href)
|
|
70
71
|
: undefined;
|
package/build/ExpoRoot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,oEAAuC;AACvC,qDAA4C;AAC5C,+CAAoF;AACpF,+CAAwC;AACxC,mFAAkE;AAElE,qFAAqE;AACrE,8DAAsE;AACtE,gFAA6E;AAE7E,2CAA8C;AAQ9C,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,M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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 { NavigationAction } from '@react-navigation/native';\nimport Constants from 'expo-constants';\nimport { StatusBar } from 'expo-status-bar';\nimport React, { type PropsWithChildren, Fragment, type ComponentType } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport UpstreamNavigationContainer from './fork/NavigationContainer';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { ServerLocationContext } from './global-state/serverLocationContext';\nimport { RequireContext } from './types';\nimport { SplashScreen } from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL;\n wrapper?: ComponentType<PropsWithChildren>;\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\nconst hasViewControllerBasedStatusBarAppearance =\n Platform.OS === 'ios' &&\n !!Constants.expoConfig?.ios?.infoPlist?.UIViewControllerBasedStatusBarAppearance;\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 {children}\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <StatusBar style=\"auto\" />}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\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}: ExpoRootProps) {\n const store = useInitializeExpoRouter(context, initialLocation);\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}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerLocationContext.Provider value={initialLocation}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerLocationContext.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,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRouteInfoFromState =
|
|
4
|
-
exports.getNormalizedStatePath = getNormalizedStatePath;
|
|
3
|
+
exports.getNormalizedStatePath = exports.getRouteInfoFromState = void 0;
|
|
5
4
|
const getStateFromPath_1 = require("./fork/getStateFromPath");
|
|
6
5
|
function getRouteInfoFromState(getPathFromState, state, baseUrl) {
|
|
7
6
|
const { path } = getPathFromState(state, false);
|
|
@@ -14,6 +13,7 @@ function getRouteInfoFromState(getPathFromState, state, baseUrl) {
|
|
|
14
13
|
...getNormalizedStatePath(qualified, baseUrl),
|
|
15
14
|
};
|
|
16
15
|
}
|
|
16
|
+
exports.getRouteInfoFromState = getRouteInfoFromState;
|
|
17
17
|
function isIndexPath(state) {
|
|
18
18
|
const route = state.routes[state.index ?? state.routes.length - 1];
|
|
19
19
|
if (route.state) {
|
|
@@ -64,4 +64,5 @@ function getNormalizedStatePath({ path: statePath, params, }, baseUrl) {
|
|
|
64
64
|
}, {}),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
+
exports.getNormalizedStatePath = getNormalizedStatePath;
|
|
67
68
|
//# sourceMappingURL=LocationProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;;AACA,8DAAuD;AAYvD,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF,KAAY,EACZ,OAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO;QACL,kEAAkE;QAClE,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAA,+BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;QACrD,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC;QAC3B,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC;AAfD,sDAeC;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,WAAW,CAAC,KA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C,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAe,CAAC,CAAC;iBACjD;gBAAC,MAAM;oBACN,IAAI,CAAC,GAAG,CAAC,GAAG,KAAe,CAAC;iBAC7B;aACF;YACD,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAAkB,CAAC;KACvB,CAAC;AACJ,CAAC;AAnCD,wDAmCC","sourcesContent":["import type { State } from './fork/getPathFromState';\nimport { stripBaseUrl } from './fork/getStateFromPath';\n\ntype SearchParams = Record<string, string | string[]>;\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: SearchParams;\n segments: string[];\n isIndex: boolean;\n};\n\nexport function getRouteInfoFromState(\n getPathFromState: (state: State, asPath: boolean) => { path: string; params: any },\n state: State,\n baseUrl?: string\n): UrlObject {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n\n return {\n // TODO: This may have a predefined origin attached in the future.\n unstable_globalHref: path,\n pathname: stripBaseUrl(path, baseUrl).split('?')['0'],\n isIndex: isIndexPath(state),\n ...getNormalizedStatePath(qualified, baseUrl),\n };\n}\n\nfunction isIndexPath(state: State) {\n const route = state.routes[state.index ?? state.routes.length - 1];\n if (route.state) {\n return isIndexPath(route.state);\n }\n\n // Index routes on the same level as a layout do not have `index` in their name\n if (route.params && 'screen' in route.params) {\n return route.params.screen === 'index';\n }\n\n // The `params` key will not exist if there are no params\n // So we need to do a positive lookahead to check if the route ends with /index\n // Nested routes that are hoisted will have a name ending with /index\n // e.g name could be /user/[id]/index\n if (route.name.match(/.+\\/index$/)) return true;\n\n // The state will either have params (because there are multiple _layout) or it will be hoisted with a name\n // If we don't match the above cases, then it's not an index route\n\n return false;\n}\n\n// TODO: Split up getPathFromState to return all this info at once.\nexport function getNormalizedStatePath(\n {\n path: statePath,\n params,\n }: {\n path: string;\n params: any;\n },\n baseUrl?: string\n): Pick<UrlObject, 'segments' | 'params'> {\n const [pathname] = statePath.split('?');\n return {\n // Strip empty path at the start\n segments: stripBaseUrl(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent),\n // TODO: This is not efficient, we should generate based on the state instead\n // of converting to string then back to object\n params: Object.entries(params).reduce((prev, [key, value]) => {\n if (Array.isArray(value)) {\n prev[key] = value.map((v: string) => {\n try {\n return decodeURIComponent(v);\n } catch {\n return v;\n }\n });\n } else {\n try {\n prev[key] = decodeURIComponent(value as string);\n } catch {\n prev[key] = value as string;\n }\n }\n return prev;\n }, {} as SearchParams),\n };\n}\n"]}
|
package/build/Route.js
CHANGED
|
@@ -24,10 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.sortRoutes = exports.sortRoutesWithInitial = void 0;
|
|
28
|
-
exports.useRouteNode = useRouteNode;
|
|
29
|
-
exports.useContextKey = useContextKey;
|
|
30
|
-
exports.Route = Route;
|
|
27
|
+
exports.sortRoutes = exports.sortRoutesWithInitial = exports.Route = exports.useContextKey = exports.useRouteNode = void 0;
|
|
31
28
|
const react_1 = __importStar(require("react"));
|
|
32
29
|
const matchers_1 = require("./matchers");
|
|
33
30
|
const sortRoutes_1 = require("./sortRoutes");
|
|
@@ -41,6 +38,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
41
38
|
function useRouteNode() {
|
|
42
39
|
return (0, react_1.useContext)(CurrentRouteContext);
|
|
43
40
|
}
|
|
41
|
+
exports.useRouteNode = useRouteNode;
|
|
44
42
|
function useContextKey() {
|
|
45
43
|
const node = useRouteNode();
|
|
46
44
|
if (node == null) {
|
|
@@ -48,8 +46,10 @@ function useContextKey() {
|
|
|
48
46
|
}
|
|
49
47
|
return (0, matchers_1.getContextKey)(node.contextKey);
|
|
50
48
|
}
|
|
49
|
+
exports.useContextKey = useContextKey;
|
|
51
50
|
/** Provides the matching routes and filename to the children. */
|
|
52
51
|
function Route({ children, node }) {
|
|
53
52
|
return <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>;
|
|
54
53
|
}
|
|
54
|
+
exports.Route = Route;
|
|
55
55
|
//# sourceMappingURL=Route.js.map
|
package/build/Route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,+CAAkE;AAGlE,yCAA2C;AAC3C,6CAAiE;AA6DxD,sGA7DA,kCAAqB,OA6DA;AAAE,2FA7DA,uBAAU,OA6DA;AAxB1C,MAAM,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AAExE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;CAC/C;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAND,sCAMC;AAED,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAA0C;IAC9E,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC9F,CAAC;AAFD,sBAEC","sourcesContent":["'use client';\n\nimport React, { type PropsWithChildren, useContext } from 'react';\n\nimport type { ErrorBoundaryProps } from './exports';\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\n\nexport type DynamicConvention = { name: string; deep: boolean; notFound?: boolean };\n\nexport type LoadedRoute = {\n ErrorBoundary?: React.ComponentType<ErrorBoundaryProps>;\n default?: React.ComponentType<any>;\n unstable_settings?: Record<string, any>;\n getNavOptions?: (args: any) => any;\n generateStaticParams?: (props: {\n params?: Record<string, string | string[]>;\n }) => Record<string, string | string[]>[];\n};\n\nexport type RouteNode = {\n /** The type of RouteNode */\n type: 'route' | 'api' | 'layout';\n /** Load a route into memory. Returns the exports from a route. */\n loadRoute: () => Partial<LoadedRoute>;\n /** Loaded initial route name. */\n initialRouteName?: string;\n /** nested routes */\n children: RouteNode[];\n /** Is the route a dynamic path */\n dynamic: null | DynamicConvention[];\n /** `index`, `error-boundary`, etc. */\n route: string;\n /** Context Module ID, used for matching children. */\n contextKey: string;\n /** Added in-memory */\n generated?: boolean;\n /** Internal screens like the directory or the auto 404 should be marked as internal. */\n internal?: boolean;\n /** File paths for async entry modules that should be included in the initial chunk request to ensure the runtime JavaScript matches the statically rendered HTML representation. */\n entryPoints?: string[];\n};\n\nconst CurrentRouteContext = React.createContext<RouteNode | null>(null);\n\nif (process.env.NODE_ENV !== 'production') {\n CurrentRouteContext.displayName = 'RouteNode';\n}\n\n/** Return the RouteNode at the current contextual boundary. */\nexport function useRouteNode(): RouteNode | null {\n return useContext(CurrentRouteContext);\n}\n\nexport function useContextKey(): string {\n const node = useRouteNode();\n if (node == null) {\n throw new Error('No filename found. This is likely a bug in expo-router.');\n }\n return getContextKey(node.contextKey);\n}\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({ children, node }: PropsWithChildren<{ node: RouteNode }>) {\n return <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>;\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
|
|
@@ -13,8 +13,14 @@ type Props<ParamList extends object> = NavigationContainerProps & {
|
|
|
13
13
|
documentTitle?: DocumentTitleOptions;
|
|
14
14
|
onReady?: () => void;
|
|
15
15
|
};
|
|
16
|
-
declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props:
|
|
17
|
-
|
|
16
|
+
declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: NavigationContainerProps & {
|
|
17
|
+
theme?: Theme | undefined;
|
|
18
|
+
linking?: LinkingOptions<RootParamList> | undefined;
|
|
19
|
+
fallback?: React.ReactNode;
|
|
20
|
+
documentTitle?: DocumentTitleOptions | undefined;
|
|
21
|
+
onReady?: (() => void) | undefined;
|
|
22
|
+
} & {
|
|
23
|
+
ref?: React.Ref<NavigationContainerRef<RootParamList>> | undefined;
|
|
18
24
|
}) => React.ReactElement;
|
|
19
25
|
export default NavigationContainer;
|
|
20
26
|
//# sourceMappingURL=NavigationContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,wBAAwB,EACxB,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,oBAAoB,EACpB,cAAc,EAEd,KAAK,EACN,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAC;CACH;AAID,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAuGF,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,wBAAwB,EACxB,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,oBAAoB,EACpB,cAAc,EAEd,KAAK,EACN,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAC;CACH;AAID,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAuGF,QAAA,MAAM,mBAAmB;;;eA1GZ,MAAM,SAAS;;qBAEV,IAAI;;;MA8GjB,MAAM,YAAY,CAAC;AAExB,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,4GAA4G;AAC5G,iDASgC;AAChC,qDAOkC;AAClC,+FAAuE;AACvE,qGAA6E;AAC7E,2FAAmE;AACnE,6CAA+B;AAE/B,8DAAsC;AAUtC,MAAM,CAAC,yBAAyB,GAAG,IAAI,OAAO,EAAE,CAAC;AAUjD;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAC/B,EACE,KAAK,GAAG,qBAAY,EACpB,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,aAAa,EACb,OAAO,EACP,GAAG,IAAI,EACc,EACvB,GAA6D;IAE7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,OAAO,EAAE,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,4GAA4G;AAC5G,iDASgC;AAChC,qDAOkC;AAClC,+FAAuE;AACvE,qGAA6E;AAC7E,2FAAmE;AACnE,6CAA+B;AAE/B,8DAAsC;AAUtC,MAAM,CAAC,yBAAyB,GAAG,IAAI,OAAO,EAAE,CAAC;AAUjD;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAC/B,EACE,KAAK,GAAG,qBAAY,EACpB,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,aAAa,EACb,OAAO,EACP,GAAG,IAAI,EACc,EACvB,GAA6D;IAE7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,OAAO,EAAE,MAAM,EAAE;QACnB,IAAA,yBAAkB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACpC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AM,OAAO,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,IAAI,CAAC,gBAAgB,IAAI,UAAU,CAAC;IAE7E,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEzC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO,EAAE;YACX,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;SACxB;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE;QACZ,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,QAA8B,CAAC;KACvC;IAED,OAAO,CACL,CAAC,uBAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAC7C;MAAA,CAAC,sBAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAC1B;QAAA,CAAC,8BAAuB,CACtB,IAAI,IAAI,CAAC,CACT,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3E,GAAG,CAAC,CAAC,YAAY,CAAC,EAEtB;MAAA,EAAE,sBAAa,CACjB;IAAA,EAAE,uBAAc,CAAC,QAAQ,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,wBAAwB,CAM9C,CAAC;AAExB,kBAAe,mBAAmB,CAAC","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/NavigationContainer.tsx\nimport {\n BaseNavigationContainer,\n getActionFromState,\n getPathFromState,\n getStateFromPath,\n NavigationContainerProps,\n NavigationContainerRef,\n ParamListBase,\n validatePathConfig,\n} from '@react-navigation/core';\nimport {\n DefaultTheme,\n ThemeProvider,\n DocumentTitleOptions,\n LinkingOptions,\n LinkingContext,\n Theme,\n} from '@react-navigation/native';\nimport useBackButton from '@react-navigation/native/src/useBackButton';\nimport useDocumentTitle from '@react-navigation/native/src/useDocumentTitle';\nimport useThenable from '@react-navigation/native/src/useThenable';\nimport * as React from 'react';\n\nimport useLinking from './useLinking';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var REACT_NAVIGATION_DEVTOOLS: WeakMap<\n NavigationContainerRef<any>,\n { readonly linking: LinkingOptions<any> }\n >;\n}\n\nglobal.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends object> = NavigationContainerProps & {\n theme?: Theme;\n linking?: LinkingOptions<ParamList>;\n fallback?: React.ReactNode;\n documentTitle?: DocumentTitleOptions;\n onReady?: () => void;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.theme Theme object for the navigators.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n {\n theme = DefaultTheme,\n linking,\n fallback = null,\n documentTitle,\n onReady,\n ...rest\n }: Props<ParamListBase>,\n ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n if (linking?.config) {\n validatePathConfig(linking.config);\n }\n\n const refContainer = React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n useBackButton(refContainer);\n useDocumentTitle(refContainer, documentTitle);\n\n const { getInitialState } = useLinking(refContainer, {\n independent: rest.independent,\n enabled: isLinkingEnabled,\n prefixes: [],\n ...linking,\n });\n\n // Add additional linking related info to the ref\n // This will be used by the devtools\n React.useEffect(() => {\n if (refContainer.current) {\n REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n get linking() {\n return {\n ...linking,\n enabled: isLinkingEnabled,\n prefixes: linking?.prefixes ?? [],\n getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n getPathFromState: linking?.getPathFromState ?? getPathFromState,\n getActionFromState: linking?.getActionFromState ?? getActionFromState,\n };\n },\n });\n }\n });\n\n const [isResolved, initialState] = useThenable(getInitialState);\n\n React.useImperativeHandle(ref, () => refContainer.current);\n\n const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n\n const onReadyRef = React.useRef(onReady);\n\n React.useEffect(() => {\n onReadyRef.current = onReady;\n });\n\n React.useEffect(() => {\n if (isReady) {\n onReadyRef.current?.();\n }\n }, [isReady]);\n\n if (!isReady) {\n // This is temporary until we have Suspense for data-fetching\n // Then the fallback will be handled by a parent `Suspense` component\n return fallback as React.ReactElement;\n }\n\n return (\n <LinkingContext.Provider value={linkingContext}>\n <ThemeProvider value={theme}>\n <BaseNavigationContainer\n {...rest}\n initialState={rest.initialState == null ? initialState : rest.initialState}\n ref={refContainer}\n />\n </ThemeProvider>\n </LinkingContext.Provider>\n );\n}\n\nconst NavigationContainer = React.forwardRef(NavigationContainerInner) as <\n RootParamList extends object = ReactNavigation.RootParamList,\n>(\n props: Props<RootParamList> & {\n ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n }\n) => React.ReactElement;\n\nexport default NavigationContainer;\n"]}
|
|
@@ -8,8 +8,14 @@ type Props<ParamList extends object> = NavigationContainerProps & {
|
|
|
8
8
|
documentTitle?: DocumentTitleOptions;
|
|
9
9
|
onReady?: () => void;
|
|
10
10
|
};
|
|
11
|
-
declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props:
|
|
12
|
-
|
|
11
|
+
declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: NavigationContainerProps & {
|
|
12
|
+
theme?: Theme | undefined;
|
|
13
|
+
linking?: LinkingOptions<RootParamList> | undefined;
|
|
14
|
+
fallback?: React.ReactNode;
|
|
15
|
+
documentTitle?: DocumentTitleOptions | undefined;
|
|
16
|
+
onReady?: (() => void) | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
ref?: React.Ref<NavigationContainerRef<RootParamList>> | undefined;
|
|
13
19
|
}) => React.ReactElement;
|
|
14
20
|
export default NavigationContainer;
|
|
15
21
|
//# sourceMappingURL=NavigationContainer.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.native.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,wBAAwB,EACxB,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,oBAAoB,EAEpB,cAAc,EACd,KAAK,EAEN,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAuGF,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"NavigationContainer.native.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,wBAAwB,EACxB,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,oBAAoB,EAEpB,cAAc,EACd,KAAK,EAEN,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAuGF,QAAA,MAAM,mBAAmB;;;eA1GZ,MAAM,SAAS;;qBAEV,IAAI;;;MA8GjB,MAAM,YAAY,CAAC;AAExB,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.native.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.native.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uGAAuG;AACvG,6GAA6G;AAC7G,iDASgC;AAChC,qDAOkC;AAClC,+FAAuE;AACvE,qGAA6E;AAC7E,2FAAmE;AACnE,6CAA+B;AAE/B,8DAAsC;AAEtC,MAAM,CAAC,yBAAyB,GAAG,IAAI,OAAO,EAAE,CAAC;AAUjD;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAC/B,EACE,KAAK,GAAG,qBAAY,EACpB,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,aAAa,EACb,OAAO,EACP,GAAG,IAAI,EACc,EACvB,GAA6D;IAE7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,OAAO,EAAE,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"NavigationContainer.native.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.native.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uGAAuG;AACvG,6GAA6G;AAC7G,iDASgC;AAChC,qDAOkC;AAClC,+FAAuE;AACvE,qGAA6E;AAC7E,2FAAmE;AACnE,6CAA+B;AAE/B,8DAAsC;AAEtC,MAAM,CAAC,yBAAyB,GAAG,IAAI,OAAO,EAAE,CAAC;AAUjD;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAC/B,EACE,KAAK,GAAG,qBAAY,EACpB,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,aAAa,EACb,OAAO,EACP,GAAG,IAAI,EACc,EACvB,GAA6D;IAE7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,OAAO,EAAE,MAAM,EAAE;QACnB,IAAA,yBAAkB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACpC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAwC,IAAI,CAAC,CAAC;IAE/E,IAAA,uBAAa,EAAC,YAAY,CAAC,CAAC;IAC5B,IAAA,0BAAgB,EAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAE9C,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,oBAAU,EAAC,YAAY,EAAE;QACnD,iCAAiC;QACjC,OAAO,EAAE,gBAAgB;QACzB,QAAQ,EAAE,EAAE;QACZ,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,iDAAiD;IACjD,oCAAoC;IACpC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,YAAY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E;QACZ,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,QAA8B,CAAC;KACvC;IAED,OAAO,CACL,CAAC,uBAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAC7C;MAAA,CAAC,sBAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAC1B;QAAA,CAAC,8BAAuB,CACtB,IAAI,IAAI,CAAC,CACT,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3E,GAAG,CAAC,CAAC,YAAY,CAAC,EAEtB;MAAA,EAAE,sBAAa,CACjB;IAAA,EAAE,uBAAc,CAAC,QAAQ,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,wBAAwB,CAM9C,CAAC;AAExB,kBAAe,mBAAmB,CAAC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` -> `extractPathFromURL` function.\n// https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/NavigationContainer.tsx\nimport {\n BaseNavigationContainer,\n getActionFromState,\n getPathFromState,\n getStateFromPath,\n NavigationContainerProps,\n NavigationContainerRef,\n ParamListBase,\n validatePathConfig,\n} from '@react-navigation/core';\nimport {\n DefaultTheme,\n DocumentTitleOptions,\n LinkingContext,\n LinkingOptions,\n Theme,\n ThemeProvider,\n} from '@react-navigation/native';\nimport useBackButton from '@react-navigation/native/src/useBackButton';\nimport useDocumentTitle from '@react-navigation/native/src/useDocumentTitle';\nimport useThenable from '@react-navigation/native/src/useThenable';\nimport * as React from 'react';\n\nimport useLinking from './useLinking';\n\nglobal.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends object> = NavigationContainerProps & {\n theme?: Theme;\n linking?: LinkingOptions<ParamList>;\n fallback?: React.ReactNode;\n documentTitle?: DocumentTitleOptions;\n onReady?: () => void;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.theme Theme object for the navigators.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n {\n theme = DefaultTheme,\n linking,\n fallback = null,\n documentTitle,\n onReady,\n ...rest\n }: Props<ParamListBase>,\n ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n if (linking?.config) {\n validatePathConfig(linking.config);\n }\n\n const refContainer = React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n useBackButton(refContainer);\n useDocumentTitle(refContainer, documentTitle);\n\n const { getInitialState } = useLinking(refContainer, {\n // independent: rest.independent,\n enabled: isLinkingEnabled,\n prefixes: [],\n ...linking,\n });\n\n // Add additional linking related info to the ref\n // This will be used by the devtools\n React.useEffect(() => {\n if (refContainer.current) {\n REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n get linking() {\n return {\n ...linking,\n enabled: isLinkingEnabled,\n prefixes: linking?.prefixes ?? [],\n getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n getPathFromState: linking?.getPathFromState ?? getPathFromState,\n getActionFromState: linking?.getActionFromState ?? getActionFromState,\n };\n },\n });\n }\n });\n\n const [isResolved, initialState] = useThenable(getInitialState);\n\n React.useImperativeHandle(ref, () => refContainer.current);\n\n const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n\n const onReadyRef = React.useRef(onReady);\n\n React.useEffect(() => {\n onReadyRef.current = onReady;\n });\n\n React.useEffect(() => {\n if (isReady) {\n onReadyRef.current?.();\n }\n }, [isReady]);\n\n if (!isReady) {\n // This is temporary until we have Suspense for data-fetching\n // Then the fallback will be handled by a parent `Suspense` component\n return fallback as React.ReactElement;\n }\n\n return (\n <LinkingContext.Provider value={linkingContext}>\n <ThemeProvider value={theme}>\n <BaseNavigationContainer\n {...rest}\n initialState={rest.initialState == null ? initialState : rest.initialState}\n ref={refContainer}\n />\n </ThemeProvider>\n </LinkingContext.Provider>\n );\n}\n\nconst NavigationContainer = React.forwardRef(NavigationContainerInner) as <\n RootParamList extends object = ReactNavigation.RootParamList,\n>(\n props: Props<RootParamList> & {\n ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n }\n) => React.ReactElement;\n\nexport default NavigationContainer;\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function adjustPathname(url: {
|
|
3
|
-
hostname?: string | null;
|
|
1
|
+
export declare function parsePathAndParamsFromExpoGoLink(url: string): {
|
|
4
2
|
pathname: string;
|
|
5
|
-
|
|
3
|
+
queryString: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function parsePathFromExpoGoLink(url: string): string;
|
|
6
|
+
export declare function extractExpoPathFromURL(url?: string): string;
|
|
6
7
|
//# sourceMappingURL=extractPathFromURL.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"
|
|
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;AAqFD,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAW,UAMtD"}
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.extractExpoPathFromURL =
|
|
27
|
-
|
|
28
|
-
|
|
3
|
+
exports.extractExpoPathFromURL = exports.parsePathFromExpoGoLink = exports.parsePathAndParamsFromExpoGoLink = void 0;
|
|
4
|
+
function parsePathAndParamsFromExpoGoLink(url) {
|
|
5
|
+
// If the URL is defined (default in Expo Go dev apps) and the URL has no path:
|
|
6
|
+
// `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
|
|
7
|
+
const href = parsePathFromExpoGoLink(url);
|
|
8
|
+
const results = href.match(/(.*?)(\?.*)/);
|
|
9
|
+
return {
|
|
10
|
+
pathname: results?.[1] ?? '',
|
|
11
|
+
queryString: results?.[2] ?? '',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.parsePathAndParamsFromExpoGoLink = parsePathAndParamsFromExpoGoLink;
|
|
15
|
+
function parsePathFromExpoGoLink(url) {
|
|
16
|
+
// If the URL is defined (default in Expo Go dev apps) and the URL has no path:
|
|
17
|
+
// `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
|
|
18
|
+
return url.match(/exps?:\/\/.*?\/--\/(.*)/)?.[1] ?? '';
|
|
19
|
+
}
|
|
20
|
+
exports.parsePathFromExpoGoLink = parsePathFromExpoGoLink;
|
|
29
21
|
// This is only run on native.
|
|
30
22
|
function extractExactPathFromURL(url) {
|
|
31
23
|
if (
|
|
@@ -41,17 +33,16 @@ function extractExactPathFromURL(url) {
|
|
|
41
33
|
// while not exhaustive, `exp` and `exps` are the only two schemes which
|
|
42
34
|
// are passed through to other apps in Expo Go.
|
|
43
35
|
url.match(/^exp(s)?:\/\//)) {
|
|
44
|
-
const pathname = url
|
|
36
|
+
const pathname = parsePathFromExpoGoLink(url);
|
|
45
37
|
if (pathname) {
|
|
46
38
|
return fromDeepLink('a://' + pathname);
|
|
47
39
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (adjustPathname({ hostname: res.hostname, pathname: res.path || '' }) + (qs ? '?' + qs : ''));
|
|
40
|
+
// Match the `?.*` segment of the URL.
|
|
41
|
+
const queryParams = url.match(/exps?:\/\/.*\?(.*)/)?.[1];
|
|
42
|
+
if (queryParams) {
|
|
43
|
+
return fromDeepLink('a://?' + queryParams);
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
55
46
|
}
|
|
56
47
|
// TODO: Support dev client URLs
|
|
57
48
|
return fromDeepLink(url);
|
|
@@ -94,14 +85,9 @@ function fromDeepLink(url) {
|
|
|
94
85
|
return results;
|
|
95
86
|
}
|
|
96
87
|
function extractExpoPathFromURL(url = '') {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
function adjustPathname(url) {
|
|
101
|
-
if (url.hostname === 'exp.host' || url.hostname === 'u.expo.dev') {
|
|
102
|
-
// drop the first two segments from pathname:
|
|
103
|
-
return url.pathname.split('/').slice(2).join('/');
|
|
104
|
-
}
|
|
105
|
-
return url.pathname;
|
|
88
|
+
return (extractExactPathFromURL(url)
|
|
89
|
+
// TODO: We should get rid of this, dropping specificities is not good
|
|
90
|
+
.replace(/^\//, ''));
|
|
106
91
|
}
|
|
92
|
+
exports.extractExpoPathFromURL = extractExpoPathFromURL;
|
|
107
93
|
//# sourceMappingURL=extractPathFromURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"
|
|
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,aAAa,CAAC,CAAC;IAC1C,OAAO;QACL,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;QAC5B,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CAA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AAC,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 } = new URL(url);\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;\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 return url;\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(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,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Forked so we can access without importing any React Native code in Node.js environments.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.findFocusedRoute =
|
|
4
|
+
exports.findFocusedRoute = void 0;
|
|
5
5
|
function findFocusedRoute(state) {
|
|
6
6
|
let current = state;
|
|
7
7
|
while (current?.routes[current.index ?? 0].state != null) {
|
|
@@ -10,4 +10,5 @@ function findFocusedRoute(state) {
|
|
|
10
10
|
const route = current?.routes[current?.index ?? 0];
|
|
11
11
|
return route;
|
|
12
12
|
}
|
|
13
|
+
exports.findFocusedRoute = findFocusedRoute;
|
|
13
14
|
//# sourceMappingURL=findFocusedRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findFocusedRoute.js","sourceRoot":"","sources":["../../src/fork/findFocusedRoute.tsx"],"names":[],"mappings":";AAAA,2FAA2F
|
|
1
|
+
{"version":3,"file":"findFocusedRoute.js","sourceRoot":"","sources":["../../src/fork/findFocusedRoute.tsx"],"names":[],"mappings":";AAAA,2FAA2F;;;AAI3F,SAAgB,gBAAgB,CAAC,KAAmB;IAClD,IAAI,OAAO,GAA6B,KAAK,CAAC;IAE9C,OAAO,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE;QACxD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;KACpD;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAEnD,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,4CAUC","sourcesContent":["// Forked so we can access without importing any React Native code in Node.js environments.\n\nimport type { InitialState } from '@react-navigation/routers';\n\nexport function findFocusedRoute(state: InitialState) {\n let current: InitialState | undefined = state;\n\n while (current?.routes[current.index ?? 0].state != null) {\n current = current.routes[current.index ?? 0].state;\n }\n\n const route = current?.routes[current?.index ?? 0];\n\n return route;\n}\n"]}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getPathDataFromState = getPathDataFromState;
|
|
5
|
-
exports.deepEqual = deepEqual;
|
|
6
|
-
exports.appendBaseUrl = appendBaseUrl;
|
|
3
|
+
exports.appendBaseUrl = exports.deepEqual = exports.getPathDataFromState = void 0;
|
|
7
4
|
const core_1 = require("@react-navigation/core");
|
|
8
5
|
const matchers_1 = require("../matchers");
|
|
9
6
|
const DEFAULT_SCREENS = {};
|
|
@@ -77,6 +74,7 @@ function encodeURIComponentPreservingBrackets(str) {
|
|
|
77
74
|
function getPathFromState(state, _options) {
|
|
78
75
|
return getPathDataFromState(state, _options).path;
|
|
79
76
|
}
|
|
77
|
+
exports.default = getPathFromState;
|
|
80
78
|
function getPathDataFromState(state, _options = { screens: DEFAULT_SCREENS }) {
|
|
81
79
|
if (state == null) {
|
|
82
80
|
throw Error("Got 'undefined' for the navigation state. You must pass a valid state object.");
|
|
@@ -91,6 +89,7 @@ function getPathDataFromState(state, _options = { screens: DEFAULT_SCREENS }) {
|
|
|
91
89
|
// Create a normalized configs object which will be easier to use
|
|
92
90
|
createNormalizedConfigs(options.screens), { preserveGroups, preserveDynamicRoutes });
|
|
93
91
|
}
|
|
92
|
+
exports.getPathDataFromState = getPathDataFromState;
|
|
94
93
|
function processParamsWithUserSettings(configItem, params) {
|
|
95
94
|
const stringify = configItem?.stringify;
|
|
96
95
|
return Object.fromEntries(Object.entries(params).map(([key, value]) => [
|
|
@@ -134,6 +133,7 @@ function deepEqual(a, b) {
|
|
|
134
133
|
}
|
|
135
134
|
return false;
|
|
136
135
|
}
|
|
136
|
+
exports.deepEqual = deepEqual;
|
|
137
137
|
function walkConfigItems(route, focusedRoute, configs, { preserveDynamicRoutes, }) {
|
|
138
138
|
// NOTE(EvanBacon): Fill in current route using state that was passed as params.
|
|
139
139
|
if (!route.state && isInvalidParams(route.params)) {
|
|
@@ -462,4 +462,5 @@ function appendBaseUrl(path, baseUrl = process.env.EXPO_BASE_URL) {
|
|
|
462
462
|
}
|
|
463
463
|
return path;
|
|
464
464
|
}
|
|
465
|
+
exports.appendBaseUrl = appendBaseUrl;
|
|
465
466
|
//# sourceMappingURL=getPathFromState.js.map
|