expo-router 4.1.0-canary-20250221-ef26fed → 5.0.0-sdk-52-router-patches
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +10 -2
- package/build/ExpoRoot.js.map +1 -1
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/getPathFromState-forks.d.ts.map +1 -1
- package/build/fork/getPathFromState-forks.js +0 -1
- package/build/fork/getPathFromState-forks.js.map +1 -1
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +2 -1
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/fork/getStateFromPath.d.ts.map +1 -1
- package/build/fork/getStateFromPath.js +4 -2
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +1 -2
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/fork/useBackButton.d.ts +1 -1
- package/build/fork/useBackButton.d.ts.map +1 -1
- package/build/fork/useBackButton.js.map +1 -1
- package/build/fork/useDocumentTitle.d.ts +1 -1
- package/build/fork/useDocumentTitle.d.ts.map +1 -1
- package/build/fork/useDocumentTitle.js.map +1 -1
- package/build/fork/useLinking.d.ts +1 -1
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js.map +1 -1
- package/build/getDevServer/index.native.d.ts.map +1 -1
- package/build/getDevServer/index.native.js +1 -1
- package/build/getDevServer/index.native.js.map +1 -1
- package/build/getLinkingConfig.d.ts +8 -2
- package/build/getLinkingConfig.d.ts.map +1 -1
- package/build/getLinkingConfig.js +10 -2
- package/build/getLinkingConfig.js.map +1 -1
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +7 -0
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +7 -25
- package/build/global-state/routing.js.map +1 -1
- package/build/head/ExpoHead.d.ts +1 -1
- package/build/head/ExpoHead.d.ts.map +1 -1
- package/build/head/ExpoHead.ios.d.ts.map +1 -1
- package/build/head/ExpoHead.ios.js +18 -3
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/head/ExpoHead.js +3 -3
- package/build/head/ExpoHead.js.map +1 -1
- package/build/layouts/DrawerClient.d.ts +18 -40
- package/build/layouts/DrawerClient.d.ts.map +1 -1
- package/build/layouts/StackClient.d.ts +37 -43
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +176 -5
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/TabsClient.d.ts +18 -40
- package/build/layouts/TabsClient.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +2 -2
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +8 -4
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts +1 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -1
- package/build/link/Link.js.map +1 -1
- package/build/link/useLinkHooks.d.ts +8 -0
- package/build/link/useLinkHooks.d.ts.map +1 -1
- package/build/link/useLinkHooks.js.map +1 -1
- package/build/rsc/router/client.js +1 -1
- package/build/rsc/router/client.js.map +1 -1
- package/build/rsc/router/host.d.ts +5 -5
- package/build/rsc/router/host.d.ts.map +1 -1
- package/build/rsc/router/host.js.map +1 -1
- package/build/testing-library/index.d.ts +1 -1
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mock-config.d.ts +7 -2
- package/build/testing-library/mock-config.d.ts.map +1 -1
- package/build/ui/TabContext.d.ts +29 -19
- package/build/ui/TabContext.d.ts.map +1 -1
- package/build/ui/TabRouter.d.ts +1 -0
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/Tabs.d.ts +39 -30
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js +12 -2
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js +6 -8
- package/build/ui/common.js.map +1 -1
- package/build/ui/useComponent.d.ts +1 -1
- package/build/ui/useComponent.d.ts.map +1 -1
- package/build/ui/useComponent.js.map +1 -1
- package/build/useNavigation.d.ts.map +1 -1
- package/build/useNavigation.js +3 -1
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.d.ts +6 -4
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +38 -47
- package/build/useScreens.js.map +1 -1
- package/build/views/Navigator.d.ts +3 -2
- package/build/views/Navigator.d.ts.map +1 -1
- package/build/views/Navigator.js +3 -2
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Try.d.ts +1 -1
- package/package.json +19 -16
- package/vendor/react-helmet-async/LICENSE +201 -0
- package/vendor/react-helmet-async/README.md +205 -0
- package/vendor/react-helmet-async/lib/Dispatcher.d.ts +23 -0
- package/vendor/react-helmet-async/lib/HelmetData.d.ts +26 -0
- package/vendor/react-helmet-async/lib/Provider.d.ts +17 -0
- package/vendor/react-helmet-async/lib/client.d.ts +3 -0
- package/vendor/react-helmet-async/lib/constants.d.ts +58 -0
- package/vendor/react-helmet-async/lib/index.d.ts +38 -0
- package/vendor/react-helmet-async/lib/index.esm.js +798 -0
- package/vendor/react-helmet-async/lib/index.js +829 -0
- package/vendor/react-helmet-async/lib/server.d.ts +44 -0
- package/vendor/react-helmet-async/lib/types.d.ts +85 -0
- package/vendor/react-helmet-async/lib/utils.d.ts +33 -0
- package/vendor/react-helmet-async/package_original.json +49 -0
- package/vendor/react-helmet-async/vendor.md +3 -0
package/build/useScreens.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.getSingularId = exports.routeToScreen = exports.screenOptionsFactory = exports.getQualifiedRouteComponent = exports.useSortedScreens = void 0;
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const Route_1 = require("./Route");
|
|
10
10
|
const import_mode_1 = __importDefault(require("./import-mode"));
|
|
@@ -20,7 +20,7 @@ function getSortedChildren(children, order, initialRouteName) {
|
|
|
20
20
|
}
|
|
21
21
|
const entries = [...children];
|
|
22
22
|
const ordered = order
|
|
23
|
-
.map(({ name, redirect, initialParams, listeners, options, getId }) => {
|
|
23
|
+
.map(({ name, redirect, initialParams, listeners, options, getId, dangerouslySingular: singular, }) => {
|
|
24
24
|
if (!entries.length) {
|
|
25
25
|
console.warn(`[Layout children]: Too many screens defined. Route "${name}" is extraneous.`);
|
|
26
26
|
return null;
|
|
@@ -41,6 +41,24 @@ function getSortedChildren(children, order, initialRouteName) {
|
|
|
41
41
|
}
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
+
if (getId) {
|
|
45
|
+
console.warn(`Deprecated: prop 'getId' on screen ${name} is deprecated. Please rename the prop to 'dangerouslySingular'`);
|
|
46
|
+
if (singular) {
|
|
47
|
+
console.warn(`Screen ${name} cannot use both getId and dangerouslySingular together.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (singular) {
|
|
51
|
+
// If singular is set, use it as the getId function.
|
|
52
|
+
if (typeof singular === 'string') {
|
|
53
|
+
getId = () => singular;
|
|
54
|
+
}
|
|
55
|
+
else if (typeof singular === 'function' && name) {
|
|
56
|
+
getId = (options) => singular(name, options.params || {});
|
|
57
|
+
}
|
|
58
|
+
else if (singular === true && name) {
|
|
59
|
+
getId = (options) => getSingularId(name, options);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
44
62
|
return {
|
|
45
63
|
route: match,
|
|
46
64
|
props: { initialParams, listeners, options, getId },
|
|
@@ -138,50 +156,6 @@ function getQualifiedRouteComponent(value) {
|
|
|
138
156
|
return QualifiedRoute;
|
|
139
157
|
}
|
|
140
158
|
exports.getQualifiedRouteComponent = getQualifiedRouteComponent;
|
|
141
|
-
/**
|
|
142
|
-
* @param getId Override that will be wrapped to remove __EXPO_ROUTER_key which is added by PUSH
|
|
143
|
-
* @returns a function which provides a screen id that matches the dynamic route name in params. */
|
|
144
|
-
function createGetIdForRoute(route, getId) {
|
|
145
|
-
const include = new Map();
|
|
146
|
-
if (route.dynamic) {
|
|
147
|
-
for (const segment of route.dynamic) {
|
|
148
|
-
include.set(segment.name, segment);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return (options = {}) => {
|
|
152
|
-
const { params = {} } = options;
|
|
153
|
-
if (params.__EXPO_ROUTER_key) {
|
|
154
|
-
const key = params.__EXPO_ROUTER_key;
|
|
155
|
-
delete params.__EXPO_ROUTER_key;
|
|
156
|
-
if (getId == null) {
|
|
157
|
-
return key;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (getId != null) {
|
|
161
|
-
return getId(options);
|
|
162
|
-
}
|
|
163
|
-
const segments = [];
|
|
164
|
-
for (const dynamic of include.values()) {
|
|
165
|
-
const value = params?.[dynamic.name];
|
|
166
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
167
|
-
// If we are an array with a value
|
|
168
|
-
segments.push(value.join('/'));
|
|
169
|
-
}
|
|
170
|
-
else if (value && !Array.isArray(value)) {
|
|
171
|
-
// If we have a value and not an empty array
|
|
172
|
-
segments.push(value);
|
|
173
|
-
}
|
|
174
|
-
else if (dynamic.deep) {
|
|
175
|
-
segments.push(`[...${dynamic.name}]`);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
segments.push(`[${dynamic.name}]`);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return segments.join('/') ?? route.contextKey;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
exports.createGetIdForRoute = createGetIdForRoute;
|
|
185
159
|
function screenOptionsFactory(route, options) {
|
|
186
160
|
return (args) => {
|
|
187
161
|
// Only eager load generated components
|
|
@@ -204,7 +178,24 @@ function screenOptionsFactory(route, options) {
|
|
|
204
178
|
}
|
|
205
179
|
exports.screenOptionsFactory = screenOptionsFactory;
|
|
206
180
|
function routeToScreen(route, { options, getId, ...props } = {}) {
|
|
207
|
-
return (<primitives_1.Screen {...props}
|
|
181
|
+
return (<primitives_1.Screen {...props} name={route.route} key={route.route} getId={getId} options={screenOptionsFactory(route, options)} getComponent={() => getQualifiedRouteComponent(route)}/>);
|
|
208
182
|
}
|
|
209
183
|
exports.routeToScreen = routeToScreen;
|
|
184
|
+
function getSingularId(name, options = {}) {
|
|
185
|
+
return name
|
|
186
|
+
.split('/')
|
|
187
|
+
.map((segment) => {
|
|
188
|
+
if (segment.startsWith('[...')) {
|
|
189
|
+
return options.params?.[segment.slice(4, -1)]?.join('/') || segment;
|
|
190
|
+
}
|
|
191
|
+
else if (segment.startsWith('[')) {
|
|
192
|
+
return options.params?.[segment.slice(1, -1)] || segment;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return segment;
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
.join('/');
|
|
199
|
+
}
|
|
200
|
+
exports.getSingularId = getSingularId;
|
|
210
201
|
//# sourceMappingURL=useScreens.js.map
|
package/build/useScreens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAUb,kDAA0B;AAE1B,mCAOiB;AACjB,gEAAoD;AACpD,6CAAsC;AACtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AA6BlC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,KAAqB,EACrB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM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BD,oDAwBC;AAED,SAAgB,aAAa,CAC3B,KAAgB,EAChB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,KAA2B,EAAE;IAEvD,OAAO,CACL,CAAC,mBAAM,CACL,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CACzC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAClB,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CACjB,OAAO,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAC9C,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,EACtD,CACH,CAAC;AACJ,CAAC;AAdD,sCAcC","sourcesContent":["'use client';\n\nimport type {\n EventMapBase,\n NavigationState,\n ParamListBase,\n RouteConfig,\n RouteProp,\n ScreenListeners,\n} from '@react-navigation/native';\nimport React from 'react';\n\nimport {\n DynamicConvention,\n LoadedRoute,\n Route,\n RouteNode,\n sortRoutesWithInitial,\n useRouteNode,\n} from './Route';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { Screen } from './primitives';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n TState extends NavigationState = NavigationState,\n TEventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are `redirect={true}`, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: Record<string, any>;\n options?:\n | TOptions\n | ((prop: { route: RouteProp<ParamListBase, string>; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners<TState, TEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<TState, TEventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> }) => string | undefined;\n};\n\nfunction getSortedChildren(\n children: RouteNode[],\n order?: ScreenProps[],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(({ name, redirect, initialParams, listeners, options, getId }) => {\n if (!entries.length) {\n console.warn(`[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`);\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n })\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(order: ScreenProps[]): React.ReactNode[] {\n const node = useRouteNode();\n\n const sorted = node?.children?.length\n ? getSortedChildren(node.children, order, node.initialRouteName)\n : [];\n return React.useMemo(\n () => sorted.map((value) => routeToScreen(value.route, value.props)),\n [sorted]\n );\n}\n\nfunction fromImport({ ErrorBoundary, ...component }: LoadedRoute) {\n if (ErrorBoundary) {\n return {\n default: React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n }),\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(res);\n }\n\n return res.then(fromImport);\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n } else {\n const res = value.loadRoute();\n const Component = fromImport(res).default as React.ComponentType<any>;\n ScreenComponent = React.forwardRef((props, ref) => {\n return <Component {...props} ref={ref} />;\n });\n }\n\n const getLoadable = (props: any, ref: any) => (\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...{\n ...props,\n ref,\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment: value.route,\n }}\n />\n </React.Suspense>\n );\n\n const QualifiedRoute = React.forwardRef(\n (\n {\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any,\n ref: any\n ) => {\n const loadable = getLoadable(props, ref);\n\n return (\n <Route node={value} route={route}>\n {loadable}\n </Route>\n );\n }\n );\n\n QualifiedRoute.displayName = `Route(${value.route})`;\n\n qualifiedStore.set(value, QualifiedRoute);\n return QualifiedRoute;\n}\n\n/**\n * @param getId Override that will be wrapped to remove __EXPO_ROUTER_key which is added by PUSH\n * @returns a function which provides a screen id that matches the dynamic route name in params. */\nexport function createGetIdForRoute(\n route: Pick<RouteNode, 'dynamic' | 'route' | 'contextKey' | 'children'>,\n getId: ScreenProps['getId']\n): ScreenProps['getId'] {\n const include = new Map<string, DynamicConvention>();\n\n if (route.dynamic) {\n for (const segment of route.dynamic) {\n include.set(segment.name, segment);\n }\n }\n\n return (options = {}) => {\n const { params = {} } = options;\n if (params.__EXPO_ROUTER_key) {\n const key = params.__EXPO_ROUTER_key;\n delete params.__EXPO_ROUTER_key;\n if (getId == null) {\n return key;\n }\n }\n\n if (getId != null) {\n return getId(options);\n }\n\n const segments: string[] = [];\n\n for (const dynamic of include.values()) {\n const value = params?.[dynamic.name];\n if (Array.isArray(value) && value.length > 0) {\n // If we are an array with a value\n segments.push(value.join('/'));\n } else if (value && !Array.isArray(value)) {\n // If we have a value and not an empty array\n segments.push(value);\n } else if (dynamic.deep) {\n segments.push(`[...${dynamic.name}]`);\n } else {\n segments.push(`[${dynamic.name}]`);\n }\n }\n\n return segments.join('/') ?? route.contextKey;\n };\n}\n\nexport function screenOptionsFactory(\n route: RouteNode,\n options?: ScreenProps['options']\n): RouteConfig<any, any, any, any, any, any>['options'] {\n return (args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult = typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.generated) {\n output.tabBarItemStyle = { display: 'none' };\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n };\n}\n\nexport function routeToScreen(\n route: RouteNode,\n { options, getId, ...props }: Partial<ScreenProps> = {}\n) {\n return (\n <Screen\n {...props}\n getId={createGetIdForRoute(route, getId)}\n name={route.route}\n key={route.route}\n options={screenOptionsFactory(route, options)}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAUb,kDAA0B;AAE1B,mCAA6F;AAC7F,gEAAoD;AACpD,6CAAsC;AAEtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AAmClC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,KAAqB,EACrB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;QAClB,OAAO,QAAQ;aACZ,IAAI,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CAAC;aAC7C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;KAC3C;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAE9B,MAAM,OAAO,GAAG,KAAK;SAClB,GAAG,CACF,CAAC,EACC,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,OAAO,EACP,KAAK,EACL,mBAAmB,EAAE,QAAQ,GAC9B,EAAE,EAAE;QACH,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,CAAC,IAAI,CACV,uDAAuD,IAAI,kBAAkB,CAC9E,CAAC;YACF,OAAO,IAAI,CAAC;SACb;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;QACtE,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,OAAO,CAAC,IAAI,CACV,sCAAsC,IAAI,8BAA8B,EACxE,QAAQ,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,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,EACtD,CACH,CAAC;AACJ,CAAC;AAdD,sCAcC;AAED,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAAwD,EAAE;IAE1D,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC9B,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC;SACrE;aAAM,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAClC,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;SAC1D;aAAM;YACL,OAAO,OAAO,CAAC;SAChB;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAhBD,sCAgBC","sourcesContent":["'use client';\n\nimport type {\n EventMapBase,\n NavigationState,\n ParamListBase,\n RouteConfig,\n RouteProp,\n ScreenListeners,\n} from '@react-navigation/native';\nimport React from 'react';\n\nimport { LoadedRoute, Route, RouteNode, sortRoutesWithInitial, useRouteNode } from './Route';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { Screen } from './primitives';\nimport { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n TState extends NavigationState = NavigationState,\n TEventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are `redirect={true}`, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: Record<string, any>;\n options?:\n | TOptions\n | ((prop: { route: RouteProp<ParamListBase, string>; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners<TState, TEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<TState, TEventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> }) => string | undefined;\n\n dangerouslySingular?: SingularOptions;\n};\n\nexport type SingularOptions =\n | boolean\n | ((name: string, params: UnknownOutputParams) => string | undefined);\n\nfunction getSortedChildren(\n children: RouteNode[],\n order?: ScreenProps[],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(\n ({\n name,\n redirect,\n initialParams,\n listeners,\n options,\n getId,\n dangerouslySingular: singular,\n }) => {\n if (!entries.length) {\n console.warn(\n `[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`\n );\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n if (getId) {\n console.warn(\n `Deprecated: prop 'getId' on screen ${name} is deprecated. Please rename the prop to 'dangerouslySingular'`\n );\n if (singular) {\n console.warn(\n `Screen ${name} cannot use both getId and dangerouslySingular together.`\n );\n }\n } else if (singular) {\n // If singular is set, use it as the getId function.\n if (typeof singular === 'string') {\n getId = () => singular;\n } else if (typeof singular === 'function' && name) {\n getId = (options) => singular(name, options.params || {});\n } else if (singular === true && name) {\n getId = (options) => getSingularId(name, options);\n }\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n }\n )\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(order: ScreenProps[]): React.ReactNode[] {\n const node = useRouteNode();\n\n const sorted = node?.children?.length\n ? getSortedChildren(node.children, order, node.initialRouteName)\n : [];\n return React.useMemo(\n () => sorted.map((value) => routeToScreen(value.route, value.props)),\n [sorted]\n );\n}\n\nfunction fromImport({ ErrorBoundary, ...component }: LoadedRoute) {\n if (ErrorBoundary) {\n return {\n default: React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n }),\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(res);\n }\n\n return res.then(fromImport);\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n } else {\n const res = value.loadRoute();\n const Component = fromImport(res).default as React.ComponentType<any>;\n ScreenComponent = React.forwardRef((props, ref) => {\n return <Component {...props} ref={ref} />;\n });\n }\n\n const getLoadable = (props: any, ref: any) => (\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...{\n ...props,\n ref,\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment: value.route,\n }}\n />\n </React.Suspense>\n );\n\n const QualifiedRoute = React.forwardRef(\n (\n {\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any,\n ref: any\n ) => {\n const loadable = getLoadable(props, ref);\n\n return (\n <Route node={value} route={route}>\n {loadable}\n </Route>\n );\n }\n );\n\n QualifiedRoute.displayName = `Route(${value.route})`;\n\n qualifiedStore.set(value, QualifiedRoute);\n return QualifiedRoute;\n}\n\nexport function screenOptionsFactory(\n route: RouteNode,\n options?: ScreenProps['options']\n): RouteConfig<any, any, any, any, any, any>['options'] {\n return (args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult = typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.generated) {\n output.tabBarItemStyle = { display: 'none' };\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n };\n}\n\nexport function routeToScreen(\n route: RouteNode,\n { options, getId, ...props }: Partial<ScreenProps> = {}\n) {\n return (\n <Screen\n {...props}\n name={route.route}\n key={route.route}\n getId={getId}\n options={screenOptionsFactory(route, options)}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(\n name: string,\n options: { params?: Record<string, any> | undefined } = {}\n) {\n return name\n .split('/')\n .map((segment) => {\n if (segment.startsWith('[...')) {\n return options.params?.[segment.slice(4, -1)]?.join('/') || segment;\n } else if (segment.startsWith('[')) {\n return options.params?.[segment.slice(1, -1)] || segment;\n } else {\n return segment;\n }\n })\n .join('/');\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RouterFactory,
|
|
1
|
+
import { RouterFactory, useNavigationBuilder } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { StackRouter } from '../layouts/StackClient';
|
|
3
4
|
export type NavigatorContextValue = ReturnType<typeof useNavigationBuilder> & {
|
|
4
5
|
contextKey: string;
|
|
5
6
|
router: RouterFactory<any, any, any>;
|
|
@@ -44,7 +45,7 @@ export declare function Slot(props: Omit<NavigatorProps<any>, 'children'>): Reac
|
|
|
44
45
|
/**
|
|
45
46
|
* Render the current navigator content.
|
|
46
47
|
*/
|
|
47
|
-
declare function NavigatorSlot():
|
|
48
|
+
declare function NavigatorSlot(): any;
|
|
48
49
|
/**
|
|
49
50
|
* The default navigator for the app when no root _layout is provided.
|
|
50
51
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigator.d.ts","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"Navigator.d.ts","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CA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= __importStar(require("react"));
|
|
|
31
31
|
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
32
32
|
const Screen_1 = require("./Screen");
|
|
33
33
|
const Route_1 = require("../Route");
|
|
34
|
+
const StackClient_1 = require("../layouts/StackClient");
|
|
34
35
|
const withLayoutContext_1 = require("../layouts/withLayoutContext");
|
|
35
36
|
const useScreens_1 = require("../useScreens");
|
|
36
37
|
exports.NavigatorContext = React.createContext(null);
|
|
@@ -50,7 +51,7 @@ function Navigator({ initialRouteName, screenOptions, children, router, routerOp
|
|
|
50
51
|
contextKey,
|
|
51
52
|
});
|
|
52
53
|
const sortedScreens = (0, useScreens_1.useSortedScreens)(screens ?? []);
|
|
53
|
-
router ||=
|
|
54
|
+
router ||= StackClient_1.StackRouter;
|
|
54
55
|
const navigation = (0, native_1.useNavigationBuilder)(router, {
|
|
55
56
|
// Used for getting the parent with navigation.getParent('/normalized/path')
|
|
56
57
|
...routerOptions,
|
|
@@ -90,7 +91,7 @@ function SlotNavigator(props) {
|
|
|
90
91
|
const { screens } = (0, withLayoutContext_1.useFilterScreenChildren)([], {
|
|
91
92
|
contextKey,
|
|
92
93
|
});
|
|
93
|
-
const { state, descriptors, NavigationContent } = (0, native_1.useNavigationBuilder)(
|
|
94
|
+
const { state, descriptors, NavigationContent } = (0, native_1.useNavigationBuilder)(StackClient_1.StackRouter, {
|
|
94
95
|
...props,
|
|
95
96
|
id: contextKey,
|
|
96
97
|
children: (0, useScreens_1.useSortedScreens)(screens ?? []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,
|
|
1
|
+
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,YAAY,CAAC;;;;;;;;;;;;;;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AO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;KACrC;IAED;;;OAGG;IACH,OAAO,CAAC,aAAa,CAAC,AAAD,EAAG,CAAC;AAC3B,CAAC;AAdD,oBAcC;AAED;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEvC,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC;AACtE,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,CACL,CAAC,6CAAY,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAC/B;MAAA,CAAC,aAAa,CAAC,AAAD,EAChB;IAAA,EAAE,6CAAY,CAAC,CAChB,CAAC;AACJ,CAAC;AAND,4CAMC;AAED,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;AAC/B,SAAS,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAE3C,wCAAwC;AACxC,SAAS,CAAC,MAAM,GAAG,eAAM,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n'use client';\n\nimport { RouterFactory, useNavigationBuilder } from '@react-navigation/native';\nimport * as React from 'react';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Screen } from './Screen';\nimport { useContextKey } from '../Route';\nimport { StackRouter } from '../layouts/StackClient';\nimport { useFilterScreenChildren } from '../layouts/withLayoutContext';\nimport { useSortedScreens } from '../useScreens';\n\nexport type NavigatorContextValue = ReturnType<typeof useNavigationBuilder> & {\n contextKey: string;\n router: RouterFactory<any, any, any>;\n};\n\nexport const NavigatorContext = React.createContext<NavigatorContextValue | null>(null);\n\nif (process.env.NODE_ENV !== 'production') {\n NavigatorContext.displayName = 'NavigatorContext';\n}\n\ntype UseNavigationBuilderRouter = Parameters<typeof useNavigationBuilder>[0];\ntype UseNavigationBuilderOptions = Parameters<typeof useNavigationBuilder>[1];\n\nexport type NavigatorProps<T extends UseNavigationBuilderRouter> = {\n initialRouteName?: UseNavigationBuilderOptions['initialRouteName'];\n screenOptions?: UseNavigationBuilderOptions['screenOptions'];\n children?: UseNavigationBuilderOptions['children'];\n router?: T;\n routerOptions?: Omit<Parameters<T>[0], 'initialRouteName'>;\n};\n\n/**\n * An unstyled custom navigator. Good for basic web layouts.\n *\n * @hidden\n */\nexport function Navigator<T extends UseNavigationBuilderRouter = typeof StackRouter>({\n initialRouteName,\n screenOptions,\n children,\n router,\n routerOptions,\n}: NavigatorProps<T>) {\n const contextKey = useContextKey();\n\n // A custom navigator can have a mix of Screen and other components (like a Slot inside a View)\n const { screens, children: nonScreenChildren } = useFilterScreenChildren(children, {\n isCustomNavigator: true,\n contextKey,\n });\n\n const sortedScreens = useSortedScreens(screens ?? []);\n\n router ||= StackRouter as unknown as T;\n\n const navigation = useNavigationBuilder(router, {\n // Used for getting the parent with navigation.getParent('/normalized/path')\n ...routerOptions,\n id: contextKey,\n children: sortedScreens || [<Screen key=\"default\" />],\n screenOptions,\n initialRouteName,\n });\n\n // useNavigationBuilder requires at least one screen to be defined otherwise it will throw.\n if (!sortedScreens.length) {\n console.warn(`Navigator at \"${contextKey}\" has no children.`);\n return null;\n }\n\n return (\n <NavigatorContext.Provider\n value={{\n ...navigation,\n contextKey,\n router,\n }}>\n {nonScreenChildren}\n </NavigatorContext.Provider>\n );\n}\n\n/**\n * @hidden\n */\nexport function useNavigatorContext() {\n const context = React.useContext(NavigatorContext);\n if (!context) {\n throw new Error('useNavigatorContext must be used within a <Navigator />');\n }\n return context;\n}\n\nfunction SlotNavigator(props: NavigatorProps<any>) {\n const contextKey = useContextKey();\n\n // Allows adding Screen components as children to configure routes.\n const { screens } = useFilterScreenChildren([], {\n contextKey,\n });\n\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n ...props,\n id: contextKey,\n children: useSortedScreens(screens ?? []),\n });\n\n return (\n <NavigationContent>{descriptors[state.routes[state.index].key].render()}</NavigationContent>\n );\n}\n\n/**\n * Renders the currently selected content.\n *\n * There are actually two different implementations of `<Slot/>`:\n * - Used inside a `_layout` as the `Navigator`\n * - Used inside a `Navigator` as the content\n *\n * Since a custom `Navigator` will set the `NavigatorContext.contextKey` to\n * the current `_layout`, you can use this to determine if you are inside\n * a custom navigator or not.\n */\nexport function Slot(props: Omit<NavigatorProps<any>, 'children'>) {\n const contextKey = useContextKey();\n const context = React.useContext(NavigatorContext);\n\n if (context?.contextKey !== contextKey) {\n // The _layout has changed since the last navigator\n return <SlotNavigator {...props} />;\n }\n\n /*\n * The user has defined a custom navigator\n * <Navigator><Slot /></Navigator>\n */\n return <NavigatorSlot />;\n}\n\n/**\n * Render the current navigator content.\n */\nfunction NavigatorSlot() {\n const context = useNavigatorContext();\n\n const { state, descriptors } = context;\n\n return descriptors[state.routes[state.index].key]?.render() ?? null;\n}\n\n/**\n * The default navigator for the app when no root _layout is provided.\n */\nexport function DefaultNavigator() {\n return (\n <SafeAreaView style={{ flex: 1 }}>\n <SlotNavigator />\n </SafeAreaView>\n );\n}\n\nNavigator.Slot = NavigatorSlot;\nNavigator.useContext = useNavigatorContext;\n\n/** Used to configure route settings. */\nNavigator.Screen = Screen;\n"]}
|
package/build/views/Try.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ export declare class Try extends Component<PropsWithChildren<{
|
|
|
18
18
|
error: Error;
|
|
19
19
|
} | null;
|
|
20
20
|
retry: () => Promise<void>;
|
|
21
|
-
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
21
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=Try.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-sdk-52-router-patches",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"link",
|
|
16
16
|
"assets",
|
|
17
17
|
"build",
|
|
18
|
+
"vendor",
|
|
18
19
|
"!src",
|
|
19
20
|
"_ctx-html.js",
|
|
20
21
|
"_ctx-shared.js",
|
|
@@ -74,10 +75,10 @@
|
|
|
74
75
|
"expo"
|
|
75
76
|
],
|
|
76
77
|
"peerDependencies": {
|
|
77
|
-
"@react-navigation/drawer": "^7.
|
|
78
|
-
"expo": "
|
|
79
|
-
"expo-constants": "
|
|
80
|
-
"expo-linking": "
|
|
78
|
+
"@react-navigation/drawer": "^7.2.1",
|
|
79
|
+
"expo": "*",
|
|
80
|
+
"expo-constants": "*",
|
|
81
|
+
"expo-linking": "*",
|
|
81
82
|
"react-native-reanimated": "*",
|
|
82
83
|
"react-native-safe-area-context": "*",
|
|
83
84
|
"react-native-screens": "*"
|
|
@@ -94,27 +95,29 @@
|
|
|
94
95
|
}
|
|
95
96
|
},
|
|
96
97
|
"devDependencies": {
|
|
97
|
-
"@react-navigation/drawer": "^7.
|
|
98
|
+
"@react-navigation/drawer": "^7.2.q",
|
|
98
99
|
"@testing-library/jest-native": "^5.4.2",
|
|
99
100
|
"@testing-library/react": "^15.0.7",
|
|
100
|
-
"@testing-library/react-native": "^
|
|
101
|
+
"@testing-library/react-native": "^13.1.0",
|
|
101
102
|
"immer": "^10.1.1",
|
|
102
103
|
"react-server-dom-webpack": "19.0.0-rc-6230622a1a-20240610",
|
|
103
104
|
"tsd": "^0.28.1"
|
|
104
105
|
},
|
|
105
106
|
"dependencies": {
|
|
106
|
-
"@expo/metro-runtime": "4.0.
|
|
107
|
-
"@expo/server": "0.5.
|
|
107
|
+
"@expo/metro-runtime": "4.0.0",
|
|
108
|
+
"@expo/server": "^0.5.0",
|
|
108
109
|
"@radix-ui/react-slot": "1.0.1",
|
|
109
|
-
"@react-navigation/bottom-tabs": "^7.
|
|
110
|
-
"@react-navigation/native": "^7.0.
|
|
111
|
-
"@react-navigation/native-stack": "^7.
|
|
110
|
+
"@react-navigation/bottom-tabs": "^7.3.0",
|
|
111
|
+
"@react-navigation/native": "^7.0.17",
|
|
112
|
+
"@react-navigation/native-stack": "^7.3.0",
|
|
112
113
|
"client-only": "^0.0.1",
|
|
113
|
-
"
|
|
114
|
-
"react-
|
|
114
|
+
"invariant": "^2.2.4",
|
|
115
|
+
"react-fast-compare": "^3.2.2",
|
|
115
116
|
"react-native-is-edge-to-edge": "^1.1.6",
|
|
116
117
|
"schema-utils": "^4.0.1",
|
|
117
118
|
"semver": "~7.6.3",
|
|
118
|
-
"server-only": "^0.0.1"
|
|
119
|
-
|
|
119
|
+
"server-only": "^0.0.1",
|
|
120
|
+
"shallowequal": "^1.1.0"
|
|
121
|
+
},
|
|
122
|
+
"gitHead": "f7172d210912fa1d5194ec33b826f04e24c835b1"
|
|
120
123
|
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2018 The New York Times Company
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|