expo-router 3.4.8 → 3.5.0
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/_ctx-shared.js +4 -0
- package/babel.js +3 -1
- package/build/ExpoRoot.d.ts +2 -4
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +8 -5
- package/build/ExpoRoot.js.map +1 -1
- package/build/LocationProvider.d.ts.map +1 -1
- package/build/LocationProvider.js +11 -4
- package/build/LocationProvider.js.map +1 -1
- package/build/Route.d.ts +5 -4
- package/build/Route.d.ts.map +1 -1
- package/build/Route.js +5 -4
- package/build/Route.js.map +1 -1
- package/build/fork/NavigationContainer.d.ts +18 -1
- package/build/fork/NavigationContainer.d.ts.map +1 -1
- package/build/fork/NavigationContainer.js +107 -2
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/NavigationContainer.native.d.ts +2 -8
- package/build/fork/NavigationContainer.native.d.ts.map +1 -1
- package/build/fork/NavigationContainer.native.js.map +1 -1
- package/build/fork/extractPathFromURL.js +2 -3
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/findFocusedRoute.js +1 -2
- package/build/fork/findFocusedRoute.js.map +1 -1
- package/build/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +21 -7
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/fork/getStateFromPath.d.ts +5 -0
- package/build/fork/getStateFromPath.d.ts.map +1 -1
- package/build/fork/getStateFromPath.js +28 -19
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/useLinking.d.ts +15 -2
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js +325 -2
- 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.d.ts +3 -0
- package/build/getDevServer/index.d.ts.map +1 -1
- package/build/getDevServer/index.js +20 -1
- package/build/getDevServer/index.js.map +1 -1
- package/build/getLinkingConfig.d.ts +2 -2
- package/build/getLinkingConfig.d.ts.map +1 -1
- package/build/getLinkingConfig.js +7 -7
- package/build/getLinkingConfig.js.map +1 -1
- package/build/getReactNavigationConfig.js +2 -3
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutes.d.ts +22 -31
- package/build/getRoutes.d.ts.map +1 -1
- package/build/getRoutes.js +404 -428
- package/build/getRoutes.js.map +1 -1
- package/build/getServerManifest.d.ts +1 -4
- package/build/getServerManifest.d.ts.map +1 -1
- package/build/getServerManifest.js +43 -16
- package/build/getServerManifest.js.map +1 -1
- package/build/global-state/router-store.d.ts +7 -5
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +15 -8
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +5 -5
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +85 -37
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/serverLocationContext.d.ts +2 -0
- package/build/global-state/serverLocationContext.d.ts.map +1 -0
- package/build/global-state/serverLocationContext.js +6 -0
- package/build/global-state/serverLocationContext.js.map +1 -0
- package/build/global-state/sort-routes.js +1 -2
- package/build/global-state/sort-routes.js.map +1 -1
- package/build/head/ExpoHead.android.d.ts +2 -4
- package/build/head/ExpoHead.android.d.ts.map +1 -1
- package/build/head/ExpoHead.android.js +1 -2
- package/build/head/ExpoHead.android.js.map +1 -1
- package/build/head/ExpoHead.ios.d.ts +1 -3
- package/build/head/ExpoHead.ios.d.ts.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 +1 -2
- package/build/head/url.js.map +1 -1
- package/build/hooks.d.ts +2 -2
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +10 -11
- package/build/hooks.js.map +1 -1
- package/build/imperative-api.d.ts +2 -2
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/Drawer.d.ts +40 -41
- package/build/layouts/Drawer.d.ts.map +1 -1
- package/build/layouts/Stack.d.ts +48 -49
- package/build/layouts/Stack.d.ts.map +1 -1
- package/build/layouts/Tabs.d.ts +53 -53
- package/build/layouts/Tabs.d.ts.map +1 -1
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.js +2 -3
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts +4 -67
- 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 +2 -8
- package/build/link/href.d.ts.map +1 -1
- package/build/link/href.js +1 -1
- package/build/link/href.js.map +1 -1
- package/build/link/linking.js +6 -6
- package/build/link/linking.js.map +1 -1
- package/build/link/path.js +1 -2
- 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 +4 -2
- package/build/link/useLoadedNavigation.d.ts.map +1 -1
- package/build/link/useLoadedNavigation.js +2 -3
- package/build/link/useLoadedNavigation.js.map +1 -1
- package/build/loadStaticParamsAsync.js +2 -3
- package/build/loadStaticParamsAsync.js.map +1 -1
- package/build/matchers.d.ts +8 -0
- package/build/matchers.d.ts.map +1 -1
- package/build/matchers.js +24 -11
- package/build/matchers.js.map +1 -1
- package/build/onboard/Tutorial.d.ts +0 -1
- package/build/onboard/Tutorial.d.ts.map +1 -1
- package/build/onboard/Tutorial.js +1 -2
- package/build/onboard/Tutorial.js.map +1 -1
- package/build/onboard/createEntryFile.js +2 -3
- package/build/onboard/createEntryFile.js.map +1 -1
- package/build/primitives.d.ts +0 -1
- package/build/primitives.d.ts.map +1 -1
- package/build/qualified-entry.d.ts +0 -1
- package/build/qualified-entry.d.ts.map +1 -1
- package/build/qualified-entry.js +1 -2
- package/build/qualified-entry.js.map +1 -1
- package/build/renderRootComponent.js +1 -2
- package/build/renderRootComponent.js.map +1 -1
- package/build/routes-manifest.d.ts +1 -3
- package/build/routes-manifest.d.ts.map +1 -1
- package/build/routes-manifest.js +1 -2
- package/build/routes-manifest.js.map +1 -1
- package/build/sortRoutes.js +2 -3
- package/build/sortRoutes.js.map +1 -1
- package/build/static/getRootComponent.js +1 -2
- package/build/static/getRootComponent.js.map +1 -1
- package/build/static/html.d.ts +2 -4
- package/build/static/html.d.ts.map +1 -1
- package/build/static/html.js +2 -3
- package/build/static/html.js.map +1 -1
- package/build/static/renderStaticContent.js +2 -4
- package/build/static/renderStaticContent.js.map +1 -1
- package/build/testing-library/context-stubs.d.ts +0 -1
- 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/expect.js +3 -0
- package/build/testing-library/expect.js.map +1 -1
- package/build/testing-library/index.d.ts +31 -10
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js +53 -29
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mock-config.d.ts +15 -0
- package/build/testing-library/mock-config.d.ts.map +1 -0
- package/build/testing-library/mock-config.js +32 -0
- package/build/testing-library/mock-config.js.map +1 -0
- package/build/testing-library/mocks.js +1 -2
- package/build/testing-library/mocks.js.map +1 -1
- package/build/testing-library/require-context-ponyfill.d.ts +7 -2
- package/build/testing-library/require-context-ponyfill.d.ts.map +1 -1
- package/build/testing-library/require-context-ponyfill.js +8 -2
- package/build/testing-library/require-context-ponyfill.js.map +1 -1
- package/build/typed-routes/generate.d.ts +3 -0
- package/build/typed-routes/generate.d.ts.map +1 -0
- package/build/typed-routes/generate.js +94 -0
- package/build/typed-routes/generate.js.map +1 -0
- package/build/typed-routes/index.d.ts +12 -0
- package/build/typed-routes/index.d.ts.map +1 -0
- package/build/typed-routes/index.js +72 -0
- package/build/typed-routes/index.js.map +1 -0
- package/build/types.d.ts +0 -21
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/useDeprecated.js +2 -3
- package/build/useDeprecated.js.map +1 -1
- package/build/useFocusEffect.js +1 -2
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.js +2 -3
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.d.ts +5 -7
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +27 -26
- package/build/useScreens.js.map +1 -1
- package/build/utils/url.js +3 -4
- package/build/utils/url.js.map +1 -1
- package/build/views/EmptyRoute.d.ts +0 -1
- package/build/views/EmptyRoute.d.ts.map +1 -1
- package/build/views/EmptyRoute.js +1 -2
- package/build/views/EmptyRoute.js.map +1 -1
- package/build/views/ErrorBoundary.d.ts +0 -1
- package/build/views/ErrorBoundary.d.ts.map +1 -1
- package/build/views/ErrorBoundary.js +1 -2
- 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 +9 -7
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Pressable.d.ts.map +1 -1
- package/build/views/Screen.d.ts +1 -3
- package/build/views/Screen.d.ts.map +1 -1
- package/build/views/Screen.js +1 -2
- package/build/views/Screen.js.map +1 -1
- package/build/views/Sitemap.d.ts +0 -1
- package/build/views/Sitemap.d.ts.map +1 -1
- package/build/views/Sitemap.js +4 -3
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/SuspenseFallback.d.ts +0 -1
- package/build/views/SuspenseFallback.d.ts.map +1 -1
- package/build/views/SuspenseFallback.js +1 -2
- package/build/views/SuspenseFallback.js.map +1 -1
- package/build/views/Toast.d.ts +4 -7
- package/build/views/Toast.d.ts.map +1 -1
- package/build/views/Toast.js +3 -3
- package/build/views/Toast.js.map +1 -1
- package/build/views/Try.d.ts +4 -5
- package/build/views/Try.d.ts.map +1 -1
- package/build/views/Try.js +25 -5
- package/build/views/Try.js.map +1 -1
- package/build/views/Unmatched.d.ts +0 -1
- package/build/views/Unmatched.d.ts.map +1 -1
- package/build/views/Unmatched.js +3 -2
- package/build/views/Unmatched.js.map +1 -1
- package/package.json +6 -5
- package/server.d.ts +2 -4
- package/types/expo-router.d.ts +357 -0
- package/types/jest.d.ts +0 -11
package/_ctx-shared.js
ADDED
package/babel.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
throw new Error(
|
|
1
|
+
throw new Error(
|
|
2
|
+
'expo-router/babel is deprecated in favor of babel-preset-expo in SDK 50. To fix the issue, remove "expo-router/babel" from "plugins" in your babel.config.js file.'
|
|
3
|
+
);
|
package/build/ExpoRoot.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type PropsWithChildren, type ComponentType } from 'react';
|
|
2
2
|
import { RequireContext } from './types';
|
|
3
3
|
export type ExpoRootProps = {
|
|
4
4
|
context: RequireContext;
|
|
5
5
|
location?: URL;
|
|
6
|
-
wrapper?:
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}>;
|
|
6
|
+
wrapper?: ComponentType<PropsWithChildren>;
|
|
9
7
|
};
|
|
10
8
|
export declare function ExpoRoot({ wrapper: ParentWrapper, ...props }: ExpoRootProps): JSX.Element;
|
|
11
9
|
//# sourceMappingURL=ExpoRoot.d.ts.map
|
package/build/ExpoRoot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAOpF,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC5C,CAAC;AAgBF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,eAqBtF"}
|
package/build/ExpoRoot.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
@@ -26,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
28
|
};
|
|
28
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ExpoRoot =
|
|
30
|
+
exports.ExpoRoot = ExpoRoot;
|
|
30
31
|
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
31
32
|
const expo_status_bar_1 = require("expo-status-bar");
|
|
32
33
|
const react_1 = __importStar(require("react"));
|
|
@@ -34,6 +35,7 @@ const react_native_1 = require("react-native");
|
|
|
34
35
|
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
35
36
|
const NavigationContainer_1 = __importDefault(require("./fork/NavigationContainer"));
|
|
36
37
|
const router_store_1 = require("./global-state/router-store");
|
|
38
|
+
const serverLocationContext_1 = require("./global-state/serverLocationContext");
|
|
37
39
|
const Splash_1 = require("./views/Splash");
|
|
38
40
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
39
41
|
const INITIAL_METRICS = react_native_1.Platform.OS === 'web' || isTestEnv
|
|
@@ -63,7 +65,6 @@ function ExpoRoot({ wrapper: ParentWrapper = react_1.Fragment, ...props }) {
|
|
|
63
65
|
};
|
|
64
66
|
return <ContextNavigator {...props} wrapper={wrapper}/>;
|
|
65
67
|
}
|
|
66
|
-
exports.ExpoRoot = ExpoRoot;
|
|
67
68
|
const initialUrl = react_native_1.Platform.OS === 'web' && typeof window !== 'undefined'
|
|
68
69
|
? new URL(window.location.href)
|
|
69
70
|
: undefined;
|
|
@@ -86,9 +87,11 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
|
|
|
86
87
|
return (<NavigationContainer_1.default ref={store.navigationRef} initialState={store.initialState} linking={store.linking} onUnhandledAction={onUnhandledAction} documentTitle={{
|
|
87
88
|
enabled: false,
|
|
88
89
|
}}>
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
|
|
90
|
+
<serverLocationContext_1.ServerLocationContext.Provider value={initialLocation}>
|
|
91
|
+
<WrapperComponent>
|
|
92
|
+
<Component />
|
|
93
|
+
</WrapperComponent>
|
|
94
|
+
</serverLocationContext_1.ServerLocationContext.Provider>
|
|
92
95
|
</NavigationContainer_1.default>);
|
|
93
96
|
}
|
|
94
97
|
let onUnhandledAction;
|
package/build/ExpoRoot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCb,4BAqBC;AArDD,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,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import { 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAClF,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,SAAS,CAWX;
|
|
1
|
+
{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAClF,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,SAAS,CAWX;AA0BD,wBAAgB,sBAAsB,CACpC,EACE,IAAI,EAAE,SAAS,EACf,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb,EACD,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CA0BxC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getRouteInfoFromState = getRouteInfoFromState;
|
|
4
|
+
exports.getNormalizedStatePath = getNormalizedStatePath;
|
|
4
5
|
const getStateFromPath_1 = require("./fork/getStateFromPath");
|
|
5
6
|
function getRouteInfoFromState(getPathFromState, state, baseUrl) {
|
|
6
7
|
const { path } = getPathFromState(state, false);
|
|
@@ -13,16 +14,23 @@ function getRouteInfoFromState(getPathFromState, state, baseUrl) {
|
|
|
13
14
|
...getNormalizedStatePath(qualified, baseUrl),
|
|
14
15
|
};
|
|
15
16
|
}
|
|
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) {
|
|
20
20
|
return isIndexPath(route.state);
|
|
21
21
|
}
|
|
22
|
-
//
|
|
22
|
+
// Index routes on the same level as a layout do not have `index` in their name
|
|
23
23
|
if (route.params && 'screen' in route.params) {
|
|
24
24
|
return route.params.screen === 'index';
|
|
25
25
|
}
|
|
26
|
+
// The `params` key will not exist if there are no params
|
|
27
|
+
// So we need to do a positive lookahead to check if the route ends with /index
|
|
28
|
+
// Nested routes that are hoisted will have a name ending with /index
|
|
29
|
+
// e.g name could be /user/[id]/index
|
|
30
|
+
if (route.name.match(/.+\/index$/))
|
|
31
|
+
return true;
|
|
32
|
+
// The state will either have params (because there are multiple _layout) or it will be hoisted with a name
|
|
33
|
+
// If we don't match the above cases, then it's not an index route
|
|
26
34
|
return false;
|
|
27
35
|
}
|
|
28
36
|
// TODO: Split up getPathFromState to return all this info at once.
|
|
@@ -56,5 +64,4 @@ function getNormalizedStatePath({ path: statePath, params, }, baseUrl) {
|
|
|
56
64
|
}, {}),
|
|
57
65
|
};
|
|
58
66
|
}
|
|
59
|
-
exports.getNormalizedStatePath = getNormalizedStatePath;
|
|
60
67
|
//# 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":";;AAaA,sDAeC;AA0BD,wDAmCC;AAxFD,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;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,M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AAC,CAAC;oBAC/B,CAAC;oBAAC,MAAM,CAAC;wBACP,OAAO,CAAC,CAAC;oBACX,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC;oBACH,IAAI,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAe,CAAC,CAAC;gBAClD,CAAC;gBAAC,MAAM,CAAC;oBACP,IAAI,CAAC,GAAG,CAAC,GAAG,KAAe,CAAC;gBAC9B,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAAkB,CAAC;KACvB,CAAC;AACJ,CAAC","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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import type { ErrorBoundaryProps } from './exports';
|
|
3
3
|
import { sortRoutesWithInitial, sortRoutes } from './sortRoutes';
|
|
4
4
|
export type DynamicConvention = {
|
|
@@ -16,6 +16,8 @@ export type LoadedRoute = {
|
|
|
16
16
|
}) => Record<string, string | string[]>[];
|
|
17
17
|
};
|
|
18
18
|
export type RouteNode = {
|
|
19
|
+
/** The type of RouteNode */
|
|
20
|
+
type: 'route' | 'api' | 'layout';
|
|
19
21
|
/** Load a route into memory. Returns the exports from a route. */
|
|
20
22
|
loadRoute: () => Partial<LoadedRoute>;
|
|
21
23
|
/** Loaded initial route name. */
|
|
@@ -39,9 +41,8 @@ export type RouteNode = {
|
|
|
39
41
|
export declare function useRouteNode(): RouteNode | null;
|
|
40
42
|
export declare function useContextKey(): string;
|
|
41
43
|
/** Provides the matching routes and filename to the children. */
|
|
42
|
-
export declare function Route({ children, node }: {
|
|
43
|
-
children: ReactNode;
|
|
44
|
+
export declare function Route({ children, node }: PropsWithChildren<{
|
|
44
45
|
node: RouteNode;
|
|
45
|
-
}): JSX.Element;
|
|
46
|
+
}>): JSX.Element;
|
|
46
47
|
export { sortRoutesWithInitial, sortRoutes };
|
|
47
48
|
//# sourceMappingURL=Route.d.ts.map
|
package/build/Route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IACnC,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;KAC5C,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,4BAA4B;IAC5B,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACjC,kEAAkE;IAClE,SAAS,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB;IACpB,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,kCAAkC;IAClC,OAAO,EAAE,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACpC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oLAAoL;IACpL,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAQF,+DAA+D;AAC/D,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,iBAAiB,CAAC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,eAE/E;AAED,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,CAAC"}
|
package/build/Route.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
@@ -23,7 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
24
|
return result;
|
|
24
25
|
};
|
|
25
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.sortRoutes = exports.sortRoutesWithInitial =
|
|
27
|
+
exports.sortRoutes = exports.sortRoutesWithInitial = void 0;
|
|
28
|
+
exports.useRouteNode = useRouteNode;
|
|
29
|
+
exports.useContextKey = useContextKey;
|
|
30
|
+
exports.Route = Route;
|
|
27
31
|
const react_1 = __importStar(require("react"));
|
|
28
32
|
const matchers_1 = require("./matchers");
|
|
29
33
|
const sortRoutes_1 = require("./sortRoutes");
|
|
@@ -37,7 +41,6 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
37
41
|
function useRouteNode() {
|
|
38
42
|
return (0, react_1.useContext)(CurrentRouteContext);
|
|
39
43
|
}
|
|
40
|
-
exports.useRouteNode = useRouteNode;
|
|
41
44
|
function useContextKey() {
|
|
42
45
|
const node = useRouteNode();
|
|
43
46
|
if (node == null) {
|
|
@@ -45,10 +48,8 @@ function useContextKey() {
|
|
|
45
48
|
}
|
|
46
49
|
return (0, matchers_1.getContextKey)(node.contextKey);
|
|
47
50
|
}
|
|
48
|
-
exports.useContextKey = useContextKey;
|
|
49
51
|
/** Provides the matching routes and filename to the children. */
|
|
50
52
|
function Route({ children, node }) {
|
|
51
53
|
return <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>;
|
|
52
54
|
}
|
|
53
|
-
exports.Route = Route;
|
|
54
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":"
|
|
1
|
+
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDb,oCAEC;AAED,sCAMC;AAGD,sBAEC;AA/DD,+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,CAAC;IAC1C,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;AAChD,CAAC;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;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","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"]}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavigationContainerProps, NavigationContainerRef } from '@react-navigation/core';
|
|
2
|
+
import { DocumentTitleOptions, LinkingOptions, Theme } from '@react-navigation/native';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare global {
|
|
5
|
+
var REACT_NAVIGATION_DEVTOOLS: WeakMap<NavigationContainerRef<any>, {
|
|
6
|
+
readonly linking: LinkingOptions<any>;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
type Props<ParamList extends object> = NavigationContainerProps & {
|
|
10
|
+
theme?: Theme;
|
|
11
|
+
linking?: LinkingOptions<ParamList>;
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
documentTitle?: DocumentTitleOptions;
|
|
14
|
+
onReady?: () => void;
|
|
15
|
+
};
|
|
16
|
+
declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: Props<RootParamList> & {
|
|
17
|
+
ref?: React.Ref<NavigationContainerRef<RootParamList>>;
|
|
18
|
+
}) => React.ReactElement;
|
|
2
19
|
export default NavigationContainer;
|
|
3
20
|
//# sourceMappingURL=NavigationContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"
|
|
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,EAAiD,CACxE,aAAa,SAAS,MAAM,GAAG,eAAe,CAAC,aAAa,EAE5D,KAAK,EAAE,KAAK,CAC6B,aAAa,AAD5B,CAAC,GAAG;IAC5B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC;CACxD,KACE,KAAK,CAAC,YAAY,CAAC;AAExB,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,6 +1,111 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//
|
|
29
|
+
// Forked from React Navigation in order to use a custom `useLinking` function.
|
|
30
|
+
// https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/NavigationContainer.tsx
|
|
31
|
+
const core_1 = require("@react-navigation/core");
|
|
4
32
|
const native_1 = require("@react-navigation/native");
|
|
5
|
-
|
|
33
|
+
const useBackButton_1 = __importDefault(require("@react-navigation/native/src/useBackButton"));
|
|
34
|
+
const useDocumentTitle_1 = __importDefault(require("@react-navigation/native/src/useDocumentTitle"));
|
|
35
|
+
const useThenable_1 = __importDefault(require("@react-navigation/native/src/useThenable"));
|
|
36
|
+
const React = __importStar(require("react"));
|
|
37
|
+
const useLinking_1 = __importDefault(require("./useLinking"));
|
|
38
|
+
global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
39
|
+
/**
|
|
40
|
+
* Container component which holds the navigation state designed for React Native apps.
|
|
41
|
+
* This should be rendered at the root wrapping the whole app.
|
|
42
|
+
*
|
|
43
|
+
* @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()`).
|
|
44
|
+
* @param props.onReady Callback which is called after the navigation tree mounts.
|
|
45
|
+
* @param props.onStateChange Callback which is called with the latest navigation state when it changes.
|
|
46
|
+
* @param props.theme Theme object for the navigators.
|
|
47
|
+
* @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.
|
|
48
|
+
* @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.
|
|
49
|
+
* @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.
|
|
50
|
+
* @param props.children Child elements to render the content.
|
|
51
|
+
* @param props.ref Ref object which refers to the navigation object containing helper methods.
|
|
52
|
+
*/
|
|
53
|
+
function NavigationContainerInner({ theme = native_1.DefaultTheme, linking, fallback = null, documentTitle, onReady, ...rest }, ref) {
|
|
54
|
+
const isLinkingEnabled = linking ? linking.enabled !== false : false;
|
|
55
|
+
if (linking?.config) {
|
|
56
|
+
(0, core_1.validatePathConfig)(linking.config);
|
|
57
|
+
}
|
|
58
|
+
const refContainer = React.useRef(null);
|
|
59
|
+
(0, useBackButton_1.default)(refContainer);
|
|
60
|
+
(0, useDocumentTitle_1.default)(refContainer, documentTitle);
|
|
61
|
+
const { getInitialState } = (0, useLinking_1.default)(refContainer, {
|
|
62
|
+
independent: rest.independent,
|
|
63
|
+
enabled: isLinkingEnabled,
|
|
64
|
+
prefixes: [],
|
|
65
|
+
...linking,
|
|
66
|
+
});
|
|
67
|
+
// Add additional linking related info to the ref
|
|
68
|
+
// This will be used by the devtools
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
if (refContainer.current) {
|
|
71
|
+
REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {
|
|
72
|
+
get linking() {
|
|
73
|
+
return {
|
|
74
|
+
...linking,
|
|
75
|
+
enabled: isLinkingEnabled,
|
|
76
|
+
prefixes: linking?.prefixes ?? [],
|
|
77
|
+
getStateFromPath: linking?.getStateFromPath ?? core_1.getStateFromPath,
|
|
78
|
+
getPathFromState: linking?.getPathFromState ?? core_1.getPathFromState,
|
|
79
|
+
getActionFromState: linking?.getActionFromState ?? core_1.getActionFromState,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const [isResolved, initialState] = (0, useThenable_1.default)(getInitialState);
|
|
86
|
+
React.useImperativeHandle(ref, () => refContainer.current);
|
|
87
|
+
const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);
|
|
88
|
+
const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;
|
|
89
|
+
const onReadyRef = React.useRef(onReady);
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
onReadyRef.current = onReady;
|
|
92
|
+
});
|
|
93
|
+
React.useEffect(() => {
|
|
94
|
+
if (isReady) {
|
|
95
|
+
onReadyRef.current?.();
|
|
96
|
+
}
|
|
97
|
+
}, [isReady]);
|
|
98
|
+
if (!isReady) {
|
|
99
|
+
// This is temporary until we have Suspense for data-fetching
|
|
100
|
+
// Then the fallback will be handled by a parent `Suspense` component
|
|
101
|
+
return fallback;
|
|
102
|
+
}
|
|
103
|
+
return (<native_1.LinkingContext.Provider value={linkingContext}>
|
|
104
|
+
<native_1.ThemeProvider value={theme}>
|
|
105
|
+
<core_1.BaseNavigationContainer {...rest} initialState={rest.initialState == null ? initialState : rest.initialState} ref={refContainer}/>
|
|
106
|
+
</native_1.ThemeProvider>
|
|
107
|
+
</native_1.LinkingContext.Provider>);
|
|
108
|
+
}
|
|
109
|
+
const NavigationContainer = React.forwardRef(NavigationContainerInner);
|
|
110
|
+
exports.default = NavigationContainer;
|
|
6
111
|
//# sourceMappingURL=NavigationContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"
|
|
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,CAAC;QACpB,IAAA,yBAAkB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IA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E9E,MAAM,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,CAAC;YACZ,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,QAA8B,CAAC;IACxC,CAAC;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,14 +8,8 @@ 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
|
-
|
|
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;
|
|
11
|
+
declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: Props<RootParamList> & {
|
|
12
|
+
ref?: React.Ref<NavigationContainerRef<RootParamList>>;
|
|
19
13
|
}) => React.ReactElement;
|
|
20
14
|
export default NavigationContainer;
|
|
21
15
|
//# 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,EAAiD,CACxE,aAAa,SAAS,MAAM,GAAG,eAAe,CAAC,aAAa,EAE5D,KAAK,EAAE,KAAK,CAC6B,aAAa,AAD5B,CAAC,GAAG;IAC5B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC;CACxD,KACE,KAAK,CAAC,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,CAAC;QACpB,IAAA,yBAAkB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;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,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CAAC,OAAO,GAAG,OAAO,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO,EAAE,CAAC;YACZ,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,QAA8B,CAAC;IACxC,CAAC;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"]}
|
|
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.extractExpoPathFromURL = extractExpoPathFromURL;
|
|
27
|
+
exports.adjustPathname = adjustPathname;
|
|
27
28
|
const Linking = __importStar(require("expo-linking"));
|
|
28
29
|
// This is only run on native.
|
|
29
30
|
function extractExactPathFromURL(url) {
|
|
@@ -96,7 +97,6 @@ function extractExpoPathFromURL(url = '') {
|
|
|
96
97
|
// TODO: We should get rid of this, dropping specificities is not good
|
|
97
98
|
return extractExactPathFromURL(url).replace(/^\//, '');
|
|
98
99
|
}
|
|
99
|
-
exports.extractExpoPathFromURL = extractExpoPathFromURL;
|
|
100
100
|
function adjustPathname(url) {
|
|
101
101
|
if (url.hostname === 'exp.host' || url.hostname === 'u.expo.dev') {
|
|
102
102
|
// drop the first two segments from pathname:
|
|
@@ -104,5 +104,4 @@ function adjustPathname(url) {
|
|
|
104
104
|
}
|
|
105
105
|
return url.pathname;
|
|
106
106
|
}
|
|
107
|
-
exports.adjustPathname = adjustPathname;
|
|
108
107
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,wDAGC;AAED,wCAMC;AApGD,sDAAwC;AAExC,8BAA8B;AAC9B,SAAS,uBAAuB,CAAC,GAAW;IAC1C;IACE,2EAA2E;IAC3E,4CAA4C;IAC5C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,EACzB,CAAC;QACD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC;IAEjF,oEAAoE;IACpE,IACE,QAAQ;QACR,wEAAwE;QACxE,+CAA+C;QAC/C,GAAG,CAAC,KAAK,CAAC,e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CAAC;QACjE,6CAA6C;QAC7C,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC;AACtB,CAAC","sourcesContent":["import * as Linking from 'expo-linking';\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 = url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1];\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n\n const res = Linking.parse(url);\n\n const qs = !res.queryParams\n ? ''\n : Object.entries(res.queryParams)\n .map(([k, v]) => `${k}=${v}`)\n .join('&');\n return (\n adjustPathname({ hostname: res.hostname, pathname: res.path || '' }) + (qs ? '?' + qs : '')\n );\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 // TODO: We should get rid of this, dropping specificities is not good\n return extractExactPathFromURL(url).replace(/^\\//, '');\n}\n\nexport function adjustPathname(url: { hostname?: string | null; pathname: string }) {\n if (url.hostname === 'exp.host' || url.hostname === 'u.expo.dev') {\n // drop the first two segments from pathname:\n return url.pathname.split('/').slice(2).join('/');\n }\n return url.pathname;\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 = findFocusedRoute;
|
|
5
5
|
function findFocusedRoute(state) {
|
|
6
6
|
let current = state;
|
|
7
7
|
while (current?.routes[current.index ?? 0].state != null) {
|
|
@@ -10,5 +10,4 @@ function findFocusedRoute(state) {
|
|
|
10
10
|
const route = current?.routes[current?.index ?? 0];
|
|
11
11
|
return route;
|
|
12
12
|
}
|
|
13
|
-
exports.findFocusedRoute = findFocusedRoute;
|
|
14
13
|
//# 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,4CAUC;AAVD,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,CAAC;QACzD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACrD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAEnD,OAAO,KAAK,CAAC;AACf,CAAC","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"]}
|