expo-router 58.0.17 → 58.0.18
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/android/build.gradle +2 -2
- package/build/ExpoRoot.js +18 -21
- package/build/ExpoRoot.js.map +1 -1
- package/build/Route.d.ts +2 -10
- package/build/Route.js +0 -50
- package/build/Route.js.map +1 -1
- package/build/fork/NavigationContainer.js +38 -25
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/useLinking.d.ts +11 -2
- package/build/fork/useLinking.js +4 -13
- package/build/fork/useLinking.js.map +1 -1
- package/build/fork/useLinking.native.d.ts +11 -2
- package/build/fork/useLinking.native.js +6 -18
- package/build/fork/useLinking.native.js.map +1 -1
- package/build/getReactNavigationConfig.js +7 -13
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutesCore.d.ts +1 -1
- package/build/getRoutesCore.js +9 -67
- package/build/getRoutesCore.js.map +1 -1
- package/build/global-state/RoutingQueueDrainer.d.ts +1 -1
- package/build/global-state/RoutingQueueDrainer.js +3 -2
- package/build/global-state/RoutingQueueDrainer.js.map +1 -1
- package/build/global-state/browserHistory.js +1 -1
- package/build/global-state/browserHistory.js.map +1 -1
- package/build/global-state/createSeededNavigationState.d.ts +1 -1
- package/build/global-state/createSeededNavigationState.js +73 -34
- package/build/global-state/createSeededNavigationState.js.map +1 -1
- package/build/global-state/getPathForState.js +1 -1
- package/build/global-state/getPathForState.js.map +1 -1
- package/build/global-state/getRouteInfoFromState.d.ts +5 -3
- package/build/global-state/getRouteInfoFromState.js +32 -1
- package/build/global-state/getRouteInfoFromState.js.map +1 -1
- package/build/global-state/resolveNavigationDestination.d.ts +1 -1
- package/build/global-state/resolveNavigationDestination.js +4 -4
- package/build/global-state/resolveNavigationDestination.js.map +1 -1
- package/build/global-state/useNavigationTreeReducer.d.ts +2 -1
- package/build/global-state/useNavigationTreeReducer.js +108 -11
- package/build/global-state/useNavigationTreeReducer.js.map +1 -1
- package/build/hooks/useSearchParams.js +3 -0
- package/build/hooks/useSearchParams.js.map +1 -1
- package/build/internal/static.d.ts +1 -0
- package/build/internal/static.js +5 -0
- package/build/internal/static.js.map +1 -1
- package/build/layoutAnchor.d.ts +20 -0
- package/build/layoutAnchor.js +172 -0
- package/build/layoutAnchor.js.map +1 -0
- package/build/layouts/GuardContext.js +2 -2
- package/build/layouts/GuardContext.js.map +1 -1
- package/build/link/preview/HrefPreview.js +2 -2
- package/build/link/preview/HrefPreview.js.map +1 -1
- package/build/navigationEvents/types.d.ts +2 -1
- package/build/react-navigation/core/BaseNavigationContainer.js +8 -4
- package/build/react-navigation/core/BaseNavigationContainer.js.map +1 -1
- package/build/react-navigation/core/useNavigationBuilder.js +13 -11
- package/build/react-navigation/core/useNavigationBuilder.js.map +1 -1
- package/build/react-navigation/native-stack/views/useHeaderConfigProps.js +12 -3
- package/build/react-navigation/native-stack/views/useHeaderConfigProps.js.map +1 -1
- package/build/react-navigation/routers/TabRouter.js +11 -2
- package/build/react-navigation/routers/TabRouter.js.map +1 -1
- package/build/routeNode.d.ts +9 -0
- package/build/routeNode.js +60 -0
- package/build/routeNode.js.map +1 -0
- package/build/standard-navigation/index.js +2 -1
- package/build/standard-navigation/index.js.map +1 -1
- package/build/standard-navigation/useVisibleTabsWithRedirect.js +2 -1
- package/build/standard-navigation/useVisibleTabsWithRedirect.js.map +1 -1
- package/build/static/getRouteInfoForLocation.d.ts +6 -0
- package/build/static/getRouteInfoForLocation.js +53 -0
- package/build/static/getRouteInfoForLocation.js.map +1 -0
- package/build/testing-library/index.d.ts +2 -1
- package/build/testing-library/index.js.map +1 -1
- package/build/typed-routes/types.d.ts +2 -2
- package/build/ui/Tabs.js +2 -1
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.js +4 -3
- package/build/ui/common.js.map +1 -1
- package/build/useFocusEffect.js +2 -2
- package/build/useScreens.js +2 -1
- package/build/useScreens.js.map +1 -1
- package/build/views/Navigator.js +2 -1
- package/build/views/Navigator.js.map +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.module → 58.0.18/expo.modules.router-58.0.18.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.pom → 58.0.18/expo.modules.router-58.0.18.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.18/expo.modules.router-58.0.18.pom.sha512 +1 -0
- package/package.json +8 -8
- package/build/fork/useThenable.d.ts +0 -1
- package/build/fork/useThenable.js +0 -104
- package/build/fork/useThenable.js.map +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.17/expo.modules.router-58.0.17.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17-sources.jar → 58.0.18/expo.modules.router-58.0.18-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17-sources.jar.md5 → 58.0.18/expo.modules.router-58.0.18-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17-sources.jar.sha1 → 58.0.18/expo.modules.router-58.0.18-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17-sources.jar.sha256 → 58.0.18/expo.modules.router-58.0.18-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17-sources.jar.sha512 → 58.0.18/expo.modules.router-58.0.18-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.aar → 58.0.18/expo.modules.router-58.0.18.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.aar.md5 → 58.0.18/expo.modules.router-58.0.18.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.aar.sha1 → 58.0.18/expo.modules.router-58.0.18.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.aar.sha256 → 58.0.18/expo.modules.router-58.0.18.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.17/expo.modules.router-58.0.17.aar.sha512 → 58.0.18/expo.modules.router-58.0.18.aar.sha512} +0 -0
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,13 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'expo.modules.router'
|
|
7
|
-
version = '58.0.
|
|
7
|
+
version = '58.0.18'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.router"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 1
|
|
13
|
-
versionName "58.0.
|
|
13
|
+
versionName "58.0.18"
|
|
14
14
|
}
|
|
15
15
|
lintOptions {
|
|
16
16
|
abortOnError false
|
package/build/ExpoRoot.js
CHANGED
|
@@ -113,27 +113,24 @@ const INITIAL_METRICS = _reactnative().Platform.OS === 'web' || isTestEnv ? {
|
|
|
113
113
|
} : undefined;
|
|
114
114
|
function ExpoRoot({ wrapper: ParentWrapper = _react().Fragment, ...props }) {
|
|
115
115
|
(0, _screensFeatureFlags.initScreensFeatureFlags)();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(ContextNavigator, {
|
|
135
|
-
...props,
|
|
136
|
-
wrapper: wrapper
|
|
116
|
+
// On the server, the parent wrapper renders the HTML document and `<div id="root">`. It stays
|
|
117
|
+
// outside the navigation container, so the container's Suspense boundary is inside `#root`
|
|
118
|
+
// like in the browser.
|
|
119
|
+
return /*#__PURE__*/ (0, _jsxruntime().jsx)(ParentWrapper, {
|
|
120
|
+
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(_routingQueueContext.RoutingQueueProvider, {
|
|
121
|
+
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(ContextNavigator, {
|
|
122
|
+
...props,
|
|
123
|
+
wrapper: AppWrapper
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function AppWrapper({ children }) {
|
|
129
|
+
return /*#__PURE__*/ (0, _jsxruntime().jsx)(_LinkPreviewContext.LinkPreviewContextProvider, {
|
|
130
|
+
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(_reactnativesafeareacontext().SafeAreaProvider, {
|
|
131
|
+
// SSR support
|
|
132
|
+
initialMetrics: INITIAL_METRICS,
|
|
133
|
+
children: children
|
|
137
134
|
})
|
|
138
135
|
});
|
|
139
136
|
}
|
package/build/ExpoRoot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ExpoRoot.tsx"],"sourcesContent":[null],"names":["ExpoRoot","isTestEnv","process","env","NODE_ENV","INITIAL_METRICS","Platform","OS","frame","x","y","width","height","insets","top","left","right","bottom","undefined","wrapper","ParentWrapper","Fragment","props","initScreensFeatureFlags","
|
|
1
|
+
{"version":3,"sources":["ExpoRoot.tsx"],"sourcesContent":[null],"names":["ExpoRoot","isTestEnv","process","env","NODE_ENV","INITIAL_METRICS","Platform","OS","frame","x","y","width","height","insets","top","left","right","bottom","undefined","wrapper","ParentWrapper","Fragment","props","initScreensFeatureFlags","RoutingQueueProvider","ContextNavigator","AppWrapper","children","LinkPreviewContextProvider","SafeAreaProvider","initialMetrics","initialUrl","window","URL","location","href","context","initialLocation","WrapperComponent","linking","serverUrl","useMemo","url","parseUrlUsingCustomBase","pathname","search","hash","routerConfig","rootComponent","useRouterConfig","linkingConfig","routeNode","useDomComponentNavigation","SplashScreen","hideAsync","Tutorial","require","RouterConfigContext","Provider","value","RemovalPreventionProvider","UpstreamNavigationContainer","ref","navigationRef","Content","Screen","name","INTERNAL_SLOT_NAME","component","shouldAppendNotFound","push","NOT_FOUND_ROUTE_NAME","RootUnmatched","shouldAppendSitemap","SITEMAP_ROUTE_NAME","Sitemap","state","descriptors","NavigationContent","useNavigationBuilder","StackRouter","id","useEffect","maybeHideSplashScreen","routes","index","key","render"],"mappings":"AAAA;;;;;+BAuDgBA;;;eAAAA;;;;;;;;;;;yBArDyE;;;;;;;yBAChE;;;;;;;yBACQ;;;;;;2BAE4C;2CACnC;qCACyB;+BAErC;mCACY;qCACN;qCACC;0BACL;uBAC0B;oCACf;4BACpB;wBAE2B;qCACV;wBAEF;qBACE;+BACV;yBACN;gEACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgB9B,MAAMC,YAAYC,QAAQC,GAAG,CAACC,QAAQ,KAAK;AAE3C,MAAMC,kBACJC,uBAAQ,CAACC,EAAE,KAAK,SAASN,YACrB;IACEO,OAAO;QAAEC,GAAG;QAAGC,GAAG;QAAGC,OAAO;QAAGC,QAAQ;IAAE;IACzCC,QAAQ;QAAEC,KAAK;QAAGC,MAAM;QAAGC,OAAO;QAAGC,QAAQ;IAAE;AACjD,IACAC;AAKC,SAASlB,SAAS,EAAEmB,SAASC,gBAAgBC,iBAAQ,EAAE,GAAGC,OAAsB;IACrFC,IAAAA,4CAAuB;IACvB,8FAA8F;IAC9F,2FAA2F;IAC3F,uBAAuB;IACvB,qBACE,uBAACH;kBACC,cAAA,uBAACI,yCAAoB;sBACnB,cAAA,uBAACC;gBAAkB,GAAGH,KAAK;gBAAEH,SAASO;;;;AAI9C;AAEA,SAASA,WAAW,EAAEC,QAAQ,EAAqB;IACjD,qBACE,uBAACC,8CAA0B;kBACzB,cAAA,uBAACC,8CAAgB;YACf,cAAc;YACdC,gBAAgBzB;sBACfsB;;;AAIT;AAEA,MAAMI,aACJzB,uBAAQ,CAACC,EAAE,KAAK,SAAS,OAAOyB,WAAW,cACvC,IAAIC,IAAID,OAAOE,QAAQ,CAACC,IAAI,IAC5BjB;AAEN,SAASO,iBAAiB,EACxBW,OAAO,EACPF,UAAUG,kBAAkBN,UAAU,E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AAI;QAC1B1C,SAAS2C,IAAI,eAAC,uBAACL,kBAAM;YAAiBC,MAAMK,+BAAoB;YAAEH,WAAWI,4BAAa;WAAhE;IAC5B;IACA,IAAIC,IAAAA,0BAAmB,KAAI;QACzB9C,SAAS2C,IAAI,eAAC,uBAACL,kBAAM;YAAeC,MAAMQ,6BAAkB;YAAEN,WAAWO,gBAAO;WAAtD;IAC5B;IACA,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,4BAAoB,EAACC,mBAAW,EAAE;QAClFrD;QACAsD,IAAId,6BAAkB;IACxB;IAEAe,IAAAA,kBAAS,EAAC;QACRC,IAAAA,6BAAqB;IACvB,GAAG,EAAE;IAEL,qBACE,uBAACL;kBAAmBD,WAAW,CAACD,MAAMQ,MAAM,CAACR,MAAMS,KAAK,CAAC,CAAEC,GAAG,CAAC,CAAEC,MAAM;;AAE3E"}
|
package/build/Route.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GenerateMetadataFunction, LoaderFunction } from 'expo-server';
|
|
2
2
|
import { type ComponentType, type PropsWithChildren } from 'react';
|
|
3
|
-
import type { PartialRoute, Route as NavigationRoute } from './react-navigation/routers';
|
|
4
3
|
import { sortRoutesWithInitial, sortRoutes } from './sortRoutes';
|
|
5
4
|
import type { SuspenseFallbackProps } from './views/SuspenseFallback';
|
|
6
5
|
import type { ErrorBoundaryProps } from './views/Try';
|
|
@@ -34,8 +33,8 @@ export type RouteNode = {
|
|
|
34
33
|
type: 'route' | 'api' | 'layout' | 'redirect' | 'rewrite';
|
|
35
34
|
/** Load a route into memory. Returns the exports from a route. */
|
|
36
35
|
loadRoute: () => LoadedRoute;
|
|
37
|
-
/**
|
|
38
|
-
|
|
36
|
+
/** Last group in the layout path. Selects group-specific `unstable_settings` and the default anchor. */
|
|
37
|
+
groupName?: string;
|
|
39
38
|
/** Nested routes */
|
|
40
39
|
children: RouteNode[];
|
|
41
40
|
/** Is the route a dynamic path */
|
|
@@ -68,13 +67,6 @@ export declare const ScreenErrorBoundaryContext: import("react").Context<Compone
|
|
|
68
67
|
export declare const LocalRouteParamsContext: import("react").Context<object | undefined>;
|
|
69
68
|
/** Return the RouteNode at the current contextual boundary. */
|
|
70
69
|
export declare function useRouteNode(): RouteNode | null;
|
|
71
|
-
export declare function findRouteNodeByName(node: RouteNode | null | undefined, name: string | undefined): RouteNode | undefined;
|
|
72
|
-
export declare function findRouteNodeAndParamsForState(node: RouteNode | null | undefined, state: PartialRoute<NavigationRoute<string>>['state']): {
|
|
73
|
-
routeNode: RouteNode | undefined;
|
|
74
|
-
params: Record<string, unknown>;
|
|
75
|
-
};
|
|
76
|
-
export declare function getValidInitialRoute(node: RouteNode | null, initialRouteName?: string | undefined, groupName?: string): RouteNode | undefined;
|
|
77
|
-
export declare const getValidInitialRouteName: (node: RouteNode | null, initialRouteName?: string | undefined) => string | undefined;
|
|
78
70
|
export declare function useContextKey(): string;
|
|
79
71
|
export type RouteProps = PropsWithChildren<{
|
|
80
72
|
node: RouteNode;
|
package/build/Route.js
CHANGED
|
@@ -8,10 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
Route: null,
|
|
9
9
|
ScreenErrorBoundaryContext: null,
|
|
10
10
|
SuspenseFallbackContext: null,
|
|
11
|
-
findRouteNodeAndParamsForState: null,
|
|
12
|
-
findRouteNodeByName: null,
|
|
13
|
-
getValidInitialRoute: null,
|
|
14
|
-
getValidInitialRouteName: null,
|
|
15
11
|
sortRoutes: null,
|
|
16
12
|
sortRoutesWithInitial: null,
|
|
17
13
|
useContextKey: null,
|
|
@@ -36,18 +32,6 @@ _export(exports, {
|
|
|
36
32
|
get SuspenseFallbackContext () {
|
|
37
33
|
return SuspenseFallbackContext;
|
|
38
34
|
},
|
|
39
|
-
get findRouteNodeAndParamsForState () {
|
|
40
|
-
return findRouteNodeAndParamsForState;
|
|
41
|
-
},
|
|
42
|
-
get findRouteNodeByName () {
|
|
43
|
-
return findRouteNodeByName;
|
|
44
|
-
},
|
|
45
|
-
get getValidInitialRoute () {
|
|
46
|
-
return getValidInitialRoute;
|
|
47
|
-
},
|
|
48
|
-
get getValidInitialRouteName () {
|
|
49
|
-
return getValidInitialRouteName;
|
|
50
|
-
},
|
|
51
35
|
get sortRoutes () {
|
|
52
36
|
return _sortRoutes.sortRoutes;
|
|
53
37
|
},
|
|
@@ -87,40 +71,6 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
87
71
|
function useRouteNode() {
|
|
88
72
|
return (0, _react().use)(CurrentRouteContext);
|
|
89
73
|
}
|
|
90
|
-
function findRouteNodeByName(node, name) {
|
|
91
|
-
return node?.children.find((child)=>child.route === name);
|
|
92
|
-
}
|
|
93
|
-
function findRouteNodeAndParamsForState(node, state) {
|
|
94
|
-
const params = {};
|
|
95
|
-
if (!state) {
|
|
96
|
-
return {
|
|
97
|
-
routeNode: undefined,
|
|
98
|
-
params
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
let routeNode = node ?? undefined;
|
|
102
|
-
while(state){
|
|
103
|
-
const route = state.routes[state.index ?? state.routes.length - 1];
|
|
104
|
-
Object.assign(params, route?.params);
|
|
105
|
-
routeNode = findRouteNodeByName(routeNode, route?.name);
|
|
106
|
-
state = route?.state;
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
routeNode,
|
|
110
|
-
params
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
function getValidInitialRoute(node, initialRouteName = node?.initialRouteName, groupName) {
|
|
114
|
-
if (!node || !initialRouteName) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
const route = findRouteNodeByName(node, initialRouteName) || findRouteNodeByName(node, `${initialRouteName}/index`);
|
|
118
|
-
if (!route) {
|
|
119
|
-
throw new Error(`The initial route name "${initialRouteName}"${groupName ? ` for group "${groupName}"` : ''} was not found in the layout at "${node.contextKey}". ` + `Available routes are: ${node.children.map(({ route })=>`"${route}"`).join(', ')}. ` + 'Set `unstable_settings.anchor` to the name of a route in this layout.');
|
|
120
|
-
}
|
|
121
|
-
return route;
|
|
122
|
-
}
|
|
123
|
-
const getValidInitialRouteName = (node, initialRouteName = node?.initialRouteName)=>getValidInitialRoute(node, initialRouteName)?.route;
|
|
124
74
|
function useContextKey() {
|
|
125
75
|
const node = useRouteNode();
|
|
126
76
|
if (node == null) {
|
package/build/Route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Route.tsx"],"sourcesContent":[null],"names":["LocalRouteParamsContext","Route","ScreenErrorBoundaryContext","SuspenseFallbackContext","
|
|
1
|
+
{"version":3,"sources":["Route.tsx"],"sourcesContent":[null],"names":["LocalRouteParamsContext","Route","ScreenErrorBoundaryContext","SuspenseFallbackContext","sortRoutes","sortRoutesWithInitial","useContextKey","useRouteNode","CurrentRouteContext","createContext","undefined","process","env","NODE_ENV","displayName","use","node","Error","getContextKey","contextKey","children","params","Provider","value"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;QA4EaA;eAAAA;;QAyBGC;eAAAA;;QA5BHC;eAAAA;;QAJAC;eAAAA;;QAwCmBC;eAAAA,sBAAU;;QAAjCC;eAAAA,iCAAqB;;QAtBdC;eAAAA;;QAJAC;eAAAA;;;;;;;;;;;yBAhF+D;;;;;;0BAEjD;4BACoB;AA6DlD,MAAMC,oCAAsBC,IAAAA,sBAAa,EAAmB;AAErD,MAAMN,wCAA0BM,IAAAA,sBAAa,EAElDC;AAEK,MAAMR,2CAA6BO,IAAAA,sBAAa,EAErDC;AACK,MAAMV,wCAA0BS,IAAAA,sBAAa,EAAqB,CAAC;AAE1E,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCL,oBAAoBM,WAAW,GAAG;AACpC;AAGO,SAASP;IACd,OAAOQ,IAAAA,YAAG,EAACP;AACb;AAEO,SAASF;IACd,MAAMU,OAAOT;IACb,IAAIS,QAAQ,MAAM;QAChB,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOC,IAAAA,uBAAa,EAACF,KAAKG,UAAU;AACtC;AAQO,SAASlB,MAAM,EAAEmB,QAAQ,EAAEJ,IAAI,EAAEK,MAAM,EAAc;IAC1D,qBACE,uBAACrB,wBAAwBsB,QAAQ;QAACC,OAAOF;kBACvC,cAAA,uBAACb,oBAAoBc,QAAQ;YAACC,OAAOP;sBAAOI;;;AAGlD"}
|
|
@@ -36,7 +36,6 @@ const _getPathFromState = require("./getPathFromState");
|
|
|
36
36
|
const _getStateFromPath = require("./getStateFromPath");
|
|
37
37
|
const _useBackButton = require("./useBackButton");
|
|
38
38
|
const _useLinking = require("./useLinking");
|
|
39
|
-
const _useThenable = require("./useThenable");
|
|
40
39
|
const _validatePathConfig = require("./validatePathConfig");
|
|
41
40
|
function _interop_require_default(obj) {
|
|
42
41
|
return obj && obj.__esModule ? obj : {
|
|
@@ -70,11 +69,39 @@ globalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
|
70
69
|
}), [
|
|
71
70
|
linking
|
|
72
71
|
]);
|
|
72
|
+
// Kept outside the Suspense boundary so a retry after loading reads the same promise.
|
|
73
|
+
const [initialState] = _react().default.useState(getInitialState);
|
|
74
|
+
return /*#__PURE__*/ (0, _jsxruntime().jsx)(_react().default.Suspense, {
|
|
75
|
+
fallback: /*#__PURE__*/ (0, _jsxruntime().jsx)(_native.ThemeProvider, {
|
|
76
|
+
value: theme,
|
|
77
|
+
children: fallback
|
|
78
|
+
}),
|
|
79
|
+
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(_native.LocaleDirContext.Provider, {
|
|
80
|
+
value: direction,
|
|
81
|
+
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(_native.LinkingContext.Provider, {
|
|
82
|
+
value: linkingContext,
|
|
83
|
+
children: /*#__PURE__*/ (0, _jsxruntime().jsx)(InitialStateNavigationContainer, {
|
|
84
|
+
...rest,
|
|
85
|
+
initialState: initialState,
|
|
86
|
+
linking: linking,
|
|
87
|
+
theme: theme,
|
|
88
|
+
routeNode: routerConfig?.routeNode ?? undefined,
|
|
89
|
+
containerRef: refContainer,
|
|
90
|
+
ref: ref
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function InitialStateNavigationContainer({ initialState: initialStateOrPromise, linking, routeNode, containerRef, ref, ...rest }) {
|
|
97
|
+
const initialState = isThenable(initialStateOrPromise) ? _react().default.use(initialStateOrPromise) : initialStateOrPromise;
|
|
98
|
+
// Set here, not in the parent, so the ref is set once the container mounts after waiting.
|
|
99
|
+
_react().default.useImperativeHandle(ref, ()=>containerRef.current);
|
|
73
100
|
// Add additional linking related info to the ref
|
|
74
101
|
// This will be used by the devtools
|
|
75
102
|
_react().default.useEffect(()=>{
|
|
76
|
-
if (
|
|
77
|
-
REACT_NAVIGATION_DEVTOOLS.set(
|
|
103
|
+
if (containerRef.current) {
|
|
104
|
+
REACT_NAVIGATION_DEVTOOLS.set(containerRef.current, {
|
|
78
105
|
get linking () {
|
|
79
106
|
return {
|
|
80
107
|
...linking,
|
|
@@ -86,33 +113,19 @@ globalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
|
86
113
|
});
|
|
87
114
|
}
|
|
88
115
|
});
|
|
89
|
-
const [isResolved, initialState] = (0, _useThenable.useThenable)(getInitialState);
|
|
90
|
-
_react().default.useImperativeHandle(ref, ()=>refContainer.current);
|
|
91
|
-
if (!isResolved) {
|
|
92
|
-
// This is temporary until we have Suspense for data-fetching
|
|
93
|
-
// Then the fallback will be handled by a parent `Suspense` component
|
|
94
|
-
return /*#__PURE__*/ (0, _jsxruntime().jsx)(_native.ThemeProvider, {
|
|
95
|
-
value: theme,
|
|
96
|
-
children: fallback
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
116
|
if (initialState === undefined) {
|
|
100
117
|
throw new Error('Linking did not produce an initial navigation state. Expo Router always seeds a complete initial state before rendering the navigation container, so this is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.');
|
|
101
118
|
}
|
|
102
|
-
return /*#__PURE__*/ (0, _jsxruntime().jsx)(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
...rest,
|
|
108
|
-
theme: theme,
|
|
109
|
-
initialState: initialState,
|
|
110
|
-
UNSTABLE_routeNode: routerConfig?.routeNode ?? undefined,
|
|
111
|
-
ref: refContainer
|
|
112
|
-
})
|
|
113
|
-
})
|
|
119
|
+
return /*#__PURE__*/ (0, _jsxruntime().jsx)(_BaseNavigationContainer.BaseNavigationContainer, {
|
|
120
|
+
...rest,
|
|
121
|
+
initialState: initialState,
|
|
122
|
+
UNSTABLE_routeNode: routeNode,
|
|
123
|
+
ref: containerRef
|
|
114
124
|
});
|
|
115
125
|
}
|
|
126
|
+
function isThenable(value) {
|
|
127
|
+
return typeof value === 'object' && value !== null && 'then' in value && typeof value.then === 'function';
|
|
128
|
+
}
|
|
116
129
|
const NavigationContainer = NavigationContainerInner;
|
|
117
130
|
|
|
118
131
|
//# sourceMappingURL=NavigationContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["fork/NavigationContainer.tsx"],"sourcesContent":[null],"names":["NavigationContainer","globalThis","REACT_NAVIGATION_DEVTOOLS","WeakMap","NavigationContainerInner","direction","I18nManager","getConstants","isRTL","theme","DefaultTheme","linking","fallback","ref","rest","routerConfig","React","use","RouterConfigContext","config","validatePathConfig","refContainer","useRef","useBackButton","getInitialState","useLinking","prefixes","linkingContext","useMemo","options","
|
|
1
|
+
{"version":3,"sources":["fork/NavigationContainer.tsx"],"sourcesContent":[null],"names":["NavigationContainer","globalThis","REACT_NAVIGATION_DEVTOOLS","WeakMap","NavigationContainerInner","direction","I18nManager","getConstants","isRTL","theme","DefaultTheme","linking","fallback","ref","rest","routerConfig","React","use","RouterConfigContext","config","validatePathConfig","refContainer","useRef","useBackButton","getInitialState","useLinking","prefixes","linkingContext","useMemo","options","initialState","useState","Suspense","ThemeProvider","value","LocaleDirContext","Provider","LinkingContext","InitialStateNavigationContainer","routeNode","undefined","containerRef","initialStateOrPromise","isThenable","useImperativeHandle","current","useEffect","set","getStateFromPath","getPathFromState","Error","BaseNavigationContainer","UNSTABLE_routeNode","then"],"mappings":";;;;+BAkKaA;;;eAAAA;;;;;;;;;;;gEAlKK;;;;;;;yBACU;;;;;;qCAGQ;yCACI;wBAcjC;kCAC0B;kCACA;+BACH;4BACH;oCACQ;;;;;;AAUnCC,WAAWC,yBAAyB,GAAG,IAAIC;AAQ3C;;;;;;;;;;CAUC,GACD,SAASC,yBAAyB,EAChCC,YAAYC,0BAAW,CAACC,YAAY,GAAGC,KAAK,GAAG,QAAQ,KAAK,EAC5DC,QAAQC,oBAAY,EACpBC,OAAO,EACPC,WAAW,IAAI,EACfC,GAAG,EACH,GAAGC,MAGJ;IACC,MAAMC,eAAeC,gBAAK,CAACC,GAAG,CAACC,wCAAmB;IAElD,IAAIP,SAASQ,QAAQ;QACnBC,IAAAA,sCAAkB,EAACT,QAAQQ,MAAM;IACnC;IAEA,MAAME,eAAeL,gBAAK,CAACM,MAAM,CAA+C;IAEhFC,IAAAA,4BAAa,EAACF;IAEd,MAAM,EAAEG,eAAe,EAAE,GAAGC,IAAAA,sBAAU,EAACJ,cAAc;QACnDK,UAAU,EAAE;QACZ,GAAGf,OAAO;IACZ;IAEA,MAAMgB,iBAAiBX,gBAAK,CAACY,OAAO,CAAC,IAAO,CAAA;YAAEC,SAASlB;QAAQ,CAAA,GAAI;QAACA;KAAQ;IAC5E,sFAAsF;IACtF,MAAM,CAACmB,aAAa,GAAGd,gBAAK,CAACe,QAAQ,CAACP;IAEtC,qBACE,uBAACR,gBAAK,CAACgB,QAAQ;QAACpB,wBAAU,uBAACqB,qBAAa;YAACC,OAAOzB;sBAAQG;;kBACtD,cAAA,uBAACuB,wBAAgB,CAACC,QAAQ;YAACF,OAAO7B;sBAChC,cAAA,uBAACgC,sBAAc,CAACD,QAAQ;gBAACF,OAAOP;0BAC9B,cAAA,uBAACW;oBACE,GAAGxB,IAAI;oBACRgB,cAAcA;oBACdnB,SAASA;oBACTF,OAAOA;oBACP8B,WAAWxB,cAAcwB,aAAaC;oBACtCC,cAAcpB;oBACdR,KAAKA;;;;;AAMjB;AAEA,SAASyB,gCAAgC,EACvCR,cAAcY,qBAAqB,EACnC/B,OAAO,EACP4B,SAAS,EACTE,YAAY,EACZ5B,GAAG,EACH,GAAGC,MAOJ;IACC,MAAMgB,eAAea,WAAWD,yBAC5B1B,gBAAK,CAACC,GAAG,CAACyB,yBACVA;IACJ,0FAA0F;IAC1F1B,gBAAK,CAAC4B,mBAAmB,CAAC/B,KAAK,IAAM4B,aAAaI,OAAO;IACzD,iDAAiD;IACjD,oCAAoC;IACpC7B,gBAAK,CAAC8B,SAAS,CAAC;QACd,IAAIL,aAAaI,OAAO,EAAE;YACxB3C,0BAA0B6C,GAAG,CAACN,aAAaI,OAAO,EAAE;gBAClD,IAAIlC,WAAU;oBACZ,OAAO;wBACL,GAAGA,OAAO;wBACVe,UAAUf,SAASe,YAAY,EAAE;wBACjCsB,kBAAkBrC,SAASqC,oBAAoBA,kCAAgB;wBAC/DC,kBAAkBtC,SAASsC,oBAAoBA,kCAAgB;oBACjE;gBACF;YACF;QACF;IACF;IACA,IAAInB,iBAAiBU,WAAW;QAC9B,MAAM,IAAIU,MACR;IAEJ;IAEA,qBACE,uBAACC,gDAAuB;QACrB,GAAGrC,IAAI;QACRgB,cAAcA;QACdsB,oBAAoBb;QACpB1B,KAAK4B;;AAGX;AAEA,SAASE,WAAcT,KAAyB;IAC9C,OACE,OAAOA,UAAU,YACjBA,UAAU,QACV,UAAUA,SACV,OAAOA,MAAMmB,IAAI,KAAK;AAE1B;AAGO,MAAMrD,sBAAsBI"}
|
|
@@ -2,7 +2,7 @@ import { type RefObject } from 'react';
|
|
|
2
2
|
import { type LinkingOptions, type NavigationContainerRef, type ParamListBase } from '../react-navigation/native';
|
|
3
3
|
type Options = LinkingOptions<ParamListBase>;
|
|
4
4
|
export declare function useLinking(_ref: RefObject<NavigationContainerRef<ParamListBase> | null>, { prefixes, config, getInitialURL, getStateFromPath, }: Options): {
|
|
5
|
-
getInitialState: () =>
|
|
5
|
+
getInitialState: () => Readonly<{
|
|
6
6
|
key: string;
|
|
7
7
|
routeKeySeq: number;
|
|
8
8
|
index: number;
|
|
@@ -11,7 +11,16 @@ export declare function useLinking(_ref: RefObject<NavigationContainerRef<ParamL
|
|
|
11
11
|
routes: import("../react-navigation").NavigationRoute<ParamListBase, string>[];
|
|
12
12
|
type?: string;
|
|
13
13
|
stale: false;
|
|
14
|
-
}> |
|
|
14
|
+
}> | Promise<Readonly<{
|
|
15
|
+
key: string;
|
|
16
|
+
routeKeySeq: number;
|
|
17
|
+
index: number;
|
|
18
|
+
routeNames: string[];
|
|
19
|
+
history?: unknown[];
|
|
20
|
+
routes: import("../react-navigation").NavigationRoute<ParamListBase, string>[];
|
|
21
|
+
type?: string;
|
|
22
|
+
stale: false;
|
|
23
|
+
}> | undefined> | undefined;
|
|
15
24
|
};
|
|
16
25
|
export declare function getInitialURLWithTimeout(): string | null | Promise<string | null>;
|
|
17
26
|
export {};
|
package/build/fork/useLinking.js
CHANGED
|
@@ -29,6 +29,7 @@ function _react() {
|
|
|
29
29
|
}
|
|
30
30
|
const _createSeededNavigationState = require("../global-state/createSeededNavigationState");
|
|
31
31
|
const _routerConfigContext = require("../global-state/routerConfigContext");
|
|
32
|
+
const _layoutAnchor = require("../layoutAnchor");
|
|
32
33
|
const _native = require("../react-navigation/native");
|
|
33
34
|
const _stateKeys = require("../react-navigation/routers/stateKeys");
|
|
34
35
|
const _extractPathFromURL = require("./extractPathFromURL");
|
|
@@ -55,7 +56,7 @@ function useLinking(_ref, { prefixes, config, getInitialURL = getInitialURLWithT
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
}, []);
|
|
58
|
-
// `
|
|
59
|
+
// `NavigationContainer` only consumes this function from the first render, keeping initialization options consistent.
|
|
59
60
|
const getInitialState = ()=>{
|
|
60
61
|
const getStateFromURL = (url)=>{
|
|
61
62
|
let path = url ? (0, _extractPathFromURL.extractExpoPathFromURL)(prefixes, url) : undefined;
|
|
@@ -64,23 +65,13 @@ function useLinking(_ref, { prefixes, config, getInitialURL = getInitialURLWithT
|
|
|
64
65
|
}
|
|
65
66
|
const parsedState = path ? getStateFromPath(path, config) : undefined;
|
|
66
67
|
const routeNode = routerConfig?.routeNode;
|
|
67
|
-
|
|
68
|
-
return state;
|
|
68
|
+
return routeNode ? (0, _layoutAnchor.withLoadedLayouts)(()=>(0, _createSeededNavigationState.createSeededRootState)(parsedState, routeNode)) : (0, _createSeededNavigationState.completeParsedState)(parsedState, _stateKeys.ROOT_CHAIN);
|
|
69
69
|
};
|
|
70
70
|
const url = getInitialURL();
|
|
71
71
|
if (typeof url !== 'string' && url != null) {
|
|
72
72
|
return url.then(getStateFromURL);
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
const thenable = {
|
|
76
|
-
then (onfulfilled) {
|
|
77
|
-
return Promise.resolve(onfulfilled ? onfulfilled(state) : state);
|
|
78
|
-
},
|
|
79
|
-
catch () {
|
|
80
|
-
return thenable;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
return thenable;
|
|
74
|
+
return getStateFromURL(url);
|
|
84
75
|
};
|
|
85
76
|
return {
|
|
86
77
|
getInitialState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["fork/useLinking.ts"],"sourcesContent":[null],"names":["getInitialURLWithTimeout","useLinking","linkingHandlers","_ref","prefixes","config","getInitialURL","getStateFromPath","getStateFromPathDefault","routerConfig","use","RouterConfigContext","useEffect","process","env","NODE_ENV","undefined","length","console","error","join","trim","handler","Symbol","push","index","indexOf","splice","getInitialState","getStateFromURL","url","path","extractExpoPathFromURL","startsWith","parsedState","routeNode","
|
|
1
|
+
{"version":3,"sources":["fork/useLinking.ts"],"sourcesContent":[null],"names":["getInitialURLWithTimeout","useLinking","linkingHandlers","_ref","prefixes","config","getInitialURL","getStateFromPath","getStateFromPathDefault","routerConfig","use","RouterConfigContext","useEffect","process","env","NODE_ENV","undefined","length","console","error","join","trim","handler","Symbol","push","index","indexOf","splice","getInitialState","getStateFromURL","url","path","extractExpoPathFromURL","startsWith","parsedState","routeNode","withLoadedLayouts","createSeededRootState","completeParsedState","ROOT_CHAIN","then","window","location","href"],"mappings":";;;;;;;;;;;;;;;QA0FgBA;eAAAA;;QArEAC;eAAAA;;;;yBArB+B;;;;;;6CAKxC;qCAC6B;8BACF;wBAM3B;2BACoB;oCACY;AAEvC,MAAMC,kBAA4B,EAAE;AAI7B,SAASD,WACdE,IAA6D,EAC7D,EACEC,QAAQ,EACRC,MAAM,EACNC,gBAAgBN,wBAAwB,EACxCO,mBAAmBC,wBAAuB,EAClC;IAEV,MAAMC,eAAeC,IAAAA,YAAG,EAACC,wCAAmB;IAE5CC,IAAAA,kBAAS,EAAC;QACR,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,OAAOC;QACT;QAEA,IAAId,gBAAgBe,MAAM,EAAE;YAC1BC,QAAQC,KAAK,CACX;gBACE;gBACA;gBACA;aACD,CACEC,IAAI,CAAC,MACLC,IAAI;QAEX;QAEA,MAAMC,UAAUC;QAEhBrB,gBAAgBsB,IAAI,CAACF;QAErB,OAAO;YACL,MAAMG,QAAQvB,gBAAgBwB,OAAO,CAACJ;YAEtC,IAAIG,QAAQ,CAAC,GAAG;gBACdvB,gBAAgByB,MAAM,CAACF,OAAO;YAChC;QACF;IACF,GAAG,EAAE;IAEL,sHAAsH;IACtH,MAAMG,kBAAkB;QACtB,MAAMC,kBAAkB,CAACC;YACvB,IAAIC,OAAOD,MAAME,IAAAA,0CAAsB,EAAC5B,UAAU0B,OAAOd;YACzD,IAAIe,SAASf,aAAa,CAACe,KAAKE,UAAU,CAAC,MAAM;gBAC/CF,OAAO,CAAC,CAAC,EAAEA,MAAM;YACnB;YAEA,MAAMG,cAAcH,OAAOxB,iBAAiBwB,MAAM1B,UAAUW;YAC5D,MAAMmB,YAAY1B,cAAc0B;YAChC,OAAOA,YACHC,IAAAA,+BAAiB,EAAC,IAAMC,IAAAA,kDAAqB,EAACH,aAAaC,cAC3DG,IAAAA,gDAAmB,EAACJ,aAAaK,qBAAU;QACjD;QACA,MAAMT,MAAMxB;QAEZ,IAAI,OAAOwB,QAAQ,YAAYA,OAAO,MAAM;YAC1C,OAAOA,IAAIU,IAAI,CAACX;QAClB;QAEA,OAAOA,gBAAgBC;IACzB;IAEA,OAAO;QACLF;IACF;AACF;AAEO,SAAS5B;IACd,OAAO,OAAOyC,WAAW,cAAc,KAAKA,OAAOC,QAAQ,CAACC,IAAI;AAClE"}
|
|
@@ -2,7 +2,7 @@ import { type RefObject } from 'react';
|
|
|
2
2
|
import { type LinkingOptions, type NavigationContainerRef, type ParamListBase } from '../react-navigation/native';
|
|
3
3
|
type Options = LinkingOptions<ParamListBase>;
|
|
4
4
|
export declare function useLinking(ref: RefObject<NavigationContainerRef<ParamListBase>>, { prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, }: Options): {
|
|
5
|
-
getInitialState: () =>
|
|
5
|
+
getInitialState: () => Readonly<{
|
|
6
6
|
key: string;
|
|
7
7
|
routeKeySeq: number;
|
|
8
8
|
index: number;
|
|
@@ -11,6 +11,15 @@ export declare function useLinking(ref: RefObject<NavigationContainerRef<ParamLi
|
|
|
11
11
|
routes: import("../react-navigation").NavigationRoute<ParamListBase, string>[];
|
|
12
12
|
type?: string;
|
|
13
13
|
stale: false;
|
|
14
|
-
}> |
|
|
14
|
+
}> | Promise<Readonly<{
|
|
15
|
+
key: string;
|
|
16
|
+
routeKeySeq: number;
|
|
17
|
+
index: number;
|
|
18
|
+
routeNames: string[];
|
|
19
|
+
history?: unknown[];
|
|
20
|
+
routes: import("../react-navigation").NavigationRoute<ParamListBase, string>[];
|
|
21
|
+
type?: string;
|
|
22
|
+
stale: false;
|
|
23
|
+
}> | undefined> | undefined;
|
|
15
24
|
};
|
|
16
25
|
export {};
|
|
@@ -26,6 +26,7 @@ const _createSeededNavigationState = require("../global-state/createSeededNaviga
|
|
|
26
26
|
const _getRouteInfoFromState = require("../global-state/getRouteInfoFromState");
|
|
27
27
|
const _routerConfigContext = require("../global-state/routerConfigContext");
|
|
28
28
|
const _routingQueueContext = require("../global-state/routingQueueContext");
|
|
29
|
+
const _layoutAnchor = require("../layoutAnchor");
|
|
29
30
|
const _native = require("../react-navigation/native");
|
|
30
31
|
const _stateKeys = require("../react-navigation/routers/stateKeys");
|
|
31
32
|
const _extractPathFromURL = require("./extractPathFromURL");
|
|
@@ -78,9 +79,8 @@ function useLinking(ref, { prefixes, filter, config, getInitialURL = ()=>(0, _ge
|
|
|
78
79
|
}
|
|
79
80
|
const path = (0, _extractPathFromURL.extractExpoPathFromURL)(prefixes, url);
|
|
80
81
|
if (path !== undefined) {
|
|
81
|
-
// TODO(@ubax): check if this is performant
|
|
82
82
|
// TODO(@ubax): check if ref.current?.getRootState() can be replaced with the context read
|
|
83
|
-
const segments = (0, _getRouteInfoFromState.
|
|
83
|
+
const segments = (0, _getRouteInfoFromState.getRouteSegmentsFromState)(ref.current?.getRootState());
|
|
84
84
|
return getStateFromPath(path, config, segments);
|
|
85
85
|
}
|
|
86
86
|
return undefined;
|
|
@@ -88,27 +88,15 @@ function useLinking(ref, { prefixes, filter, config, getInitialURL = ()=>(0, _ge
|
|
|
88
88
|
const getInitialState = (0, _react().useCallback)(()=>{
|
|
89
89
|
const url = getInitialURL();
|
|
90
90
|
const createInitialState = (url)=>{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const path = getInitialPath(prefixes, url);
|
|
94
|
-
parsedState = getStateFromPath(path, config);
|
|
95
|
-
}
|
|
91
|
+
const shouldParseURL = url && (!filter || filter(url));
|
|
92
|
+
const parsedState = shouldParseURL ? getStateFromPath(getInitialPath(prefixes, url), config) : undefined;
|
|
96
93
|
const routeNode = routerConfig?.routeNode;
|
|
97
|
-
return routeNode ? (0, _createSeededNavigationState.createSeededRootState)(parsedState, routeNode) : (0, _createSeededNavigationState.completeParsedState)(parsedState, _stateKeys.ROOT_CHAIN);
|
|
94
|
+
return routeNode ? (0, _layoutAnchor.withLoadedLayouts)(()=>(0, _createSeededNavigationState.createSeededRootState)(parsedState, routeNode)) : (0, _createSeededNavigationState.completeParsedState)(parsedState, _stateKeys.ROOT_CHAIN);
|
|
98
95
|
};
|
|
99
96
|
if (url != null && typeof url !== 'string') {
|
|
100
97
|
return url.then(createInitialState);
|
|
101
98
|
}
|
|
102
|
-
|
|
103
|
-
const thenable = {
|
|
104
|
-
then (onfulfilled) {
|
|
105
|
-
return Promise.resolve(onfulfilled ? onfulfilled(state) : state);
|
|
106
|
-
},
|
|
107
|
-
catch () {
|
|
108
|
-
return thenable;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
return thenable;
|
|
99
|
+
return createInitialState(url);
|
|
112
100
|
}, [
|
|
113
101
|
config,
|
|
114
102
|
filter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["fork/useLinking.native.ts"],"sourcesContent":[null],"names":["useLinking","linkingHandlers","getInitialPath","prefixes","url","path","extractExpoPathFromURL","startsWith","ref","filter","config","getInitialURL","getInitialURLWithTimeout","subscribe","listener","callback","subscription","Linking","addEventListener","removeEventListener","bind","remove","getStateFromPath","getStateFromPathDefault","routerConfig","use","RouterConfigContext","enqueue","useEnqueueRoutingIntent","useEffect","process","env","NODE_ENV","undefined","length","console","error","join","trim","handler","Symbol","push","index","indexOf","splice","getStateFromURL","useEffectEvent","segments","
|
|
1
|
+
{"version":3,"sources":["fork/useLinking.native.ts"],"sourcesContent":[null],"names":["useLinking","linkingHandlers","getInitialPath","prefixes","url","path","extractExpoPathFromURL","startsWith","ref","filter","config","getInitialURL","getInitialURLWithTimeout","subscribe","listener","callback","subscription","Linking","addEventListener","removeEventListener","bind","remove","getStateFromPath","getStateFromPathDefault","routerConfig","use","RouterConfigContext","enqueue","useEnqueueRoutingIntent","useEffect","process","env","NODE_ENV","undefined","length","console","error","join","trim","handler","Symbol","push","index","indexOf","splice","getStateFromURL","useEffectEvent","segments","getRouteSegmentsFromState","current","getRootState","getInitialState","useCallback","createInitialState","shouldParseURL","parsedState","routeNode","withLoadedLayouts","createSeededRootState","completeParsedState","ROOT_CHAIN","then","navigation","state","rootState","routes","some","r","routeNames","includes","name","type","payload","href","originalHref","options","event"],"mappings":";;;;+BA8BgBA;;;eAAAA;;;;yBA9B4D;;;;;;;yBACpD;;;;;;6CAKjB;uCACmC;qCACN;qCACI;8BACN;wBAM3B;2BACoB;oCACY;0CACE;AAIzC,MAAMC,kBAA4B,EAAE;AAEpC,SAASC,eAAeC,QAAkB,EAAEC,GAAW;IACrD,MAAMC,OAAOC,IAAAA,0CAAsB,EAACH,UAAUC;IAC9C,OAAOC,KAAKE,UAAU,CAAC,OAAOF,OAAO,CAAC,CAAC,EAAEA,MAAM;AACjD;AAEO,SAASL,WACdQ,GAAqD,EACrD,EACEL,QAAQ,EACRM,MAAM,EACNC,MAAM,EACNC,gBAAgB,IAAMC,IAAAA,kDAAwB,GAAE,EAChDC,YAAY,CAACC;IACX,MAAMC,WAAW,CAAC,EAAEX,GAAG,EAAmB,GAAKU,SAASV;IAExD,MAAMY,eAAeC,sBAAO,CAACC,gBAAgB,CAAC,OAAOH;IAIrD,2FAA2F;IAC3F,4EAA4E;IAC5E,MAAMI,sBAAsBF,sBAAO,CAACE,mBAAmB,EAAEC,KAAKH,sBAAO;IAErE,OAAO;QACL,2FAA2F;QAC3F,IAAID,cAAcK,QAAQ;YACxBL,aAAaK,MAAM;QACrB,OAAO;YACLF,sBAAsB,OAAOJ;QAC/B;IACF;AACF,CAAC,EACDO,mBAAmBC,wBAAuB,EAClC;IAEV,MAAMC,eAAeC,IAAAA,YAAG,EAACC,wCAAmB;IAC5C,MAAMC,UAAUC,IAAAA,4CAAuB;IAEvCC,IAAAA,kBAAS,EAAC;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EA,OAAOA,mBAAmBjD;IAC5B,GAAG;QAACM;QAAQD;QAAQE;QAAeW;QAAkBnB;QAAUqB;KAAa;IAE5EK,IAAAA,kBAAS,EAAC;QACR,MAAMf,WAAW,CAACV;YAChB,MAAM0D,aAAatD,IAAIyC,OAAO;YAC9B,MAAM5C,OAAOH,eAAeC,UAAUC;YACtC,MAAM2D,QAAQD,aAAajB,gBAAgBzC,OAAO6B;YAElD,IAAI6B,cAAcC,OAAO;gBACvB,MAAMC,YAAYF,WAAWZ,YAAY;gBACzC,IAAIa,MAAME,MAAM,CAACC,IAAI,CAAC,CAACC,IAAM,CAACH,WAAWI,WAAWC,SAASF,EAAEG,IAAI,IAAI;oBACrE;gBACF;gBAEA3C,QAAQ;oBACN4C,MAAM;oBACNC,SAAS;wBACPC,MAAMpE;wBACNqE,cAActE;wBACduE,SAAS;4BAAEC,OAAO;wBAAW;oBAC/B;gBACF;YACF;QACF;QAEA,OAAO/D,UAAUC;IACnB,GAAG;QAACa;QAASxB;QAAUK;QAAKK;KAAU;IAEtC,OAAO;QACLsC;IACF;AACF"}
|
|
@@ -24,6 +24,7 @@ _export(exports, {
|
|
|
24
24
|
return parseRouteSegments;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
const _layoutAnchor = require("./layoutAnchor");
|
|
27
28
|
const _matchers = require("./matchers");
|
|
28
29
|
// `[page]` -> `:page`
|
|
29
30
|
// `page` -> `page`
|
|
@@ -70,12 +71,11 @@ function convertRouteNodeToScreen(node, metaOnly) {
|
|
|
70
71
|
path,
|
|
71
72
|
screens
|
|
72
73
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
screen.initialRouteName = node.initialRouteName;
|
|
74
|
+
// When several routes match a URL equally well, the URL parser prefers the layout's initial route.
|
|
75
|
+
// The anchor from `unstable_settings` is not used, because reading it loads the layout.
|
|
76
|
+
const groupMatchingRouteName = (0, _layoutAnchor.getGroupMatchingRouteName)(node);
|
|
77
|
+
if (groupMatchingRouteName) {
|
|
78
|
+
screen.initialRouteName = groupMatchingRouteName;
|
|
79
79
|
}
|
|
80
80
|
if (!metaOnly) {
|
|
81
81
|
screen._route = node;
|
|
@@ -89,16 +89,10 @@ function getReactNavigationScreensConfig(nodes, metaOnly) {
|
|
|
89
89
|
]));
|
|
90
90
|
}
|
|
91
91
|
function getReactNavigationConfig(routeTree, metaOnly) {
|
|
92
|
-
|
|
92
|
+
return {
|
|
93
93
|
initialRouteName: undefined,
|
|
94
94
|
screens: routeTree ? getReactNavigationScreensConfig(routeTree.children, metaOnly) : {}
|
|
95
95
|
};
|
|
96
|
-
if (routeTree?.initialRouteName) {
|
|
97
|
-
// We're using LinkingOptions the generic type is `object` instead of a proper ParamList.
|
|
98
|
-
// So we need to cast the initialRouteName to `any` to avoid type errors.
|
|
99
|
-
config.initialRouteName = routeTree.initialRouteName;
|
|
100
|
-
}
|
|
101
|
-
return config;
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
//# sourceMappingURL=getReactNavigationConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["getReactNavigationConfig.ts"],"sourcesContent":[null],"names":["getReactNavigationConfig","getReactNavigationScreensConfig","parseRouteSegments","convertDynamicRouteToReactNavigation","segment","dynamicName","matchDynamicName","deep","name","segments","split","map","filter","Boolean","join","convertRouteNodeToScreen","node","metaOnly","path","route","children","length","screens","_route","screen","initialRouteName","nodes","Object","fromEntries","routeTree","
|
|
1
|
+
{"version":3,"sources":["getReactNavigationConfig.ts"],"sourcesContent":[null],"names":["getReactNavigationConfig","getReactNavigationScreensConfig","parseRouteSegments","convertDynamicRouteToReactNavigation","segment","dynamicName","matchDynamicName","deep","name","segments","split","map","filter","Boolean","join","convertRouteNodeToScreen","node","metaOnly","path","route","children","length","screens","_route","screen","groupMatchingRouteName","getGroupMatchingRouteName","initialRouteName","nodes","Object","fromEntries","routeTree","undefined"],"mappings":";;;;;;;;;;;;;;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