expo-router 3.1.0 → 3.1.1
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.js +6 -1
- package/_ctx.web.js +1 -1
- package/babel.js +0 -18
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +64 -56
- package/build/ExpoRoot.js.map +1 -1
- package/build/LocationProvider.d.ts +2 -2
- package/build/LocationProvider.d.ts.map +1 -1
- package/build/LocationProvider.js +11 -5
- package/build/LocationProvider.js.map +1 -1
- package/build/Route.d.ts +2 -2
- package/build/Route.d.ts.map +1 -1
- package/build/Route.js +41 -55
- package/build/Route.js.map +1 -1
- package/build/exports.d.ts +1 -1
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +34 -12
- package/build/exports.js.map +1 -1
- package/build/fork/NavigationContainer.js +4 -2
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/NavigationContainer.native.js +48 -20
- package/build/fork/NavigationContainer.native.js.map +1 -1
- package/build/fork/extractPathFromURL.js +39 -8
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/findFocusedRoute.js +5 -1
- package/build/fork/findFocusedRoute.js.map +1 -1
- package/build/fork/getPathFromState.d.ts +1 -0
- package/build/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +59 -14
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/fork/getStateFromPath.d.ts +2 -1
- package/build/fork/getStateFromPath.d.ts.map +1 -1
- package/build/fork/getStateFromPath.js +73 -21
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/react-native-web-container.js +3 -1
- package/build/fork/react-native-web-container.js.map +1 -1
- package/build/fork/useLinking.js +7 -2
- package/build/fork/useLinking.js.map +1 -1
- package/build/fork/useLinking.native.js +36 -10
- package/build/fork/useLinking.native.js.map +1 -1
- package/build/fork/validatePathConfig.js +4 -1
- package/build/fork/validatePathConfig.js.map +1 -1
- package/build/getDevServer/index.js +13 -6
- package/build/getDevServer/index.js.map +1 -1
- package/build/getDevServer/index.native.js +4 -1
- package/build/getDevServer/index.native.js.map +1 -1
- package/build/getLinkingConfig.js +19 -14
- package/build/getLinkingConfig.js.map +1 -1
- package/build/getReactNavigationConfig.js +10 -5
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutes.d.ts +2 -0
- package/build/getRoutes.d.ts.map +1 -1
- package/build/getRoutes.js +56 -27
- package/build/getRoutes.js.map +1 -1
- package/build/getServerManifest.d.ts +55 -0
- package/build/getServerManifest.d.ts.map +1 -0
- package/build/getServerManifest.js +159 -0
- package/build/getServerManifest.js.map +1 -0
- package/build/global-state/router-store.js +53 -45
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.js +62 -29
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/sort-routes.js +7 -3
- package/build/global-state/sort-routes.js.map +1 -1
- package/build/head/ExpoHead.android.js +10 -3
- package/build/head/ExpoHead.android.js.map +1 -1
- package/build/head/ExpoHead.ios.js +41 -35
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/head/ExpoHead.js +12 -5
- package/build/head/ExpoHead.js.map +1 -1
- package/build/head/ExpoHeadModule.js +4 -1
- package/build/head/ExpoHeadModule.js.map +1 -1
- package/build/head/ExpoHeadModule.native.js +31 -5
- package/build/head/ExpoHeadModule.native.js.map +1 -1
- package/build/head/index.js +17 -1
- package/build/head/index.js.map +1 -1
- package/build/head/url.js +12 -5
- package/build/head/url.js.map +1 -1
- package/build/hooks.d.ts +0 -3
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +41 -36
- package/build/hooks.js.map +1 -1
- package/build/imperative-api.js +10 -7
- package/build/imperative-api.js.map +1 -1
- package/build/import-mode/index.android.js +3 -1
- package/build/import-mode/index.android.js.map +1 -1
- package/build/import-mode/index.ios.js +3 -1
- package/build/import-mode/index.ios.js.map +1 -1
- package/build/import-mode/index.js +3 -1
- package/build/import-mode/index.js.map +1 -1
- package/build/import-mode/index.web.js +3 -1
- package/build/import-mode/index.web.js.map +1 -1
- package/build/index.js +22 -3
- package/build/index.js.map +1 -1
- package/build/layouts/Drawer.js +8 -5
- package/build/layouts/Drawer.js.map +1 -1
- package/build/layouts/Stack.js +8 -5
- package/build/layouts/Stack.js.map +1 -1
- package/build/layouts/Tabs.js +16 -10
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.js +22 -14
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.js +46 -16
- package/build/link/Link.js.map +1 -1
- package/build/link/href.js +6 -2
- package/build/link/href.js.map +1 -1
- package/build/link/linking.js +48 -15
- package/build/link/linking.js.map +1 -1
- package/build/link/path.js +5 -1
- package/build/link/path.js.map +1 -1
- package/build/link/stateOperations.js +11 -4
- package/build/link/stateOperations.js.map +1 -1
- package/build/link/useLinkToPathProps.d.ts.map +1 -1
- package/build/link/useLinkToPathProps.js +12 -8
- package/build/link/useLinkToPathProps.js.map +1 -1
- package/build/link/useLoadedNavigation.js +20 -15
- package/build/link/useLoadedNavigation.js.map +1 -1
- package/build/loadStaticParamsAsync.js +5 -1
- package/build/loadStaticParamsAsync.js.map +1 -1
- package/build/matchers.js +22 -10
- package/build/matchers.js.map +1 -1
- package/build/onboard/Tutorial.js +37 -30
- package/build/onboard/Tutorial.js.map +1 -1
- package/build/onboard/createEntryFile.js +9 -4
- package/build/onboard/createEntryFile.js.map +1 -1
- package/build/primitives.js +6 -2
- package/build/primitives.js.map +1 -1
- package/build/qualified-entry.js +14 -7
- package/build/qualified-entry.js.map +1 -1
- package/build/renderRootComponent.js +18 -11
- package/build/renderRootComponent.js.map +1 -1
- package/build/routes-manifest.d.ts +14 -0
- package/build/routes-manifest.d.ts.map +1 -0
- package/build/routes-manifest.js +27 -0
- package/build/routes-manifest.js.map +1 -0
- package/build/sortRoutes.d.ts +4 -0
- package/build/sortRoutes.d.ts.map +1 -0
- package/build/sortRoutes.js +53 -0
- package/build/sortRoutes.js.map +1 -0
- package/build/static/getRootComponent.js +8 -4
- package/build/static/getRootComponent.js.map +1 -1
- package/build/static/html.js +19 -11
- package/build/static/html.js.map +1 -1
- package/build/static/renderStaticContent.d.ts.map +1 -1
- package/build/static/renderStaticContent.js +63 -30
- package/build/static/renderStaticContent.js.map +1 -1
- package/build/testing-library/context-stubs.js +14 -6
- package/build/testing-library/context-stubs.js.map +1 -1
- package/build/testing-library/expect.js +10 -5
- package/build/testing-library/expect.js.map +1 -1
- package/build/testing-library/index.js +41 -20
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mocks.js +6 -3
- package/build/testing-library/mocks.js.map +1 -1
- package/build/testing-library/require-context-ponyfill.js +14 -8
- package/build/testing-library/require-context-ponyfill.js.map +1 -1
- package/build/types.js +2 -1
- package/build/useDeprecated.js +11 -6
- package/build/useDeprecated.js.map +1 -1
- package/build/useFocusEffect.js +31 -4
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.js +20 -12
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.js +40 -31
- package/build/useScreens.js.map +1 -1
- package/build/utils/mockState.js +10 -5
- package/build/utils/mockState.js.map +1 -1
- package/build/utils/url.js +5 -1
- package/build/utils/url.js.map +1 -1
- package/build/views/EmptyRoute.js +14 -7
- package/build/views/EmptyRoute.js.map +1 -1
- package/build/views/ErrorBoundary.js +37 -30
- package/build/views/ErrorBoundary.js.map +1 -1
- package/build/views/Navigator.js +58 -26
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Pressable.js +5 -2
- package/build/views/Pressable.js.map +1 -1
- package/build/views/Screen.d.ts +1 -3
- package/build/views/Screen.d.ts.map +1 -1
- package/build/views/Screen.js +12 -18
- package/build/views/Screen.js.map +1 -1
- package/build/views/Sitemap.js +48 -40
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/Splash.js +41 -12
- package/build/views/Splash.js.map +1 -1
- package/build/views/SuspenseFallback.js +12 -5
- package/build/views/SuspenseFallback.js.map +1 -1
- package/build/views/Toast.js +33 -25
- package/build/views/Toast.js.map +1 -1
- package/build/views/Try.js +12 -5
- package/build/views/Try.js.map +1 -1
- package/build/views/Unmatched.js +30 -23
- package/build/views/Unmatched.js.map +1 -1
- package/package.json +7 -5
- package/server.d.ts +10 -0
- package/server.js +3 -0
- package/types/global.d.ts +14 -5
package/_ctx.android.js
CHANGED
package/_ctx.ios.js
CHANGED
package/_ctx.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export const ctx = require.context(
|
|
1
|
+
export const ctx = require.context(
|
|
2
|
+
process.env.EXPO_ROUTER_APP_ROOT,
|
|
3
|
+
true,
|
|
4
|
+
// Ignore root `./+html.js` and API route files `./generate+api.tsx`.
|
|
5
|
+
/^(?:\.\/)(?!(?:(?:(?:.*\+api)|(?:\+html)))\.[tj]sx?$).*\.[tj]sx?$/
|
|
6
|
+
);
|
package/_ctx.web.js
CHANGED
package/babel.js
CHANGED
|
@@ -122,29 +122,11 @@ function getExpoRouterAbsoluteAppRoot(projectRoot) {
|
|
|
122
122
|
|
|
123
123
|
module.exports = function (api) {
|
|
124
124
|
const { types: t } = api;
|
|
125
|
-
const getRelPath = (state) => './' + nodePath.relative(state.file.opts.root, state.filename);
|
|
126
125
|
|
|
127
126
|
const platform = api.caller((caller) => caller?.platform);
|
|
128
127
|
return {
|
|
129
128
|
name: 'expo-router',
|
|
130
129
|
visitor: {
|
|
131
|
-
// Add support for Node.js __filename
|
|
132
|
-
Identifier(path, state) {
|
|
133
|
-
if (path.node.name === '__filename') {
|
|
134
|
-
path.replaceWith(
|
|
135
|
-
t.stringLiteral(
|
|
136
|
-
// `/index.js` is the value used by Webpack.
|
|
137
|
-
getRelPath(state)
|
|
138
|
-
)
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
// Add support for Node.js `__dirname`.
|
|
142
|
-
// This static value comes from Webpack somewhere.
|
|
143
|
-
if (path.node.name === '__dirname') {
|
|
144
|
-
path.replaceWith(t.stringLiteral('/'));
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
|
|
148
130
|
// Convert `process.env.EXPO_ROUTER_APP_ROOT` to a string literal
|
|
149
131
|
MemberExpression(path, state) {
|
|
150
132
|
if (
|
package/build/ExpoRoot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,iBAAiB,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAMtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CACtD,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,iBAAiB,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAMtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CACtD,CAAC;AAgBF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,eAqBtF"}
|
package/build/ExpoRoot.js
CHANGED
|
@@ -1,68 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { useInitializeExpoRouter } from './global-state/router-store';
|
|
8
|
-
import { SplashScreen } from './views/Splash';
|
|
9
|
-
function getGestureHandlerRootView() {
|
|
10
|
-
try {
|
|
11
|
-
const { GestureHandlerRootView } = require('react-native-gesture-handler');
|
|
12
|
-
if (!GestureHandlerRootView) {
|
|
13
|
-
return React.Fragment;
|
|
14
|
-
}
|
|
15
|
-
// eslint-disable-next-line no-inner-declarations
|
|
16
|
-
function GestureHandler(props) {
|
|
17
|
-
return React.createElement(GestureHandlerRootView, { style: styles.gesture, ...props });
|
|
18
|
-
}
|
|
19
|
-
if (process.env.NODE_ENV === 'development') {
|
|
20
|
-
// @ts-expect-error
|
|
21
|
-
GestureHandler.displayName = 'GestureHandlerRootView';
|
|
22
|
-
}
|
|
23
|
-
return GestureHandler;
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return React.Fragment;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
7
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
27
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ExpoRoot = void 0;
|
|
30
|
+
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
31
|
+
const expo_status_bar_1 = require("expo-status-bar");
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const react_native_1 = require("react-native");
|
|
34
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
35
|
+
const NavigationContainer_1 = __importDefault(require("./fork/NavigationContainer"));
|
|
36
|
+
const router_store_1 = require("./global-state/router-store");
|
|
37
|
+
const Splash_1 = require("./views/Splash");
|
|
38
|
+
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
39
|
+
const INITIAL_METRICS = react_native_1.Platform.OS === 'web' || isTestEnv
|
|
40
|
+
? {
|
|
41
|
+
frame: { x: 0, y: 0, width: 0, height: 0 },
|
|
42
|
+
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
43
|
+
}
|
|
44
|
+
: undefined;
|
|
45
|
+
const hasViewControllerBasedStatusBarAppearance = react_native_1.Platform.OS === 'ios' &&
|
|
46
|
+
!!expo_constants_1.default.expoConfig?.ios?.infoPlist?.UIViewControllerBasedStatusBarAppearance;
|
|
47
|
+
function ExpoRoot({ wrapper: ParentWrapper = react_1.Fragment, ...props }) {
|
|
37
48
|
/*
|
|
38
49
|
* Due to static rendering we need to wrap these top level views in second wrapper
|
|
39
|
-
* View's like <
|
|
50
|
+
* View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper
|
|
40
51
|
* is a HTML document, we need to ensure its inside the <body>
|
|
41
52
|
*/
|
|
42
53
|
const wrapper = ({ children }) => {
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
return (react_1.default.createElement(ParentWrapper, null,
|
|
55
|
+
react_1.default.createElement(react_native_safe_area_context_1.SafeAreaProvider
|
|
56
|
+
// SSR support
|
|
57
|
+
, {
|
|
46
58
|
// SSR support
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children,
|
|
51
|
-
!hasViewControllerBasedStatusBarAppearance && React.createElement(StatusBar, { style: "auto" })))));
|
|
59
|
+
initialMetrics: INITIAL_METRICS },
|
|
60
|
+
children,
|
|
61
|
+
!hasViewControllerBasedStatusBarAppearance && react_1.default.createElement(expo_status_bar_1.StatusBar, { style: "auto" }))));
|
|
52
62
|
};
|
|
53
|
-
return
|
|
63
|
+
return react_1.default.createElement(ContextNavigator, { ...props, wrapper: wrapper });
|
|
54
64
|
}
|
|
55
|
-
|
|
65
|
+
exports.ExpoRoot = ExpoRoot;
|
|
66
|
+
const initialUrl = react_native_1.Platform.OS === 'web' && typeof window !== 'undefined'
|
|
56
67
|
? new URL(window.location.href)
|
|
57
68
|
: undefined;
|
|
58
|
-
function ContextNavigator({ context, location: initialLocation = initialUrl, wrapper: WrapperComponent = Fragment, }) {
|
|
59
|
-
const store = useInitializeExpoRouter(context, initialLocation);
|
|
69
|
+
function ContextNavigator({ context, location: initialLocation = initialUrl, wrapper: WrapperComponent = react_1.Fragment, }) {
|
|
70
|
+
const store = (0, router_store_1.useInitializeExpoRouter)(context, initialLocation);
|
|
60
71
|
if (store.shouldShowTutorial()) {
|
|
61
|
-
SplashScreen.hideAsync();
|
|
72
|
+
Splash_1.SplashScreen.hideAsync();
|
|
62
73
|
if (process.env.NODE_ENV === 'development') {
|
|
63
74
|
const Tutorial = require('./onboard/Tutorial').Tutorial;
|
|
64
|
-
return (
|
|
65
|
-
|
|
75
|
+
return (react_1.default.createElement(WrapperComponent, null,
|
|
76
|
+
react_1.default.createElement(Tutorial, null)));
|
|
66
77
|
}
|
|
67
78
|
else {
|
|
68
79
|
// Ensure tutorial styles are stripped in production.
|
|
@@ -70,13 +81,10 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
|
|
|
70
81
|
}
|
|
71
82
|
}
|
|
72
83
|
const Component = store.rootComponent;
|
|
73
|
-
return (
|
|
84
|
+
return (react_1.default.createElement(NavigationContainer_1.default, { ref: store.navigationRef, initialState: store.initialState, linking: store.linking, documentTitle: {
|
|
74
85
|
enabled: false,
|
|
75
86
|
} },
|
|
76
|
-
|
|
77
|
-
|
|
87
|
+
react_1.default.createElement(WrapperComponent, null,
|
|
88
|
+
react_1.default.createElement(Component, null))));
|
|
78
89
|
}
|
|
79
|
-
const styles = StyleSheet.create({
|
|
80
|
-
gesture: { flex: 1 },
|
|
81
|
-
});
|
|
82
90
|
//# sourceMappingURL=ExpoRoot.js.map
|
package/build/ExpoRoot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAuC;AACvC,qDAA4C;AAC5C,+CAAsE;AACtE,+CAAwC;AACxC,mFAAkE;AAElE,qFAAqE;AACrE,8DAAsE;AAEtE,2CAA8C;AAQ9C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAElD,MAAM,eAAe,GACnB,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,SAAS;IAChC,CAAC,CAAC;QACE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QAC1C,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;KACjD;IACH,CAAC,CAAC,SAAS,CAAC;AAEhB,MAAM,yCAAyC,GAC7C,uBAAQ,CAAC,EAAE,KAAK,KAAK;IACrB,CAAC,CAAC,wBAAS,CAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,wCAAwC,CAAC;AAEnF,SAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,gBAAQ,EAAE,GAAG,KAAK,EAAiB;IACrF;;;;OAIG;IACH,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC/B,OAAO,CACL,8BAAC,aAAa;YACZ,8BAAC,iDAAgB;YACf,cAAc;;gBAAd,cAAc;gBACd,cAAc,EAAE,eAAe;gBAC9B,QAAQ;gBAER,CAAC,yCAAyC,IAAI,8BAAC,2BAAS,IAAC,KAAK,EAAC,MAAM,GAAG,CACxD,CACL,CACjB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,8BAAC,gBAAgB,OAAK,KAAK,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AAC3D,CAAC;AArBD,4BAqBC;AAED,MAAM,UAAU,GACd,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW;IACpD,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC/B,CAAC,CAAC,SAAS,CAAC;AAEhB,SAAS,gBAAgB,CAAC,EACxB,OAAO,EACP,QAAQ,EAAE,eAAe,GAAG,UAAU,EACtC,OAAO,EAAE,gBAAgB,GAAG,gBAAQ,GACtB;IACd,MAAM,KAAK,GAAG,IAAA,sCAAuB,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAEhE,IAAI,KAAK,CAAC,kBAAkB,EAAE,EAAE;QAC9B,qBAAY,CAAC,SAAS,EAAE,CAAC;QACzB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;YAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC;YACxD,OAAO,CACL,8BAAC,gBAAgB;gBACf,8BAAC,QAAQ,OAAG,CACK,CACpB,CAAC;SACH;aAAM;YACL,qDAAqD;YACrD,OAAO,IAAI,CAAC;SACb;KACF;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC;IAEtC,OAAO,CACL,8BAAC,6BAA2B,IAC1B,GAAG,EAAE,KAAK,CAAC,aAAa,EACxB,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,aAAa,EAAE;YACb,OAAO,EAAE,KAAK;SACf;QACD,8BAAC,gBAAgB;YACf,8BAAC,SAAS,OAAG,CACI,CACS,CAC/B,CAAC;AACJ,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport { StatusBar } from 'expo-status-bar';\nimport React, { FunctionComponent, ReactNode, Fragment } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport UpstreamNavigationContainer from './fork/NavigationContainer';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { RequireContext } from './types';\nimport { SplashScreen } from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL;\n wrapper?: FunctionComponent<{ children: ReactNode }>;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst hasViewControllerBasedStatusBarAppearance =\n Platform.OS === 'ios' &&\n !!Constants.expoConfig?.ios?.infoPlist?.UIViewControllerBasedStatusBarAppearance;\n\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {children}\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <StatusBar style=\"auto\" />}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n}: ExpoRootProps) {\n const store = useInitializeExpoRouter(context, initialLocation);\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking}\n documentTitle={{\n enabled: false,\n }}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </UpstreamNavigationContainer>\n );\n}\n"]}
|
|
@@ -9,10 +9,10 @@ export type UrlObject = {
|
|
|
9
9
|
export declare function getRouteInfoFromState(getPathFromState: (state: State, asPath: boolean) => {
|
|
10
10
|
path: string;
|
|
11
11
|
params: any;
|
|
12
|
-
}, state: State): UrlObject;
|
|
12
|
+
}, state: State, basePath?: string): UrlObject;
|
|
13
13
|
export declare function getNormalizedStatePath({ path: statePath, params, }: {
|
|
14
14
|
path: string;
|
|
15
15
|
params: any;
|
|
16
|
-
}): Pick<UrlObject, 'segments' | 'params'>;
|
|
16
|
+
}, basePath?: string): Pick<UrlObject, 'segments' | 'params'>;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=LocationProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAClF,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,SAAS,CAUX;AAGD,wBAAgB,sBAAsB,CACpC,EACE,IAAI,EAAE,SAAS,EACf,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb,EACD,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CAgBxC"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNormalizedStatePath = exports.getRouteInfoFromState = void 0;
|
|
4
|
+
const getStateFromPath_1 = require("./fork/getStateFromPath");
|
|
5
|
+
function getRouteInfoFromState(getPathFromState, state, basePath) {
|
|
2
6
|
const { path } = getPathFromState(state, false);
|
|
3
7
|
const qualified = getPathFromState(state, true);
|
|
4
8
|
return {
|
|
5
9
|
// TODO: This may have a predefined origin attached in the future.
|
|
6
10
|
unstable_globalHref: path,
|
|
7
|
-
pathname: path.split('?')['0'],
|
|
8
|
-
...getNormalizedStatePath(qualified),
|
|
11
|
+
pathname: (0, getStateFromPath_1.stripBasePath)(path, basePath).split('?')['0'],
|
|
12
|
+
...getNormalizedStatePath(qualified, basePath),
|
|
9
13
|
};
|
|
10
14
|
}
|
|
15
|
+
exports.getRouteInfoFromState = getRouteInfoFromState;
|
|
11
16
|
// TODO: Split up getPathFromState to return all this info at once.
|
|
12
|
-
|
|
17
|
+
function getNormalizedStatePath({ path: statePath, params, }, basePath) {
|
|
13
18
|
const [pathname] = statePath.split('?');
|
|
14
19
|
return {
|
|
15
20
|
// Strip empty path at the start
|
|
16
|
-
segments: pathname.split('/').filter(Boolean).map(decodeURIComponent),
|
|
21
|
+
segments: (0, getStateFromPath_1.stripBasePath)(pathname, basePath).split('/').filter(Boolean).map(decodeURIComponent),
|
|
17
22
|
// TODO: This is not efficient, we should generate based on the state instead
|
|
18
23
|
// of converting to string then back to object
|
|
19
24
|
params: Object.entries(params).reduce((prev, [key, value]) => {
|
|
@@ -27,4 +32,5 @@ export function getNormalizedStatePath({ path: statePath, params, }) {
|
|
|
27
32
|
}, {}),
|
|
28
33
|
};
|
|
29
34
|
}
|
|
35
|
+
exports.getNormalizedStatePath = getNormalizedStatePath;
|
|
30
36
|
//# sourceMappingURL=LocationProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;;AACA,8DAAwD;AAWxD,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF,KAAY,EACZ,QAAiB;IAEjB,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO;QACL,kEAAkE;QAClE,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAA,gCAAa,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;QACvD,GAAG,sBAAsB,CAAC,SAAS,EAAE,QAAQ,CAAC;KAC/C,CAAC;AACJ,CAAC;AAdD,sDAcC;AAED,mEAAmE;AACnE,SAAgB,sBAAsB,CACpC,EACE,IAAI,EAAE,SAAS,EACf,MAAM,GAIP,EACD,QAAiB;IAEjB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,OAAO;QACL,gCAAgC;QAChC,QAAQ,EAAE,IAAA,gCAAa,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC9F,6EAA6E;QAC7E,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxB,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;aAC3C;iBAAM;gBACL,IAAI,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAe,CAAC,CAAC;aACjD;YACD,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAAkB,CAAC;KACvB,CAAC;AACJ,CAAC;AAzBD,wDAyBC","sourcesContent":["import type { State } from './fork/getPathFromState';\nimport { stripBasePath } from './fork/getStateFromPath';\n\ntype SearchParams = Record<string, string | string[]>;\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: SearchParams;\n segments: string[];\n};\n\nexport function getRouteInfoFromState(\n getPathFromState: (state: State, asPath: boolean) => { path: string; params: any },\n state: State,\n basePath?: string\n): UrlObject {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n\n return {\n // TODO: This may have a predefined origin attached in the future.\n unstable_globalHref: path,\n pathname: stripBasePath(path, basePath).split('?')['0'],\n ...getNormalizedStatePath(qualified, basePath),\n };\n}\n\n// TODO: Split up getPathFromState to return all this info at once.\nexport function getNormalizedStatePath(\n {\n path: statePath,\n params,\n }: {\n path: string;\n params: any;\n },\n basePath?: string\n): Pick<UrlObject, 'segments' | 'params'> {\n const [pathname] = statePath.split('?');\n return {\n // Strip empty path at the start\n segments: stripBasePath(pathname, basePath).split('/').filter(Boolean).map(decodeURIComponent),\n // TODO: This is not efficient, we should generate based on the state instead\n // of converting to string then back to object\n params: Object.entries(params).reduce((prev, [key, value]) => {\n if (Array.isArray(value)) {\n prev[key] = value.map(decodeURIComponent);\n } else {\n prev[key] = decodeURIComponent(value as string);\n }\n return prev;\n }, {} as SearchParams),\n };\n}\n"]}
|
package/build/Route.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import type { ErrorBoundaryProps } from './exports';
|
|
3
|
+
import { sortRoutesWithInitial, sortRoutes } from './sortRoutes';
|
|
3
4
|
export type DynamicConvention = {
|
|
4
5
|
name: string;
|
|
5
6
|
deep: boolean;
|
|
@@ -39,6 +40,5 @@ export declare function Route({ children, node }: {
|
|
|
39
40
|
children: ReactNode;
|
|
40
41
|
node: RouteNode;
|
|
41
42
|
}): JSX.Element;
|
|
42
|
-
export
|
|
43
|
-
export declare function sortRoutes(a: RouteNode, b: RouteNode): number;
|
|
43
|
+
export { sortRoutesWithInitial, sortRoutes };
|
|
44
44
|
//# sourceMappingURL=Route.d.ts.map
|
package/build/Route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IACnC,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;KAC5C,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,kEAAkE;IAClE,SAAS,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB;IACpB,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,kCAAkC;IAClC,OAAO,EAAE,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACpC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAQF,+DAA+D;AAC/D,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,eAEjF;AAED,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,CAAC"}
|
package/build/Route.js
CHANGED
|
@@ -1,68 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.sortRoutes = exports.sortRoutesWithInitial = exports.Route = exports.useContextKey = exports.useRouteNode = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const matchers_1 = require("./matchers");
|
|
29
|
+
const sortRoutes_1 = require("./sortRoutes");
|
|
30
|
+
Object.defineProperty(exports, "sortRoutesWithInitial", { enumerable: true, get: function () { return sortRoutes_1.sortRoutesWithInitial; } });
|
|
31
|
+
Object.defineProperty(exports, "sortRoutes", { enumerable: true, get: function () { return sortRoutes_1.sortRoutes; } });
|
|
32
|
+
const CurrentRouteContext = react_1.default.createContext(null);
|
|
4
33
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
34
|
CurrentRouteContext.displayName = 'RouteNode';
|
|
6
35
|
}
|
|
7
36
|
/** Return the RouteNode at the current contextual boundary. */
|
|
8
|
-
|
|
9
|
-
return useContext(CurrentRouteContext);
|
|
37
|
+
function useRouteNode() {
|
|
38
|
+
return (0, react_1.useContext)(CurrentRouteContext);
|
|
10
39
|
}
|
|
11
|
-
|
|
40
|
+
exports.useRouteNode = useRouteNode;
|
|
41
|
+
function useContextKey() {
|
|
12
42
|
const node = useRouteNode();
|
|
13
43
|
if (node == null) {
|
|
14
44
|
throw new Error('No filename found. This is likely a bug in expo-router.');
|
|
15
45
|
}
|
|
16
|
-
return getContextKey(node.contextKey);
|
|
46
|
+
return (0, matchers_1.getContextKey)(node.contextKey);
|
|
17
47
|
}
|
|
48
|
+
exports.useContextKey = useContextKey;
|
|
18
49
|
/** Provides the matching routes and filename to the children. */
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
export function sortRoutesWithInitial(initialRouteName) {
|
|
23
|
-
return (a, b) => {
|
|
24
|
-
if (initialRouteName) {
|
|
25
|
-
if (a.route === initialRouteName) {
|
|
26
|
-
return -1;
|
|
27
|
-
}
|
|
28
|
-
if (b.route === initialRouteName) {
|
|
29
|
-
return 1;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return sortRoutes(a, b);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export function sortRoutes(a, b) {
|
|
36
|
-
if (a.dynamic && !b.dynamic) {
|
|
37
|
-
return 1;
|
|
38
|
-
}
|
|
39
|
-
if (!a.dynamic && b.dynamic) {
|
|
40
|
-
return -1;
|
|
41
|
-
}
|
|
42
|
-
if (a.dynamic && b.dynamic) {
|
|
43
|
-
if (a.dynamic.length !== b.dynamic.length) {
|
|
44
|
-
return b.dynamic.length - a.dynamic.length;
|
|
45
|
-
}
|
|
46
|
-
for (let i = 0; i < a.dynamic.length; i++) {
|
|
47
|
-
const aDynamic = a.dynamic[i];
|
|
48
|
-
const bDynamic = b.dynamic[i];
|
|
49
|
-
if (aDynamic.deep && !bDynamic.deep) {
|
|
50
|
-
return 1;
|
|
51
|
-
}
|
|
52
|
-
if (!aDynamic.deep && bDynamic.deep) {
|
|
53
|
-
return -1;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
const aIndex = a.route === 'index' || matchGroupName(a.route) != null;
|
|
59
|
-
const bIndex = b.route === 'index' || matchGroupName(b.route) != null;
|
|
60
|
-
if (aIndex && !bIndex) {
|
|
61
|
-
return -1;
|
|
62
|
-
}
|
|
63
|
-
if (!aIndex && bIndex) {
|
|
64
|
-
return 1;
|
|
65
|
-
}
|
|
66
|
-
return a.route.length - b.route.length;
|
|
50
|
+
function Route({ children, node }) {
|
|
51
|
+
return react_1.default.createElement(CurrentRouteContext.Provider, { value: node }, children);
|
|
67
52
|
}
|
|
53
|
+
exports.Route = Route;
|
|
68
54
|
//# sourceMappingURL=Route.js.map
|
package/build/Route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAGrD,yCAA2C;AAC3C,6CAAiE;AAyDxD,sGAzDA,kCAAqB,OAyDA;AAAE,2FAzDA,uBAAU,OAyDA;AAxB1C,MAAM,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AAExE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;CAC/C;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAND,sCAMC;AAED,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAA4C;IAChF,OAAO,8BAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,IAAG,QAAQ,CAAgC,CAAC;AAC9F,CAAC;AAFD,sBAEC","sourcesContent":["import React, { ReactNode, useContext } from 'react';\n\nimport type { ErrorBoundaryProps } from './exports';\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\n\nexport type DynamicConvention = { name: string; deep: boolean };\n\nexport type LoadedRoute = {\n ErrorBoundary?: React.ComponentType<ErrorBoundaryProps>;\n default?: React.ComponentType<any>;\n unstable_settings?: Record<string, any>;\n getNavOptions?: (args: any) => any;\n generateStaticParams?: (props: {\n params?: Record<string, string | string[]>;\n }) => Record<string, string | string[]>[];\n};\n\nexport type RouteNode = {\n /** Load a route into memory. Returns the exports from a route. */\n loadRoute: () => Partial<LoadedRoute>;\n /** Loaded initial route name. */\n initialRouteName?: string;\n /** nested routes */\n children: RouteNode[];\n /** Is the route a dynamic path */\n dynamic: null | DynamicConvention[];\n /** `index`, `error-boundary`, etc. */\n route: string;\n /** Context Module ID, used for matching children. */\n contextKey: string;\n /** Added in-memory */\n generated?: boolean;\n /** Internal screens like the directory or the auto 404 should be marked as internal. */\n internal?: boolean;\n};\n\nconst CurrentRouteContext = React.createContext<RouteNode | null>(null);\n\nif (process.env.NODE_ENV !== 'production') {\n CurrentRouteContext.displayName = 'RouteNode';\n}\n\n/** Return the RouteNode at the current contextual boundary. */\nexport function useRouteNode(): RouteNode | null {\n return useContext(CurrentRouteContext);\n}\n\nexport function useContextKey(): string {\n const node = useRouteNode();\n if (node == null) {\n throw new Error('No filename found. This is likely a bug in expo-router.');\n }\n return getContextKey(node.contextKey);\n}\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({ children, node }: { children: ReactNode; node: RouteNode }) {\n return <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>;\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
|
package/build/exports.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Navigator, Slot } from './views/Navigator';
|
|
2
|
-
export { useRouter, useUnstableGlobalHref, usePathname, useGlobalSearchParams, useLocalSearchParams,
|
|
2
|
+
export { useRouter, useUnstableGlobalHref, usePathname, useGlobalSearchParams, useLocalSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from './hooks';
|
|
3
3
|
export { router } from './imperative-api';
|
|
4
4
|
export { Link, Redirect } from './link/Link';
|
|
5
5
|
export { withLayoutContext } from './layouts/withLayoutContext';
|
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,qBAAqB,EACrB,oBAAoB,EACpB,
|
|
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,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/build/exports.js
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFocusEffect = exports.useNavigation = exports.SplashScreen = exports.ErrorBoundary = exports.Unmatched = exports.ExpoRoot = exports.Slot = exports.Navigator = exports.withLayoutContext = exports.Redirect = exports.Link = exports.router = exports.useRootNavigationState = exports.useRootNavigation = exports.useSegments = exports.useLocalSearchParams = exports.useGlobalSearchParams = exports.usePathname = exports.useUnstableGlobalHref = exports.useRouter = void 0;
|
|
1
4
|
// Expo Router API
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const Navigator_1 = require("./views/Navigator");
|
|
6
|
+
Object.defineProperty(exports, "Navigator", { enumerable: true, get: function () { return Navigator_1.Navigator; } });
|
|
7
|
+
Object.defineProperty(exports, "Slot", { enumerable: true, get: function () { return Navigator_1.Slot; } });
|
|
8
|
+
var hooks_1 = require("./hooks");
|
|
9
|
+
Object.defineProperty(exports, "useRouter", { enumerable: true, get: function () { return hooks_1.useRouter; } });
|
|
10
|
+
Object.defineProperty(exports, "useUnstableGlobalHref", { enumerable: true, get: function () { return hooks_1.useUnstableGlobalHref; } });
|
|
11
|
+
Object.defineProperty(exports, "usePathname", { enumerable: true, get: function () { return hooks_1.usePathname; } });
|
|
12
|
+
Object.defineProperty(exports, "useGlobalSearchParams", { enumerable: true, get: function () { return hooks_1.useGlobalSearchParams; } });
|
|
13
|
+
Object.defineProperty(exports, "useLocalSearchParams", { enumerable: true, get: function () { return hooks_1.useLocalSearchParams; } });
|
|
14
|
+
Object.defineProperty(exports, "useSegments", { enumerable: true, get: function () { return hooks_1.useSegments; } });
|
|
15
|
+
Object.defineProperty(exports, "useRootNavigation", { enumerable: true, get: function () { return hooks_1.useRootNavigation; } });
|
|
16
|
+
Object.defineProperty(exports, "useRootNavigationState", { enumerable: true, get: function () { return hooks_1.useRootNavigationState; } });
|
|
17
|
+
var imperative_api_1 = require("./imperative-api");
|
|
18
|
+
Object.defineProperty(exports, "router", { enumerable: true, get: function () { return imperative_api_1.router; } });
|
|
19
|
+
var Link_1 = require("./link/Link");
|
|
20
|
+
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
|
|
21
|
+
Object.defineProperty(exports, "Redirect", { enumerable: true, get: function () { return Link_1.Redirect; } });
|
|
22
|
+
var withLayoutContext_1 = require("./layouts/withLayoutContext");
|
|
23
|
+
Object.defineProperty(exports, "withLayoutContext", { enumerable: true, get: function () { return withLayoutContext_1.withLayoutContext; } });
|
|
8
24
|
// Expo Router Views
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
25
|
+
var ExpoRoot_1 = require("./ExpoRoot");
|
|
26
|
+
Object.defineProperty(exports, "ExpoRoot", { enumerable: true, get: function () { return ExpoRoot_1.ExpoRoot; } });
|
|
27
|
+
var Unmatched_1 = require("./views/Unmatched");
|
|
28
|
+
Object.defineProperty(exports, "Unmatched", { enumerable: true, get: function () { return Unmatched_1.Unmatched; } });
|
|
29
|
+
var ErrorBoundary_1 = require("./views/ErrorBoundary");
|
|
30
|
+
Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorBoundary; } });
|
|
12
31
|
// Platform
|
|
13
|
-
|
|
32
|
+
var Splash_1 = require("./views/Splash");
|
|
33
|
+
Object.defineProperty(exports, "SplashScreen", { enumerable: true, get: function () { return Splash_1.SplashScreen; } });
|
|
14
34
|
// React Navigation
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
var useNavigation_1 = require("./useNavigation");
|
|
36
|
+
Object.defineProperty(exports, "useNavigation", { enumerable: true, get: function () { return useNavigation_1.useNavigation; } });
|
|
37
|
+
var useFocusEffect_1 = require("./useFocusEffect");
|
|
38
|
+
Object.defineProperty(exports, "useFocusEffect", { enumerable: true, get: function () { return useFocusEffect_1.useFocusEffect; } });
|
|
17
39
|
//# sourceMappingURL=exports.js.map
|
package/build/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;AAAA,kBAAkB;AAClB,iDAAoD;AAkB3C,0FAlBA,qBAAS,OAkBA;AAAE,qFAlBA,gBAAI,OAkBA;AAhBxB,iCASiB;AARf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAA0C;AAAjC,wGAAA,MAAM,OAAA;AAEf,oCAA6C;AAApC,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAEtB,WAAW;AACX,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router } from './imperative-api';\n\nexport { Link, Redirect } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\n\n// Platform\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect } from './useFocusEffect';\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
// We only need to fork on native to support any prefixes.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
const native_1 = require("@react-navigation/native");
|
|
5
|
+
exports.default = native_1.NavigationContainer;
|
|
4
6
|
//# sourceMappingURL=NavigationContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":";;AAAA,0DAA0D;AAC1D,qDAA+D;AAE/D,kBAAe,4BAAmB,CAAC","sourcesContent":["// We only need to fork on native to support any prefixes.\nimport { NavigationContainer } from '@react-navigation/native';\n\nexport default NavigationContainer;\n"]}
|