expo-router 5.2.0-canary-20250729-d8899ae → 6.0.0-beta.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.android.js +1 -1
- package/_ctx.ios.js +1 -1
- package/_ctx.web.js +1 -1
- package/assets/modal.module.css +12 -3
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +12 -2
- package/build/ExpoRoot.js.map +1 -1
- package/build/Route.d.ts +9 -0
- package/build/Route.d.ts.map +1 -1
- package/build/Route.js.map +1 -1
- package/build/constants.d.ts +2 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +3 -1
- package/build/constants.js.map +1 -1
- package/build/doctor/index.d.ts +1 -1
- package/build/doctor/index.d.ts.map +1 -1
- package/build/doctor/index.js +4 -1
- package/build/doctor/index.js.map +1 -1
- package/build/exports.d.ts +2 -2
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +6 -6
- package/build/exports.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts +2 -2
- package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +82 -2
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/fork/useLinking.js +2 -2
- package/build/fork/useLinking.js.map +1 -1
- package/build/getLinkingConfig.d.ts +29 -2
- package/build/getLinkingConfig.d.ts.map +1 -1
- package/build/getLinkingConfig.js +35 -4
- package/build/getLinkingConfig.js.map +1 -1
- package/build/getRoutesCore.d.ts +1 -0
- package/build/getRoutesCore.d.ts.map +1 -1
- package/build/getRoutesCore.js +60 -0
- package/build/getRoutesCore.js.map +1 -1
- package/build/getServerManifest.d.ts +20 -1
- package/build/getServerManifest.d.ts.map +1 -1
- package/build/getServerManifest.js +8 -1
- package/build/getServerManifest.js.map +1 -1
- package/build/global-state/routeInfo.d.ts.map +1 -1
- package/build/global-state/routeInfo.js +12 -1
- package/build/global-state/routeInfo.js.map +1 -1
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +4 -0
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +29 -1
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +78 -42
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/utils.d.ts +4 -0
- package/build/global-state/utils.d.ts.map +1 -0
- package/build/global-state/utils.js +29 -0
- package/build/global-state/utils.js.map +1 -0
- package/build/hooks.d.ts +1 -1
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +9 -4
- package/build/hooks.js.map +1 -1
- package/build/layouts/DrawerClient.d.ts +2 -2
- package/build/layouts/Stack.web.d.ts +1 -1
- package/build/layouts/Stack.web.d.ts.map +1 -1
- package/build/layouts/Stack.web.js +3 -3
- package/build/layouts/Stack.web.js.map +1 -1
- package/build/layouts/StackClient.d.ts +2 -2
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +18 -14
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/TabsClient.d.ts +3 -3
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +13 -0
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +3 -2
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/InternalLinkPreviewContext.d.ts +6 -0
- package/build/link/InternalLinkPreviewContext.d.ts.map +1 -0
- package/build/link/InternalLinkPreviewContext.js +6 -0
- package/build/link/InternalLinkPreviewContext.js.map +1 -0
- package/build/link/Link.d.ts +2 -67
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +5 -70
- package/build/link/Link.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts +1 -46
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +30 -114
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +174 -0
- package/build/link/elements.d.ts.map +1 -0
- package/build/link/elements.js +172 -0
- package/build/link/elements.js.map +1 -0
- package/build/link/preview/HrefPreview.d.ts +1 -1
- package/build/link/preview/HrefPreview.d.ts.map +1 -1
- package/build/link/preview/HrefPreview.js +61 -7
- package/build/link/preview/HrefPreview.js.map +1 -1
- package/build/link/preview/LinkPreviewContext.d.ts +3 -2
- package/build/link/preview/LinkPreviewContext.d.ts.map +1 -1
- package/build/link/preview/LinkPreviewContext.js +3 -2
- package/build/link/preview/LinkPreviewContext.js.map +1 -1
- package/build/link/preview/native.d.ts +14 -6
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js.map +1 -1
- package/build/link/preview/useNextScreenId.d.ts +8 -1
- package/build/link/preview/useNextScreenId.d.ts.map +1 -1
- package/build/link/preview/useNextScreenId.js +36 -32
- package/build/link/preview/useNextScreenId.js.map +1 -1
- package/build/link/preview/utils.d.ts +12 -0
- package/build/link/preview/utils.d.ts.map +1 -0
- package/build/link/preview/utils.js +66 -0
- package/build/link/preview/utils.js.map +1 -0
- package/build/modal/Modal.js +1 -1
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/ModalsRenderer.js +1 -1
- package/build/modal/ModalsRenderer.js.map +1 -1
- package/build/modal/ModalsRenderer.web.js +4 -4
- package/build/modal/ModalsRenderer.web.js.map +1 -1
- package/build/modal/web/{ModalStack.web.d.ts → ModalStack.d.ts} +1 -1
- package/build/modal/web/ModalStack.d.ts.map +1 -0
- package/build/modal/web/{ModalStack.web.js → ModalStack.js} +5 -5
- package/build/modal/web/ModalStack.js.map +1 -0
- package/build/modal/web/{ModalStackRouteDrawer.web.d.ts → ModalStackRouteDrawer.d.ts} +1 -1
- package/build/modal/web/ModalStackRouteDrawer.d.ts.map +1 -0
- package/build/modal/web/{ModalStackRouteDrawer.web.js → ModalStackRouteDrawer.js} +1 -2
- package/build/modal/web/ModalStackRouteDrawer.js.map +1 -0
- package/build/modal/web/{TransparentModalStackRouteDrawer.web.d.ts → TransparentModalStackRouteDrawer.d.ts} +1 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.d.ts.map +1 -0
- package/build/modal/web/{TransparentModalStackRouteDrawer.web.js → TransparentModalStackRouteDrawer.js} +1 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +17 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +27 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts +3 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +65 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts +47 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +153 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +24 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabs.js +27 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +4 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +116 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/types.d.ts +166 -0
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/types.js +3 -0
- package/build/native-tabs/NativeBottomTabs/types.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/utils.d.ts +7 -0
- package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/utils.js +21 -0
- package/build/native-tabs/NativeBottomTabs/utils.js.map +1 -0
- package/build/native-tabs/common/elements.d.ts +74 -0
- package/build/native-tabs/common/elements.d.ts.map +1 -0
- package/build/native-tabs/common/elements.js +21 -0
- package/build/native-tabs/common/elements.js.map +1 -0
- package/build/native-tabs/index.d.ts +5 -0
- package/build/native-tabs/index.d.ts.map +1 -0
- package/build/native-tabs/index.js +23 -0
- package/build/native-tabs/index.js.map +1 -0
- package/build/routes-manifest.d.ts +42 -0
- package/build/routes-manifest.d.ts.map +1 -1
- package/build/routes-manifest.js.map +1 -1
- package/build/rsc/middleware.d.ts +1 -1
- package/build/rsc/middleware.d.ts.map +1 -1
- package/build/rsc/middleware.js.map +1 -1
- package/build/testing-library/mock-config.d.ts +18 -0
- package/build/testing-library/mock-config.d.ts.map +1 -1
- package/build/testing-library/mock-config.js +4 -1
- package/build/testing-library/mock-config.js.map +1 -1
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js +7 -6
- package/build/ui/common.js.map +1 -1
- package/build/useNavigation.d.ts.map +1 -1
- package/build/useNavigation.js +8 -5
- package/build/useNavigation.js.map +1 -1
- package/build/views/NoSSR.d.ts +5 -0
- package/build/views/NoSSR.d.ts.map +1 -0
- package/build/views/NoSSR.js +22 -0
- package/build/views/NoSSR.js.map +1 -0
- package/build/views/Screen.d.ts.map +1 -1
- package/build/views/Screen.js +4 -1
- package/build/views/Screen.js.map +1 -1
- package/build/views/Sitemap.d.ts.map +1 -1
- package/build/views/Sitemap.js +113 -10
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/Unmatched.d.ts.map +1 -1
- package/build/views/Unmatched.js +14 -4
- package/build/views/Unmatched.js.map +1 -1
- package/ios/ExpoHead.podspec +10 -1
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +159 -21
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +44 -6
- package/ios/LinkPreview/LinkPreviewNativeNavigation.h +37 -11
- package/ios/LinkPreview/LinkPreviewNativeNavigation.mm +110 -87
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +136 -0
- package/ios/LinkPreview/LinkPreviewNativePreviewView.swift +0 -1
- package/ios/LinkPreview/LinkPreviewNativeTriggerView.swift +1 -1
- package/ios/LinkPreview/LinkPreviewNativeView.swift +72 -71
- package/package.json +42 -10
- package/plugin/build/index.d.ts +2 -0
- package/plugin/options.json +5 -0
- package/plugin/src/index.ts +2 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/server.d.ts +2 -1
- package/unstable-native-tabs.d.ts +1 -0
- package/unstable-native-tabs.js +1 -0
- package/build/modal/web/ModalStack.web.d.ts.map +0 -1
- package/build/modal/web/ModalStack.web.js.map +0 -1
- package/build/modal/web/ModalStackRouteDrawer.web.d.ts.map +0 -1
- package/build/modal/web/ModalStackRouteDrawer.web.js.map +0 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.web.d.ts.map +0 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.web.js.map +0 -1
package/_ctx.android.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ctx = require.context(
|
|
2
2
|
process.env.EXPO_ROUTER_APP_ROOT,
|
|
3
3
|
true,
|
|
4
|
-
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+html)))\.[tj]sx?$).*(?:\.ios|\.web)?\.[tj]sx?$/,
|
|
4
|
+
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+html)|(?:\+middleware)))\.[tj]sx?$).*(?:\.ios|\.web)?\.[tj]sx?$/,
|
|
5
5
|
process.env.EXPO_ROUTER_IMPORT_MODE
|
|
6
6
|
);
|
package/_ctx.ios.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ctx = require.context(
|
|
2
2
|
process.env.EXPO_ROUTER_APP_ROOT,
|
|
3
3
|
true,
|
|
4
|
-
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+html)))\.[tj]sx?$).*(?:\.android|\.web)?\.[tj]sx?$/,
|
|
4
|
+
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+html)|(?:\+middleware)))\.[tj]sx?$).*(?:\.android|\.web)?\.[tj]sx?$/,
|
|
5
5
|
process.env.EXPO_ROUTER_IMPORT_MODE
|
|
6
6
|
);
|
package/_ctx.web.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ctx = require.context(
|
|
2
2
|
process.env.EXPO_ROUTER_APP_ROOT,
|
|
3
3
|
true,
|
|
4
|
-
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+(html|native-intent))))\.[tj]sx?$).*(?:\.android|\.ios|\.native)?\.[tj]sx?$/,
|
|
4
|
+
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+middleware)|(?:\+(html|native-intent))))\.[tj]sx?$).*(?:\.android|\.ios|\.native)?\.[tj]sx?$/,
|
|
5
5
|
process.env.EXPO_ROUTER_IMPORT_MODE
|
|
6
6
|
);
|
package/assets/modal.module.css
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
border: var(--expo-router-modal-border, 1px solid rgba(61.2, 61.2, 66, 0.29));
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
overflow: auto;
|
|
9
|
+
will-change: transform;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.overlay {
|
|
@@ -27,8 +28,11 @@
|
|
|
27
28
|
max-height: min(var(--expo-router-modal-height, 640px), calc(100dvh - 2rem));
|
|
28
29
|
/* Ensure modal retains a reasonable minimum but never bigger than viewport */
|
|
29
30
|
min-height: min(var(--expo-router-modal-min-height, var(--expo-router-modal-height, 640px)), calc(100dvh - 2rem));
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
/*
|
|
32
|
+
It is super expensive to calculate the shadow with box-shadow, so we have to use filter instead.
|
|
33
|
+
Do not change this to box-shadow. Box-shadow caused an INP of 600ms on the modal.
|
|
34
|
+
*/
|
|
35
|
+
filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1));
|
|
32
36
|
overflow: auto;
|
|
33
37
|
outline: none;
|
|
34
38
|
}
|
|
@@ -92,6 +96,7 @@ body>.transparentDrawerContent {
|
|
|
92
96
|
position: relative;
|
|
93
97
|
transform: none;
|
|
94
98
|
box-shadow: none;
|
|
99
|
+
filter: none;
|
|
95
100
|
border-radius: inherit;
|
|
96
101
|
min-height: auto;
|
|
97
102
|
max-height: none;
|
|
@@ -116,7 +121,11 @@ body>.transparentDrawerContent {
|
|
|
116
121
|
min-width: var(--expo-router-modal-min-width, auto);
|
|
117
122
|
max-width: var(--expo-router-modal-max-width, 90vw);
|
|
118
123
|
margin: 0;
|
|
119
|
-
|
|
124
|
+
/*
|
|
125
|
+
It is super expensive to calculate the shadow with box-shadow, so we have to use filter instead.
|
|
126
|
+
Do not change this to box-shadow. Box-shadow caused an INP of 600ms on the modal.
|
|
127
|
+
*/
|
|
128
|
+
filter: drop-shadow(0px 25px 50px rgba(0, 0, 0, 0.3));
|
|
120
129
|
border-radius: var(--expo-router-modal-border-radius, 10px);
|
|
121
130
|
}
|
|
122
131
|
|
package/build/ExpoRoot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAO7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAO7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AASxD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAMzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtE,CAAC;AAgBF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAuBtF"}
|
package/build/ExpoRoot.js
CHANGED
|
@@ -45,12 +45,15 @@ const NavigationContainer_1 = require("./fork/NavigationContainer");
|
|
|
45
45
|
const router_store_1 = require("./global-state/router-store");
|
|
46
46
|
const serverLocationContext_1 = require("./global-state/serverLocationContext");
|
|
47
47
|
const storeContext_1 = require("./global-state/storeContext");
|
|
48
|
+
const utils_1 = require("./global-state/utils");
|
|
48
49
|
const imperative_api_1 = require("./imperative-api");
|
|
49
50
|
const LinkPreviewContext_1 = require("./link/preview/LinkPreviewContext");
|
|
50
51
|
const ModalContext_1 = require("./modal/ModalContext");
|
|
51
52
|
const primitives_1 = require("./primitives");
|
|
52
53
|
const statusbar_1 = require("./utils/statusbar");
|
|
54
|
+
const Sitemap_1 = require("./views/Sitemap");
|
|
53
55
|
const SplashScreen = __importStar(require("./views/Splash"));
|
|
56
|
+
const Unmatched_1 = require("./views/Unmatched");
|
|
54
57
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
55
58
|
const INITIAL_METRICS = react_native_1.Platform.OS === 'web' || isTestEnv
|
|
56
59
|
? {
|
|
@@ -153,11 +156,18 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
|
|
|
153
156
|
</storeContext_1.StoreContext.Provider>);
|
|
154
157
|
}
|
|
155
158
|
function Content() {
|
|
159
|
+
const children = [<primitives_1.Screen name={constants_1.INTERNAL_SLOT_NAME} component={router_store_1.store.rootComponent}/>];
|
|
160
|
+
if ((0, utils_1.shouldAppendNotFound)()) {
|
|
161
|
+
children.push(<primitives_1.Screen name={constants_1.NOT_FOUND_ROUTE_NAME} component={Unmatched_1.Unmatched}/>);
|
|
162
|
+
}
|
|
163
|
+
if ((0, utils_1.shouldAppendSitemap)()) {
|
|
164
|
+
children.push(<primitives_1.Screen name={constants_1.SITEMAP_ROUTE_NAME} component={Sitemap_1.Sitemap}/>);
|
|
165
|
+
}
|
|
156
166
|
const { state, descriptors, NavigationContent } = (0, native_1.useNavigationBuilder)(native_1.StackRouter, {
|
|
157
|
-
children
|
|
167
|
+
children,
|
|
158
168
|
id: constants_1.INTERNAL_SLOT_NAME,
|
|
159
169
|
});
|
|
160
|
-
return <NavigationContent>{descriptors[state.routes[
|
|
170
|
+
return (<NavigationContent>{descriptors[state.routes[state.index].key].render()}</NavigationContent>);
|
|
161
171
|
}
|
|
162
172
|
let onUnhandledAction;
|
|
163
173
|
if (process.env.NODE_ENV !== 'production') {
|
package/build/ExpoRoot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.js","sourceRoot":"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,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAChE,oCAAoC,CAAC;QAErC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;oBAClB,OAAO,IAAI,kCAAkC,OAAO,CAAC,IAAI,IAAI,CAAC;gBAChE,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,gFAAgF,CAAC;gBAC9F,CAAC;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;QACV,CAAC;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,iBAAiB,GAAG,cAAa,CAAC,CAAC;AACrC,CAAC","sourcesContent":["'use client';\n\nimport {\n LinkingOptions,\n NavigationAction,\n StackRouter,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { INTERNAL_SLOT_NAME } from './constants';\nimport { useDomComponentNavigation } from './domComponents/useDomComponentNavigation';\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { store, useStore } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { StoreContext } from './global-state/storeContext';\nimport { ImperativeApiEmitter } from './imperative-api';\nimport { LinkPreviewContextProvider } from './link/preview/LinkPreviewContext';\nimport { ModalContextProvider } from './modal/ModalContext';\nimport { Screen } from './primitives';\nimport { RequireContext } from './types';\nimport { canOverrideStatusBarBehavior } from './utils/statusbar';\nimport * as SplashScreen from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst documentTitle = {\n enabled: false,\n};\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <LinkPreviewContextProvider>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {canOverrideStatusBarBehavior && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </LinkPreviewContextProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useStore(context, linking, serverUrl);\n\n useDomComponentNavigation();\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 return (\n <StoreContext.Provider value={store}>\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.state}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={documentTitle}\n onReady={store.onReady}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <ModalContextProvider>\n <ImperativeApiEmitter />\n <Content />\n </ModalContextProvider>\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n </StoreContext.Provider>\n );\n}\n\nfunction Content() {\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children: <Screen name={INTERNAL_SLOT_NAME} component={store.rootComponent} />,\n id: INTERNAL_SLOT_NAME,\n });\n\n return <NavigationContent>{descriptors[state.routes[0].key].render()}</NavigationContent>;\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Db,4BAuBC;AAlFD,qDAKkC;AAClC,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,2CAA2F;AAC3F,yFAAsF;AACtF,oEAAgG;AAEhG,8DAA8D;AAC9D,gFAAwF;AACxF,8DAA2D;AAC3D,gDAAiF;AACjF,qDAAwD;AACx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AY,EAAE,CAAC;IAC1C,iBAAiB,GAAG,CAAC,MAAwB,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAoC,MAAM,CAAC,OAAO,CAAC;QAEhE,IAAI,OAAO,GAAG,eAAe,MAAM,CAAC,IAAI,IACtC,OAAO,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAChE,oCAAoC,CAAC;QAErC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;oBAClB,OAAO,IAAI,kCAAkC,OAAO,CAAC,IAAI,IAAI,CAAC;gBAChE,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,gFAAgF,CAAC;gBAC9F,CAAC;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;QACV,CAAC;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,iBAAiB,GAAG,cAAa,CAAC,CAAC;AACrC,CAAC","sourcesContent":["'use client';\n\nimport {\n LinkingOptions,\n NavigationAction,\n StackRouter,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from './constants';\nimport { useDomComponentNavigation } from './domComponents/useDomComponentNavigation';\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { store, useStore } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { StoreContext } from './global-state/storeContext';\nimport { shouldAppendNotFound, shouldAppendSitemap } from './global-state/utils';\nimport { ImperativeApiEmitter } from './imperative-api';\nimport { LinkPreviewContextProvider } from './link/preview/LinkPreviewContext';\nimport { ModalContextProvider } from './modal/ModalContext';\nimport { Screen } from './primitives';\nimport { RequireContext } from './types';\nimport { canOverrideStatusBarBehavior } from './utils/statusbar';\nimport { Sitemap } from './views/Sitemap';\nimport * as SplashScreen from './views/Splash';\nimport { Unmatched } from './views/Unmatched';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst documentTitle = {\n enabled: false,\n};\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <LinkPreviewContextProvider>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {canOverrideStatusBarBehavior && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </LinkPreviewContextProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useStore(context, linking, serverUrl);\n\n useDomComponentNavigation();\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 return (\n <StoreContext.Provider value={store}>\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.state}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={documentTitle}\n onReady={store.onReady}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <ModalContextProvider>\n <ImperativeApiEmitter />\n <Content />\n </ModalContextProvider>\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n </StoreContext.Provider>\n );\n}\n\nfunction Content() {\n const children = [<Screen name={INTERNAL_SLOT_NAME} component={store.rootComponent} />];\n if (shouldAppendNotFound()) {\n children.push(<Screen name={NOT_FOUND_ROUTE_NAME} component={Unmatched} />);\n }\n if (shouldAppendSitemap()) {\n children.push(<Screen name={SITEMAP_ROUTE_NAME} component={Sitemap} />);\n }\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children,\n id: INTERNAL_SLOT_NAME,\n });\n\n return (\n <NavigationContent>{descriptors[state.routes[state.index].key].render()}</NavigationContent>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
|
package/build/Route.d.ts
CHANGED
|
@@ -15,6 +15,13 @@ export type LoadedRoute = {
|
|
|
15
15
|
params?: Record<string, string | string[]>;
|
|
16
16
|
}) => Record<string, string | string[]>[];
|
|
17
17
|
};
|
|
18
|
+
export type LoadedMiddleware = Pick<LoadedRoute, 'default' | 'unstable_settings'>;
|
|
19
|
+
export type MiddlewareNode = {
|
|
20
|
+
/** Context Module ID. Used to resolve the middleware module */
|
|
21
|
+
contextKey: string;
|
|
22
|
+
/** Loads middleware into memory. Returns the exports from +middleware.ts */
|
|
23
|
+
loadRoute: () => Partial<LoadedMiddleware>;
|
|
24
|
+
};
|
|
18
25
|
export type RouteNode = {
|
|
19
26
|
/** The type of RouteNode */
|
|
20
27
|
type: 'route' | 'api' | 'layout' | 'redirect' | 'rewrite';
|
|
@@ -42,6 +49,8 @@ export type RouteNode = {
|
|
|
42
49
|
entryPoints?: string[];
|
|
43
50
|
/** HTTP methods for this route. If undefined, assumed to be ['GET'] */
|
|
44
51
|
methods?: string[];
|
|
52
|
+
/** Middleware function for server-side request processing. Only present on the root route node. */
|
|
53
|
+
middleware?: MiddlewareNode;
|
|
45
54
|
};
|
|
46
55
|
export declare const LocalRouteParamsContext: import("react").Context<Record<string, string | undefined> | undefined>;
|
|
47
56
|
/** Return the RouteNode at the current contextual boundary. */
|
package/build/Route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC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AC;IAChB,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;KAAE,CAAC;CACxD,CAAC,CAAC;AAEH,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,UAAU,+BAM1D;AAED,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,CAAC"}
|
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;;;AAsEb,oCAEC;AAED,sCAMC;AAQD,sBAMC;AA5FD,iCAAuF;AAEvF,yCAA2C;AAC3C,6CAAiE;AA2FxD,sGA3FA,kCAAqB,OA2FA;AAAE,2FA3FA,uBAAU,OA2FA;AApC1C,MAAM,mBAAmB,GAAG,IAAA,qBAAa,EAAmB,IAAI,CAAC,CAAC;AACrD,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAElD,EAAE,CAAC,CAAC;AAEN,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,WAAG,EAAC,mBAAmB,CAAC,CAAC;AAClC,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;AAOD,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAc;IACzD,OAAO,CACL,CAAC,+BAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CACrD;MAAA,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CACrF;IAAA,EAAE,+BAAuB,CAAC,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { createContext, use, type ComponentType, type PropsWithChildren } from 'react';\n\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\nimport { type ErrorBoundaryProps } from './views/Try';\n\nexport type DynamicConvention = { name: string; deep: boolean; notFound?: boolean };\n\nexport type LoadedRoute = {\n ErrorBoundary?: ComponentType<ErrorBoundaryProps>;\n default?: 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 LoadedMiddleware = Pick<LoadedRoute, 'default' | 'unstable_settings'>;\n\nexport type MiddlewareNode = {\n /** Context Module ID. Used to resolve the middleware module */\n contextKey: string;\n /** Loads middleware into memory. Returns the exports from +middleware.ts */\n loadRoute: () => Partial<LoadedMiddleware>;\n};\n\nexport type RouteNode = {\n /** The type of RouteNode */\n type: 'route' | 'api' | 'layout' | 'redirect' | 'rewrite';\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 /** Redirect Context Module ID, used for matching children. */\n destinationContextKey?: string;\n /** Is the redirect permanent. */\n permanent?: boolean;\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 /** HTTP methods for this route. If undefined, assumed to be ['GET'] */\n methods?: string[];\n /** Middleware function for server-side request processing. Only present on the root route node. */\n middleware?: MiddlewareNode;\n};\n\nconst CurrentRouteContext = createContext<RouteNode | null>(null);\nexport const LocalRouteParamsContext = createContext<\n Record<string, string | undefined> | undefined\n>({});\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 use(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\nexport type RouteProps = PropsWithChildren<{\n node: RouteNode;\n route?: { params: Record<string, string | undefined> };\n}>;\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({ children, node, route }: RouteProps) {\n return (\n <LocalRouteParamsContext.Provider value={route?.params}>\n <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>\n </LocalRouteParamsContext.Provider>\n );\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
|
package/build/constants.d.ts
CHANGED
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,kBAAkB,aAAa,CAAC"}
|
package/build/constants.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INTERNAL_SLOT_NAME = void 0;
|
|
3
|
+
exports.SITEMAP_ROUTE_NAME = exports.NOT_FOUND_ROUTE_NAME = exports.INTERNAL_SLOT_NAME = void 0;
|
|
4
4
|
exports.INTERNAL_SLOT_NAME = '__root';
|
|
5
|
+
exports.NOT_FOUND_ROUTE_NAME = '+not-found';
|
|
6
|
+
exports.SITEMAP_ROUTE_NAME = '_sitemap';
|
|
5
7
|
//# sourceMappingURL=constants.js.map
|
package/build/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["export const INTERNAL_SLOT_NAME = '__root';\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,oBAAoB,GAAG,YAAY,CAAC;AACpC,QAAA,kBAAkB,GAAG,UAAU,CAAC","sourcesContent":["export const INTERNAL_SLOT_NAME = '__root';\nexport const NOT_FOUND_ROUTE_NAME = '+not-found';\nexport const SITEMAP_ROUTE_NAME = '_sitemap';\n"]}
|
package/build/doctor/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type IncorrectDependency = {
|
|
|
5
5
|
expectedVersionOrRange: string;
|
|
6
6
|
actualVersion: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function doctor(pkg: PackageJSONConfig, appReactNavigationPath: string, { bold, learnMore, }: {
|
|
8
|
+
export declare function doctor(pkg: PackageJSONConfig, appReactNavigationPath: string | undefined, { bold, learnMore, }: {
|
|
9
9
|
bold: (text: string) => string;
|
|
10
10
|
learnMore: (url: string, options?: {
|
|
11
11
|
learnMoreMessage?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/doctor/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgBrD,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,cAAc,GAAG,iBAAiB,CAAC;IAChD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,MAAM,CACpB,GAAG,EAAE,iBAAiB,EACtB,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/doctor/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgBrD,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,cAAc,GAAG,iBAAiB,CAAC;IAChD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,MAAM,CACpB,GAAG,EAAE,iBAAiB,EACtB,sBAAsB,EAAE,MAAM,GAAG,SAAS,EAE1C,EACE,IAAI,EACJ,SAAS,GACV,EAAE;IACD,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,MAAM,CAAC;CAC5F,GACA,mBAAmB,EAAE,CA4DvB"}
|
package/build/doctor/index.js
CHANGED
|
@@ -30,7 +30,10 @@ function doctor(pkg, appReactNavigationPath,
|
|
|
30
30
|
* when the versions must not have matched and the package manager installed a nested node_module folder with a different
|
|
31
31
|
* version of @react-navigation/native.
|
|
32
32
|
*/
|
|
33
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
// NOTE(@kitten): This looks inverted. However, this check will soon be redundant
|
|
35
|
+
userExcluded.has('@react-navigation/native') &&
|
|
36
|
+
appReactNavigationPath &&
|
|
34
37
|
appReactNavigationPath !== libReactNavigationPath) {
|
|
35
38
|
console.warn(`Detected multiple versions of ${bold('@react-navigation/native')} in your ${bold('node_modules')}. This may lead to unexpected navigation behavior and errors. ${learnMore('https://expo.fyi/router-navigation-deps')}.`);
|
|
36
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/doctor/index.ts"],"names":[],"mappings":";;;;;AAwBA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/doctor/index.ts"],"names":[],"mappings":";;;;;AAwBA,wBAuEC;AA/FD,kDAAgC;AAEhC,kEAAqD;AAErD,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,oBAAoB,CAAC,CAAC;AAEhD;;;;GAIG;AACH,MAAM,SAAS,GAAsB,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEnE,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CACvC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,gBAAgB,CAAC,CACtE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;AASlF,SAAgB,MAAM,CACpB,GAAsB,EACtB,sBAA0C;AAC1C,+CAA+C;AAC/C,EACE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C;YACzB,WAAW,EAAE,GAAG;YAChB,WAAW,EAAE,GAAG,CAAC,YAAY,IAAI,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB;YAC7F,sBAAsB,EAAE,YAAY;YACpC,aAAa,EAAE,UAAU;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["import createDebug from 'debug';\nimport type { PackageJSONConfig } from 'expo/config';\nimport semverRangeSubset from 'semver/ranges/subset';\n\nconst debug = createDebug('expo:router:doctor');\n\n/**\n * Small hack to get the package.json.\n * We do no use import() as this would require changing the rootDir in `tsconfig.json`,\n * which in turn will change the structure of the outDir.\n */\nconst routerPkg: PackageJSONConfig = require('../../package.json');\n\nconst routerDependencies = Object.entries<string>(\n Object.assign({}, routerPkg.dependencies, routerPkg.peerDependencies)\n).filter((entry) => entry[0].startsWith('@react-navigation') && entry[1] !== '*');\n\ntype IncorrectDependency = {\n packageName: string;\n packageType: 'dependencies' | 'devDependencies';\n expectedVersionOrRange: string;\n actualVersion: string;\n};\n\nexport function doctor(\n pkg: PackageJSONConfig,\n appReactNavigationPath: string | undefined,\n // Reuse the formatting functions from expo-cli\n {\n bold,\n learnMore,\n }: {\n bold: (text: string) => string;\n learnMore: (url: string, options?: { learnMoreMessage?: string; dim?: boolean }) => string;\n }\n): IncorrectDependency[] {\n const resolvedDependencies = { ...pkg.dependencies, ...pkg.devDependencies };\n const libReactNavigationPath = require.resolve('@react-navigation/native');\n\n const userExcluded = new Set(pkg.expo?.install?.exclude);\n const incorrectDependencies: IncorrectDependency[] = [];\n\n /**\n * If the user has a dependency with a sub-dependency on @react-navigation/native, this may install a different\n * version of @react-navigation/native than the one required by expo-router.\n *\n * To detect this, we require the caller of this function to first resolve their path to @react-navigation/native, as\n * they will get the 'top' level package. When expo-router resolves the path to @react-navigation/native, if it is different\n * when the versions must not have matched and the package manager installed a nested node_module folder with a different\n * version of @react-navigation/native.\n */\n if (\n // NOTE(@kitten): This looks inverted. However, this check will soon be redundant\n userExcluded.has('@react-navigation/native') &&\n appReactNavigationPath &&\n appReactNavigationPath !== libReactNavigationPath\n ) {\n console.warn(\n `Detected multiple versions of ${bold('@react-navigation/native')} in your ${bold('node_modules')}. This may lead to unexpected navigation behavior and errors. ${learnMore('https://expo.fyi/router-navigation-deps')}.`\n );\n }\n\n for (const [dep, allowedRange] of routerDependencies) {\n if (userExcluded.has(dep)) {\n debug(`Skipping ${dep} because it is excluded in the config`);\n continue;\n }\n\n const usersRange = resolvedDependencies[dep];\n\n /**\n * routerDependencies contains all the dependencies that are required by expo-router,\n * both peerDependencies and dependencies. If the user has not manually installed\n * them, then we should skip them.\n */\n if (!usersRange) {\n continue;\n }\n\n debug(`Checking ${dep} with ${allowedRange} and found ${usersRange}`);\n if (!usersRange || semverRangeSubset(allowedRange, usersRange)) {\n continue;\n }\n\n debug(`Incorrect dependency found for ${dep}`);\n\n incorrectDependencies.push({\n packageName: dep,\n packageType: pkg.dependencies && dep in pkg.dependencies ? 'dependencies' : 'devDependencies',\n expectedVersionOrRange: allowedRange,\n actualVersion: usersRange,\n });\n }\n\n return incorrectDependencies;\n}\n"]}
|
package/build/exports.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Navigator, Slot } from './views/Navigator';
|
|
2
2
|
export { useRouter, useUnstableGlobalHref, usePathname, useNavigationContainerRef, useGlobalSearchParams, useLocalSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from './hooks';
|
|
3
3
|
export { router, Router } from './imperative-api';
|
|
4
|
-
export
|
|
4
|
+
export * from './link/Link';
|
|
5
|
+
export * from './link/elements';
|
|
5
6
|
export { useIsPreview } from './link/preview/PreviewRouteContext';
|
|
6
7
|
export { withLayoutContext } from './layouts/withLayoutContext';
|
|
7
8
|
export { Navigator, Slot };
|
|
@@ -12,7 +13,6 @@ export { useSitemap, SitemapType } from './views/useSitemap';
|
|
|
12
13
|
export { ErrorBoundaryProps } from './views/Try';
|
|
13
14
|
export { ErrorBoundary } from './views/ErrorBoundary';
|
|
14
15
|
export type { ScreenProps } from './useScreens';
|
|
15
|
-
export { Modal } from './modal/Modal';
|
|
16
16
|
/**
|
|
17
17
|
* @hidden
|
|
18
18
|
*/
|
package/build/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;GAEG;AACH,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,mBAAmB,SAAS,CAAC"}
|
package/build/exports.js
CHANGED
|
@@ -15,6 +15,9 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
18
21
|
var __importStar = (this && this.__importStar) || (function () {
|
|
19
22
|
var ownKeys = function(o) {
|
|
20
23
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -33,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.useFocusEffect = exports.useNavigation = exports.SplashScreen = exports.
|
|
39
|
+
exports.useFocusEffect = exports.useNavigation = exports.SplashScreen = exports.ErrorBoundary = exports.useSitemap = exports.Sitemap = exports.Unmatched = exports.ExpoRoot = exports.Slot = exports.Navigator = exports.withLayoutContext = exports.useIsPreview = exports.router = exports.useRootNavigationState = exports.useRootNavigation = exports.useSegments = exports.useLocalSearchParams = exports.useGlobalSearchParams = exports.useNavigationContainerRef = exports.usePathname = exports.useUnstableGlobalHref = exports.useRouter = void 0;
|
|
37
40
|
// Expo Router API
|
|
38
41
|
const Navigator_1 = require("./views/Navigator");
|
|
39
42
|
Object.defineProperty(exports, "Navigator", { enumerable: true, get: function () { return Navigator_1.Navigator; } });
|
|
@@ -50,9 +53,8 @@ Object.defineProperty(exports, "useRootNavigation", { enumerable: true, get: fun
|
|
|
50
53
|
Object.defineProperty(exports, "useRootNavigationState", { enumerable: true, get: function () { return hooks_1.useRootNavigationState; } });
|
|
51
54
|
var imperative_api_1 = require("./imperative-api");
|
|
52
55
|
Object.defineProperty(exports, "router", { enumerable: true, get: function () { return imperative_api_1.router; } });
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Object.defineProperty(exports, "Redirect", { enumerable: true, get: function () { return Link_1.Redirect; } });
|
|
56
|
+
__exportStar(require("./link/Link"), exports);
|
|
57
|
+
__exportStar(require("./link/elements"), exports);
|
|
56
58
|
var PreviewRouteContext_1 = require("./link/preview/PreviewRouteContext");
|
|
57
59
|
Object.defineProperty(exports, "useIsPreview", { enumerable: true, get: function () { return PreviewRouteContext_1.useIsPreview; } });
|
|
58
60
|
var withLayoutContext_1 = require("./layouts/withLayoutContext");
|
|
@@ -68,8 +70,6 @@ var useSitemap_1 = require("./views/useSitemap");
|
|
|
68
70
|
Object.defineProperty(exports, "useSitemap", { enumerable: true, get: function () { return useSitemap_1.useSitemap; } });
|
|
69
71
|
var ErrorBoundary_1 = require("./views/ErrorBoundary");
|
|
70
72
|
Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorBoundary; } });
|
|
71
|
-
var Modal_1 = require("./modal/Modal");
|
|
72
|
-
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return Modal_1.Modal; } });
|
|
73
73
|
// Platform
|
|
74
74
|
/**
|
|
75
75
|
* @hidden
|
package/build/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,iDAAoD;AAqB3C,0FArBA,qBAAS,OAqBA;AAAE,qFArBA,gBAAI,OAqBA;AAnBxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAAkD;AAAzC,wGAAA,MAAM,OAAA;AAEf,8CAA4B;AAC5B,kDAAgC;AAChC,0EAAkE;AAAzD,mHAAA,YAAY,OAAA;AAErB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAClB,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAChB,iDAA6D;AAApD,wGAAA,UAAU,OAAA;AAEnB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAGtB,WAAW;AACX;;GAEG;AACH,+DAA+C;AAE/C,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkE;AAAzD,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router, Router } from './imperative-api';\n\nexport * from './link/Link';\nexport * from './link/elements';\nexport { useIsPreview } from './link/preview/PreviewRouteContext';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { Sitemap } from './views/Sitemap';\nexport { useSitemap, SitemapType } from './views/useSitemap';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport type { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport * as SplashScreen from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, EffectCallback } from './useFocusEffect';\nexport type { ResultState } from './fork/getStateFromPath';\n\nexport type { RedirectConfig } from './getRoutesCore';\nexport type { SingularOptions } from './useScreens';\n\nexport type * from './types';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type NavigatorTypeBagBase, type ParamListBase, type StackNavigationState, type StaticConfig, type TypedNavigator } from '@react-navigation/native';
|
|
2
|
-
import {
|
|
2
|
+
import { type NativeStackNavigationEventMap, type NativeStackNavigationOptions, type NativeStackNavigationProp, type NativeStackNavigatorProps } from '@react-navigation/native-stack';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
declare function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, ...rest }: NativeStackNavigatorProps): React.JSX.Element;
|
|
4
|
+
declare function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_router, ...rest }: NativeStackNavigatorProps): React.JSX.Element;
|
|
5
5
|
export declare function createNativeStackNavigator<const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = {
|
|
6
6
|
ParamList: ParamList;
|
|
7
7
|
NavigatorID: NavigatorID;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAE9B,KAAK,yBAAyB,EAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,iBAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,yBAAyB,qBA6I3B;AAED,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACxD,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE,6BAA6B,CAAC;IACxC,cAAc,EAAE;SACb,SAAS,IAAI,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC7F,CAAC;IACF,SAAS,EAAE,OAAO,oBAAoB,CAAC;CACxC,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAClE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD"}
|
|
@@ -37,7 +37,8 @@ exports.createNativeStackNavigator = createNativeStackNavigator;
|
|
|
37
37
|
const native_1 = require("@react-navigation/native");
|
|
38
38
|
const native_stack_1 = require("@react-navigation/native-stack");
|
|
39
39
|
const React = __importStar(require("react"));
|
|
40
|
-
|
|
40
|
+
const LinkPreviewContext_1 = require("../../link/preview/LinkPreviewContext");
|
|
41
|
+
function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_router, ...rest }) {
|
|
41
42
|
const { state, describe, descriptors, navigation, NavigationContent } = (0, native_1.useNavigationBuilder)(native_1.StackRouter, {
|
|
42
43
|
id,
|
|
43
44
|
initialRouteName,
|
|
@@ -46,6 +47,7 @@ function NativeStackNavigator({ id, initialRouteName, children, layout, screenLi
|
|
|
46
47
|
screenListeners,
|
|
47
48
|
screenOptions,
|
|
48
49
|
screenLayout,
|
|
50
|
+
UNSTABLE_router,
|
|
49
51
|
});
|
|
50
52
|
React.useEffect(() =>
|
|
51
53
|
// @ts-expect-error: there may not be a tab navigator in parent
|
|
@@ -64,8 +66,86 @@ function NativeStackNavigator({ id, initialRouteName, children, layout, screenLi
|
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
}), [navigation, state.index, state.key]);
|
|
69
|
+
// START FORK
|
|
70
|
+
const { openPreviewKey, setOpenPreviewKey } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
|
|
71
|
+
// This is used to track the preview screen that is currently transitioning on the native side
|
|
72
|
+
const [previewTransitioningScreenId, setPreviewTransitioningScreenId] = React.useState();
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
if (previewTransitioningScreenId) {
|
|
75
|
+
// This means that the state was updated after the preview transition
|
|
76
|
+
if (state.routes.some((route) => route.key === previewTransitioningScreenId)) {
|
|
77
|
+
// We no longer need to track the preview transitioning screen
|
|
78
|
+
setPreviewTransitioningScreenId(undefined);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, [state, previewTransitioningScreenId]);
|
|
82
|
+
const navigationWrapper = React.useMemo(() => {
|
|
83
|
+
if (openPreviewKey) {
|
|
84
|
+
const emit = (...args) => {
|
|
85
|
+
const { target, type, data } = args[0];
|
|
86
|
+
if (target === openPreviewKey && data && 'closing' in data && !data.closing) {
|
|
87
|
+
// onWillAppear
|
|
88
|
+
if (type === 'transitionStart') {
|
|
89
|
+
// The screen from preview will appear, so we need to start tracking it
|
|
90
|
+
setPreviewTransitioningScreenId(openPreviewKey);
|
|
91
|
+
}
|
|
92
|
+
// onAppear
|
|
93
|
+
else if (type === 'transitionEnd') {
|
|
94
|
+
// The screen from preview appeared.
|
|
95
|
+
// We can now restore the stack animation
|
|
96
|
+
setOpenPreviewKey(undefined);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return navigation.emit(...args);
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
...navigation,
|
|
103
|
+
emit,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return navigation;
|
|
107
|
+
}, [navigation, openPreviewKey, setOpenPreviewKey]);
|
|
108
|
+
const { computedState, computedDescriptors } = React.useMemo(() => {
|
|
109
|
+
// The preview screen was pushed on the native side, but react-navigation state was not updated yet
|
|
110
|
+
if (previewTransitioningScreenId) {
|
|
111
|
+
const preloadedRoute = state.preloadedRoutes.find((route) => route.key === previewTransitioningScreenId);
|
|
112
|
+
if (preloadedRoute) {
|
|
113
|
+
const newState = {
|
|
114
|
+
...state,
|
|
115
|
+
// On native side the screen is already pushed, so we need to update the state
|
|
116
|
+
preloadedRoutes: state.preloadedRoutes.filter((route) => route.key !== previewTransitioningScreenId),
|
|
117
|
+
routes: [...state.routes, preloadedRoute],
|
|
118
|
+
index: state.index + 1,
|
|
119
|
+
};
|
|
120
|
+
const newDescriptors = previewTransitioningScreenId in descriptors
|
|
121
|
+
? descriptors
|
|
122
|
+
: {
|
|
123
|
+
...descriptors,
|
|
124
|
+
// We need to add the descriptor. For react-navigation this is still preloaded screen
|
|
125
|
+
// Replicating the logic from https://github.com/react-navigation/react-navigation/blob/eaf1100ac7d99cb93ba11a999549dd0752809a78/packages/native-stack/src/views/NativeStackView.native.tsx#L489
|
|
126
|
+
[previewTransitioningScreenId]: describe(preloadedRoute, true),
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
computedState: newState,
|
|
130
|
+
computedDescriptors: newDescriptors,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
computedState: state,
|
|
136
|
+
computedDescriptors: descriptors,
|
|
137
|
+
};
|
|
138
|
+
}, [state, previewTransitioningScreenId, describe, descriptors]);
|
|
139
|
+
// END FORK
|
|
67
140
|
return (<NavigationContent>
|
|
68
|
-
<native_stack_1.NativeStackView {...rest}
|
|
141
|
+
<native_stack_1.NativeStackView {...rest}
|
|
142
|
+
// START FORK
|
|
143
|
+
state={computedState} navigation={navigationWrapper} descriptors={computedDescriptors}
|
|
144
|
+
// state={state}
|
|
145
|
+
// navigation={navigation}
|
|
146
|
+
// descriptors={descriptors}
|
|
147
|
+
// END FORK
|
|
148
|
+
describe={describe}/>
|
|
69
149
|
</NavigationContent>);
|
|
70
150
|
}
|
|
71
151
|
function createNativeStackNavigator(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,gEAiBC;AArGD,qDAakC;AAClC,iEAMwC;AACxC,6CAA+B;AAE/B,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,GAAG,IAAI,EACmB;IAC1B,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,EAAE;QACF,gBAAgB;QAChB,QAAQ;QACR,MAAM;QACN,eAAe;QACf,aAAa;QACb,YAAY;KACb,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CACb,GAAG,EAAE;IACH,+DAA+D;IAC/D,UAAU,EAAE,WAAW,EAAE,CAAC,UAAU,EAAE,CAAC,CAAM,EAAE,EAAE;QAC/C,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QAEzC,gFAAgF;QAChF,gEAAgE;QAChE,qBAAqB,CAAC,GAAG,EAAE;YACzB,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,SAAS,IAAI,CAAE,CAAgC,CAAC,gBAAgB,EAAE,CAAC;gBACxF,kEAAkE;gBAClE,gDAAgD;gBAChD,UAAU,CAAC,QAAQ,CAAC;oBAClB,GAAG,qBAAY,CAAC,QAAQ,EAAE;oBAC1B,MAAM,EAAE,KAAK,CAAC,GAAG;iBAClB,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,EACJ,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CACrC,CAAC;IAEF,OAAO,CACL,CAAC,iBAAiB,CAChB;MAAA,CAAC,8BAAe,CACd,IAAI,IAAI,CAAC,CACT,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAEvB;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAexC,MAAe;IACf,OAAO,IAAA,+BAAsB,EAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigatorProps,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap,\n NativeStackView,\n NativeStackNavigationProp,\n} from '@react-navigation/native-stack';\nimport * as React from 'react';\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n return (\n <NavigationContent>\n <NativeStackView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState<ParamList>;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkLA,gEAiBC;AAnMD,qDAakC;AAClC,iEAMwC;AACxC,6CAA+B;AAE/B,8EAA8E;AAE9E,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACmB;IAC1B,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,EAAE;QACF,gBAAgB;QAChB,QAAQ;QACR,MAAM;QACN,eAAe;QACf,aAAa;QACb,YAAY;QACZ,eAAe;KA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,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n type NativeStackNavigationEventMap,\n type NativeStackNavigationOptions,\n type NativeStackNavigationProp,\n NativeStackView,\n type NativeStackNavigatorProps,\n} from '@react-navigation/native-stack';\nimport * as React from 'react';\n\nimport { useLinkPreviewContext } from '../../link/preview/LinkPreviewContext';\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n // START FORK\n const { openPreviewKey, setOpenPreviewKey } = useLinkPreviewContext();\n\n // This is used to track the preview screen that is currently transitioning on the native side\n const [previewTransitioningScreenId, setPreviewTransitioningScreenId] = React.useState<\n string | undefined\n >();\n\n React.useEffect(() => {\n if (previewTransitioningScreenId) {\n // This means that the state was updated after the preview transition\n if (state.routes.some((route) => route.key === previewTransitioningScreenId)) {\n // We no longer need to track the preview transitioning screen\n setPreviewTransitioningScreenId(undefined);\n }\n }\n }, [state, previewTransitioningScreenId]);\n\n const navigationWrapper = React.useMemo(() => {\n if (openPreviewKey) {\n const emit: (typeof navigation)['emit'] = (...args) => {\n const { target, type, data } = args[0];\n if (target === openPreviewKey && data && 'closing' in data && !data.closing) {\n // onWillAppear\n if (type === 'transitionStart') {\n // The screen from preview will appear, so we need to start tracking it\n setPreviewTransitioningScreenId(openPreviewKey);\n }\n // onAppear\n else if (type === 'transitionEnd') {\n // The screen from preview appeared.\n // We can now restore the stack animation\n setOpenPreviewKey(undefined);\n }\n }\n return navigation.emit(...args);\n };\n return {\n ...navigation,\n emit,\n };\n }\n return navigation;\n }, [navigation, openPreviewKey, setOpenPreviewKey]);\n\n const { computedState, computedDescriptors } = React.useMemo(() => {\n // The preview screen was pushed on the native side, but react-navigation state was not updated yet\n if (previewTransitioningScreenId) {\n const preloadedRoute = state.preloadedRoutes.find(\n (route) => route.key === previewTransitioningScreenId\n );\n if (preloadedRoute) {\n const newState = {\n ...state,\n // On native side the screen is already pushed, so we need to update the state\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => route.key !== previewTransitioningScreenId\n ),\n routes: [...state.routes, preloadedRoute],\n index: state.index + 1,\n };\n\n const newDescriptors =\n previewTransitioningScreenId in descriptors\n ? descriptors\n : {\n ...descriptors,\n // We need to add the descriptor. For react-navigation this is still preloaded screen\n // Replicating the logic from https://github.com/react-navigation/react-navigation/blob/eaf1100ac7d99cb93ba11a999549dd0752809a78/packages/native-stack/src/views/NativeStackView.native.tsx#L489\n [previewTransitioningScreenId]: describe(preloadedRoute, true),\n };\n\n return {\n computedState: newState,\n computedDescriptors: newDescriptors,\n };\n }\n }\n return {\n computedState: state,\n computedDescriptors: descriptors,\n };\n }, [state, previewTransitioningScreenId, describe, descriptors]);\n // END FORK\n\n return (\n <NavigationContent>\n <NativeStackView\n {...rest}\n // START FORK\n state={computedState}\n navigation={navigationWrapper}\n descriptors={computedDescriptors}\n // state={state}\n // navigation={navigation}\n // descriptors={descriptors}\n // END FORK\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState<ParamList>;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]}
|
package/build/fork/useLinking.js
CHANGED
|
@@ -44,9 +44,9 @@ const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
|
44
44
|
const React = __importStar(require("react"));
|
|
45
45
|
const createMemoryHistory_1 = require("./createMemoryHistory");
|
|
46
46
|
const getPathFromState_1 = require("./getPathFromState");
|
|
47
|
-
const constants_1 = require("../constants");
|
|
48
47
|
const serverLocationContext_1 = require("../global-state/serverLocationContext");
|
|
49
48
|
const storeContext_1 = require("../global-state/storeContext");
|
|
49
|
+
const utils_1 = require("../global-state/utils");
|
|
50
50
|
/**
|
|
51
51
|
* Find the matching navigation state that changed between 2 navigation states
|
|
52
52
|
* e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state
|
|
@@ -139,7 +139,7 @@ function useLinking(ref, { enabled = true, config, getStateFromPath = native_1.g
|
|
|
139
139
|
// Instead of using the rootState, we use INTERNAL_SLOT_NAME, which is the only route in the root navigator in Expo Router
|
|
140
140
|
// const navigation = ref.current;
|
|
141
141
|
// const rootState = navigation?.getRootState();
|
|
142
|
-
const routeNames =
|
|
142
|
+
const routeNames = (0, utils_1.getRootStackRouteNames)();
|
|
143
143
|
// END FORK
|
|
144
144
|
// Make sure that the routes in the state exist in the root navigator
|
|
145
145
|
// Otherwise there's an error in the linking configuration
|