expo-router 6.0.0-beta.1 → 6.0.0-beta.3
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/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +2 -0
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +7 -3
- package/build/global-state/routing.js.map +1 -1
- package/build/layouts/StackClient.d.ts +7 -7
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +27 -25
- package/build/layouts/StackClient.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +4 -1
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +16 -19
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +1 -1
- package/build/link/elements.js +1 -1
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/utils.d.ts.map +1 -1
- package/build/link/preview/utils.js +4 -2
- package/build/link/preview/utils.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +42 -6
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +6 -27
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -1
- package/build/navigationParams.d.ts +9 -0
- package/build/navigationParams.d.ts.map +1 -0
- package/build/navigationParams.js +67 -0
- package/build/navigationParams.js.map +1 -0
- package/build/testing-library/index.d.ts +15 -4
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js +31 -28
- package/build/testing-library/index.js.map +1 -1
- package/build/ui/Slot.d.ts +5 -1
- package/build/ui/Slot.d.ts.map +1 -1
- package/build/ui/Slot.js.map +1 -1
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js +1 -1
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.d.ts +2 -3
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js +1 -3
- package/build/ui/common.js.map +1 -1
- package/package.json +10 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPathFromState.d.ts","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAS,MAAM,2BAA2B,CAAC;AAItF,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"getPathFromState.d.ts","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAS,MAAM,2BAA2B,CAAC;AAItF,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5E,MAAM,MAAM,OAAO,CAAC,SAAS,SAAS,MAAM,IAAI,WAAW,GAAG;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AAGF,MAAM,MAAM,KAAK,GAAG,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;AAEnF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;AA4BrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,MAAM,EACvD,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAC3B,MAAM,CAER;AAED,wBAAgB,oBAAoB,CAAC,SAAS,SAAS,MAAM,EAC3D,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC;;;EA0P7B;AAsDD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,GAAG,SAAqC,UAQxD"}
|
|
@@ -38,6 +38,7 @@ exports.getPathDataFromState = getPathDataFromState;
|
|
|
38
38
|
exports.appendBaseUrl = appendBaseUrl;
|
|
39
39
|
const queryString = __importStar(require("query-string"));
|
|
40
40
|
const expo = __importStar(require("./getPathFromState-forks"));
|
|
41
|
+
const navigationParams_1 = require("../navigationParams");
|
|
41
42
|
// END FORK
|
|
42
43
|
const getActiveRoute = (state) => {
|
|
43
44
|
const route = typeof state.index === 'number'
|
|
@@ -269,6 +270,7 @@ function getPathDataFromState(state, options) {
|
|
|
269
270
|
}
|
|
270
271
|
// START FORK
|
|
271
272
|
delete focusedParams['#'];
|
|
273
|
+
focusedParams = (0, navigationParams_1.removeInternalExpoRouterParams)(focusedParams);
|
|
272
274
|
// END FORK
|
|
273
275
|
const query = queryString.stringify(focusedParams, { sort: false });
|
|
274
276
|
if (query) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,4CAKC;AAED,oDA2PC;AAsDD,sCAUC;AA1YD,0DAA4C;AAE5C,+DAAiD;AAqBjD,WAAW;AAE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AE,CAC9B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;IACxC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAE5C,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC,CACH,CAAC;AAEJ,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAA8B,OAAO,CAAC,GAAG,CAAC,aAAa;IAEvD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;QACrE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { PathConfig, PathConfigMap } from '@react-navigation/native';\nimport type { NavigationState, PartialState, Route } from '@react-navigation/routers';\nimport * as queryString from 'query-string';\n\nimport * as expo from './getPathFromState-forks';\nimport type { ExpoConfigItem, ExpoOptions } from './getPathFromState-forks';\n\n// START FORK\nexport type Options<ParamList extends object> = ExpoOptions & {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap<ParamList>;\n};\n// END FORK\n\nexport type State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;\n\nexport type StringifyConfig = Record<string, (value: any) => string>;\n\n// START FORK\ntype ConfigItem = ExpoConfigItem & {\n pattern?: string;\n stringify?: StringifyConfig;\n screens?: Record<string, ConfigItem>;\n};\n// END FORK\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n typeof state.index === 'number'\n ? state.routes[state.index]\n : state.routes[state.routes.length - 1];\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n return route;\n};\n\nlet cachedNormalizedConfigs: [PathConfigMap<object> | undefined, Record<string, ConfigItem>] = [\n undefined,\n {},\n];\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState<ParamList extends object>(\n state: State,\n options?: Options<ParamList>\n): string {\n return getPathDataFromState(state, options).path;\n}\n\nexport function getPathDataFromState<ParamList extends object>(\n state: State,\n options?: Options<ParamList>\n) {\n if (state == null) {\n throw Error(\"Got 'undefined' for the navigation state. You must pass a valid state object.\");\n }\n\n if (options) {\n // START FORK\n expo.validatePathConfig(options);\n // validatePathConfig(options);\n // END FORK\n }\n\n // Create a normalized configs object which will be easier to use\n if (cachedNormalizedConfigs[0] !== options?.screens) {\n cachedNormalizedConfigs = [\n options?.screens,\n options?.screens ? createNormalizedConfigs(options.screens) : {},\n ];\n }\n const configs: Record<string, ConfigItem> = cachedNormalizedConfigs[1];\n\n let path = '/';\n let current: State | undefined = state;\n\n const allParams: Record<string, any> = {};\n\n while (current) {\n let index = typeof current.index === 'number' ? current.index : 0;\n let route = current.routes[index] as Route<string> & {\n state?: State;\n };\n\n let pattern: string | undefined;\n\n let focusedParams: Record<string, any> | undefined;\n const focusedRoute = getActiveRoute(state);\n let currentOptions = configs;\n\n // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n const nestedRouteNames: string[] = [];\n\n let hasNext = true;\n\n while (route.name in currentOptions && hasNext) {\n pattern = currentOptions[route.name].pattern;\n\n nestedRouteNames.push(route.name);\n\n if (route.params) {\n const stringify = currentOptions[route.name]?.stringify;\n\n // START FORK\n // This mutates allParams\n const currentParams = expo.fixCurrentParams(allParams, route, stringify);\n\n // const currentParams = Object.fromEntries(\n // Object.entries(route.params).map(([key, value]) => [\n // key,\n // stringify?.[key] ? stringify[key](value) : String(value),\n // ])\n // );\n\n // if (pattern) {\n // Object.assign(allParams, currentParams);\n // }\n // END FORK\n\n if (focusedRoute === route) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = { ...currentParams };\n\n pattern\n ?.split('/')\n .filter((p) => expo.isDynamicPart(p))\n // eslint-disable-next-line no-loop-func\n .forEach((p) => {\n const name = expo.getParamName(p);\n\n // Remove the params present in the pattern since we'll only use the rest for query string\n if (focusedParams) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[name];\n }\n });\n }\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!currentOptions[route.name].screens || route.state === undefined) {\n // START FORK\n // Expo Router allows you to navigate to a (group) and not specify a target screen\n // This is different from React Navigation, which requires a target screen\n // We need to handle this case here, by selecting either the index screen or the first screen of the group\n\n // IMPORTANT: This does not affect groups that use _layout files with initialRouteNames\n // Layout files create a new route config. This only affects groups without layouts that have their screens\n // hoisted.\n\n // Example:\n // - /home/_layout\n // - /home/(a|b|c)/index --> Hoisted to /home/_layout navigator\n // - /home/(a|b|c)/other --> Hoisted to /home/_layout navigator\n // - /home/(profile)/me --> Hoisted to /home/_layout navigator\n //\n // route.push('/home/(a)') --> This should navigate to /home/(a)/index\n // route.push('/home/(profile)') --> This should navigate to /home/(profile)/me\n const screens = currentOptions[route.name].screens;\n\n // Determine what screen the user wants to navigate to. If no screen is specified, assume there is an index screen\n // In the examples above, this ensures that /home/(a) navigates to /home/(a)/index\n const targetScreen =\n // This is typed as unknown, so we need to add these extra assertions\n route.params && 'screen' in route.params && typeof route.params.screen === 'string'\n ? route.params.screen\n : 'index';\n\n // If the target screen is not in the screens object, default to the first screen\n // In the examples above, this ensures that /home/(profile) navigates to /home/(profile)/me\n // As there is no index screen in the group\n const screen = screens\n ? screens[targetScreen]\n ? targetScreen\n : Object.keys(screens)[0]\n : undefined;\n\n if (screen && screens && currentOptions[route.name].screens?.[screen]) {\n route = { ...screens[screen], name: screen, key: screen };\n currentOptions = screens;\n } else {\n hasNext = false;\n }\n // hasNext = false;\n // END FORK\n } else {\n index =\n typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedConfig = currentOptions[route.name].screens;\n\n // if there is config for next route name, we go deeper\n if (nestedConfig && nextRoute.name in nestedConfig) {\n route = nextRoute as Route<string> & { state?: State };\n currentOptions = nestedConfig;\n } else {\n // If not, there is no sense in going deeper in config\n hasNext = false;\n }\n }\n }\n\n if (pattern === undefined) {\n pattern = nestedRouteNames.join('/');\n }\n\n if (currentOptions[route.name] !== undefined) {\n // START FORK\n path += expo.getPathWithConventionsCollapsed({\n ...options,\n pattern,\n route,\n params: allParams,\n initialRouteName: configs[route.name]?.initialRouteName,\n });\n // path += pattern\n // .split('/')\n // .map((p) => {\n // const name = getParamName(p);\n\n // // We don't know what to show for wildcard patterns\n // // Showing the route name seems ok, though whatever we show here will be incorrect\n // // Since the page doesn't actually exist\n // if (p === '*') {\n // return route.name;\n // }\n\n // // If the path has a pattern for a param, put the param in the path\n // if (p.startsWith(':')) {\n // const value = allParams[name];\n\n // if (value === undefined && p.endsWith('?')) {\n // // Optional params without value assigned in route.params should be ignored\n // return '';\n // }\n\n // // Valid characters according to\n // // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n // return String(value).replace(/[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g, (char) =>\n // encodeURIComponent(char)\n // );\n // }\n\n // return encodeURIComponent(p);\n // })\n // .join('/');\n // } else {\n } else if (!route.name.startsWith('+')) {\n path += encodeURIComponent(route.name);\n }\n // END FORK\n\n if (!focusedParams) {\n focusedParams = focusedRoute.params;\n }\n\n if (route.state) {\n path += '/';\n } else if (focusedParams) {\n for (const param in focusedParams) {\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n // START FORK\n delete focusedParams['#'];\n // END FORK\n\n const query = queryString.stringify(focusedParams, { sort: false });\n if (query) {\n path += `?${query}`;\n }\n }\n\n current = route.state;\n }\n\n // Remove multiple as well as trailing slashes\n path = path.replace(/\\/+/g, '/');\n path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n // Include the root path if specified\n if (options?.path) {\n path = joinPaths(options.path, path);\n }\n\n // START FORK\n path = expo.appendBaseUrl(path);\n if (allParams['#']) {\n path += `#${allParams['#']}`;\n }\n // END FORK\n\n // START FORK\n return { path, params: allParams };\n // END FORK\n}\n\n// const getParamName = (pattern: string) => pattern.replace(/^:/, '').replace(/\\?$/, '');\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst createConfigItem = (\n config: PathConfig<object> | string,\n parentPattern?: string\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n return { pattern };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const pattern =\n config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;\n\n return {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern: pattern?.split('/').filter(Boolean).join('/'),\n stringify: config.stringify,\n screens,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap<object>,\n pattern?: string\n): Record<string, ConfigItem> =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => {\n const result = createConfigItem(c, pattern);\n\n return [name, result];\n })\n );\n\nexport function appendBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return `/${baseUrl.replace(/^\\/+/, '').replace(/\\/$/, '')}${path}`;\n }\n }\n return path;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,4CAKC;AAED,oDA4PC;AAsDD,sCAUC;AA5YD,0DAA4C;AAE5C,+DAAiD;AAEjD,0DAAqE;AAoBrE,WAAW;AAEX,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC7B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,IAAI,uBAAuB,GAAoE;IAC7F,SAAS;IACT,EAAE;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,gBAAgB,CAC9B,KAAY,EACZ,OAA4B;IAE5B,OAAO,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAY,EACZ,OAA4B;IAE5B,IAAI,KAAK,IAAI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PathConfigMap } from '@react-navigation/native';\nimport type { NavigationState, PartialState, Route } from '@react-navigation/routers';\nimport * as queryString from 'query-string';\n\nimport * as expo from './getPathFromState-forks';\nimport type { ExpoConfigItem, ExpoOptions } from './getPathFromState-forks';\nimport { removeInternalExpoRouterParams } from '../navigationParams';\n\n// START FORK\nexport type Options<ParamList extends object> = ExpoOptions & {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap<ParamList>;\n};\n// END FORK\n\nexport type State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;\n\nexport type StringifyConfig = Record<string, (value: any) => string>;\n\n// START FORK\ntype ConfigItem = ExpoConfigItem & {\n pattern?: string;\n stringify?: StringifyConfig;\n screens?: Record<string, ConfigItem>;\n};\n// END FORK\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n typeof state.index === 'number'\n ? state.routes[state.index]\n : state.routes[state.routes.length - 1];\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n return route;\n};\n\nlet cachedNormalizedConfigs: [PathConfigMap<object> | undefined, Record<string, ConfigItem>] = [\n undefined,\n {},\n];\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState<ParamList extends object>(\n state: State,\n options?: Options<ParamList>\n): string {\n return getPathDataFromState(state, options).path;\n}\n\nexport function getPathDataFromState<ParamList extends object>(\n state: State,\n options?: Options<ParamList>\n) {\n if (state == null) {\n throw Error(\"Got 'undefined' for the navigation state. You must pass a valid state object.\");\n }\n\n if (options) {\n // START FORK\n expo.validatePathConfig(options);\n // validatePathConfig(options);\n // END FORK\n }\n\n // Create a normalized configs object which will be easier to use\n if (cachedNormalizedConfigs[0] !== options?.screens) {\n cachedNormalizedConfigs = [\n options?.screens,\n options?.screens ? createNormalizedConfigs(options.screens) : {},\n ];\n }\n const configs: Record<string, ConfigItem> = cachedNormalizedConfigs[1];\n\n let path = '/';\n let current: State | undefined = state;\n\n const allParams: Record<string, any> = {};\n\n while (current) {\n let index = typeof current.index === 'number' ? current.index : 0;\n let route = current.routes[index] as Route<string> & {\n state?: State;\n };\n\n let pattern: string | undefined;\n\n let focusedParams: Record<string, any> | undefined;\n const focusedRoute = getActiveRoute(state);\n let currentOptions = configs;\n\n // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n const nestedRouteNames: string[] = [];\n\n let hasNext = true;\n\n while (route.name in currentOptions && hasNext) {\n pattern = currentOptions[route.name].pattern;\n\n nestedRouteNames.push(route.name);\n\n if (route.params) {\n const stringify = currentOptions[route.name]?.stringify;\n\n // START FORK\n // This mutates allParams\n const currentParams = expo.fixCurrentParams(allParams, route, stringify);\n\n // const currentParams = Object.fromEntries(\n // Object.entries(route.params).map(([key, value]) => [\n // key,\n // stringify?.[key] ? stringify[key](value) : String(value),\n // ])\n // );\n\n // if (pattern) {\n // Object.assign(allParams, currentParams);\n // }\n // END FORK\n\n if (focusedRoute === route) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = { ...currentParams };\n\n pattern\n ?.split('/')\n .filter((p) => expo.isDynamicPart(p))\n // eslint-disable-next-line no-loop-func\n .forEach((p) => {\n const name = expo.getParamName(p);\n\n // Remove the params present in the pattern since we'll only use the rest for query string\n if (focusedParams) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[name];\n }\n });\n }\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!currentOptions[route.name].screens || route.state === undefined) {\n // START FORK\n // Expo Router allows you to navigate to a (group) and not specify a target screen\n // This is different from React Navigation, which requires a target screen\n // We need to handle this case here, by selecting either the index screen or the first screen of the group\n\n // IMPORTANT: This does not affect groups that use _layout files with initialRouteNames\n // Layout files create a new route config. This only affects groups without layouts that have their screens\n // hoisted.\n\n // Example:\n // - /home/_layout\n // - /home/(a|b|c)/index --> Hoisted to /home/_layout navigator\n // - /home/(a|b|c)/other --> Hoisted to /home/_layout navigator\n // - /home/(profile)/me --> Hoisted to /home/_layout navigator\n //\n // route.push('/home/(a)') --> This should navigate to /home/(a)/index\n // route.push('/home/(profile)') --> This should navigate to /home/(profile)/me\n const screens = currentOptions[route.name].screens;\n\n // Determine what screen the user wants to navigate to. If no screen is specified, assume there is an index screen\n // In the examples above, this ensures that /home/(a) navigates to /home/(a)/index\n const targetScreen =\n // This is typed as unknown, so we need to add these extra assertions\n route.params && 'screen' in route.params && typeof route.params.screen === 'string'\n ? route.params.screen\n : 'index';\n\n // If the target screen is not in the screens object, default to the first screen\n // In the examples above, this ensures that /home/(profile) navigates to /home/(profile)/me\n // As there is no index screen in the group\n const screen = screens\n ? screens[targetScreen]\n ? targetScreen\n : Object.keys(screens)[0]\n : undefined;\n\n if (screen && screens && currentOptions[route.name].screens?.[screen]) {\n route = { ...screens[screen], name: screen, key: screen };\n currentOptions = screens;\n } else {\n hasNext = false;\n }\n // hasNext = false;\n // END FORK\n } else {\n index =\n typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedConfig = currentOptions[route.name].screens;\n\n // if there is config for next route name, we go deeper\n if (nestedConfig && nextRoute.name in nestedConfig) {\n route = nextRoute as Route<string> & { state?: State };\n currentOptions = nestedConfig;\n } else {\n // If not, there is no sense in going deeper in config\n hasNext = false;\n }\n }\n }\n\n if (pattern === undefined) {\n pattern = nestedRouteNames.join('/');\n }\n\n if (currentOptions[route.name] !== undefined) {\n // START FORK\n path += expo.getPathWithConventionsCollapsed({\n ...options,\n pattern,\n route,\n params: allParams,\n initialRouteName: configs[route.name]?.initialRouteName,\n });\n // path += pattern\n // .split('/')\n // .map((p) => {\n // const name = getParamName(p);\n\n // // We don't know what to show for wildcard patterns\n // // Showing the route name seems ok, though whatever we show here will be incorrect\n // // Since the page doesn't actually exist\n // if (p === '*') {\n // return route.name;\n // }\n\n // // If the path has a pattern for a param, put the param in the path\n // if (p.startsWith(':')) {\n // const value = allParams[name];\n\n // if (value === undefined && p.endsWith('?')) {\n // // Optional params without value assigned in route.params should be ignored\n // return '';\n // }\n\n // // Valid characters according to\n // // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n // return String(value).replace(/[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g, (char) =>\n // encodeURIComponent(char)\n // );\n // }\n\n // return encodeURIComponent(p);\n // })\n // .join('/');\n // } else {\n } else if (!route.name.startsWith('+')) {\n path += encodeURIComponent(route.name);\n }\n // END FORK\n\n if (!focusedParams) {\n focusedParams = focusedRoute.params;\n }\n\n if (route.state) {\n path += '/';\n } else if (focusedParams) {\n for (const param in focusedParams) {\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n // START FORK\n delete focusedParams['#'];\n focusedParams = removeInternalExpoRouterParams(focusedParams);\n // END FORK\n\n const query = queryString.stringify(focusedParams, { sort: false });\n if (query) {\n path += `?${query}`;\n }\n }\n\n current = route.state;\n }\n\n // Remove multiple as well as trailing slashes\n path = path.replace(/\\/+/g, '/');\n path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n // Include the root path if specified\n if (options?.path) {\n path = joinPaths(options.path, path);\n }\n\n // START FORK\n path = expo.appendBaseUrl(path);\n if (allParams['#']) {\n path += `#${allParams['#']}`;\n }\n // END FORK\n\n // START FORK\n return { path, params: allParams };\n // END FORK\n}\n\n// const getParamName = (pattern: string) => pattern.replace(/^:/, '').replace(/\\?$/, '');\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst createConfigItem = (\n config: PathConfig<object> | string,\n parentPattern?: string\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n return { pattern };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const pattern =\n config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;\n\n return {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern: pattern?.split('/').filter(Boolean).join('/'),\n stringify: config.stringify,\n screens,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap<object>,\n pattern?: string\n): Record<string, ConfigItem> =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => {\n const result = createConfigItem(c, pattern);\n\n return [name, result];\n })\n );\n\nexport function appendBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return `/${baseUrl.replace(/^\\/+/, '').replace(/\\/$/, '')}${path}`;\n }\n }\n return path;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,aAAa,EACd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvC,OAAO,EAAE,WAAW,EAAE,MAAM,0B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AED,wBAAgB,SAAS,IAAI,OAAO,CAenC;AAED,wBAAgB,UAAU,IAAI,OAAO,CAmBpC;AAED,wBAAgB,SAAS,CACvB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAM,OAO/E;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,eAAe,CAAC;IAEtC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,QA8DrE;AAmFD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,CAAC,uBAwB5E;AAKD,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,WAAW,EACzB,gBAAgB,EAAE,eAAe,EAEjC,kBAAkB,GAAE,OAAe;;;;;;;;;;;;;;;;;;;;;EA+CpC"}
|
|
@@ -57,6 +57,7 @@ const emitDomEvent_1 = require("../domComponents/emitDomEvent");
|
|
|
57
57
|
const getRoutesRedirects_1 = require("../getRoutesRedirects");
|
|
58
58
|
const href_1 = require("../link/href");
|
|
59
59
|
const matchers_1 = require("../matchers");
|
|
60
|
+
const navigationParams_1 = require("../navigationParams");
|
|
60
61
|
const url_1 = require("../utils/url");
|
|
61
62
|
function assertIsReady() {
|
|
62
63
|
if (!router_store_1.store.navigationRef.isReady()) {
|
|
@@ -254,10 +255,13 @@ function getNavigateAction(_actionState, _navigationState, type = 'NAVIGATE', wi
|
|
|
254
255
|
*/
|
|
255
256
|
rootPayload.params.initial = !withAnchor;
|
|
256
257
|
}
|
|
257
|
-
const
|
|
258
|
-
? {
|
|
258
|
+
const expoParams = isPreviewNavigation
|
|
259
|
+
? {
|
|
260
|
+
__internal__expo_router_is_preview_navigation: true,
|
|
261
|
+
__internal_expo_router_no_animation: true,
|
|
262
|
+
}
|
|
259
263
|
: {};
|
|
260
|
-
const params =
|
|
264
|
+
const params = (0, navigationParams_1.appendInternalExpoRouterParams)(rootPayload.params, expoParams);
|
|
261
265
|
return {
|
|
262
266
|
type,
|
|
263
267
|
target: navigationState.key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,4BAEC;AAED,wBAGC;AAED,4BAEC;AAED,oBAEC;AAED,0BAMC;AAED,8BAEC;AAED,0BAEC;AAED,gCAKC;AAED,wBAMC;AAED,8BAeC;AAED,gCAmBC;AAED,8BAQC;AA0BD,wBA8DC;AAoFD,4DAwBC;AAKD,gDAmDC;AAxZD,kCAAkC;AAClC,sDAAwC;AAExC,+CAAwC;AAExC,iDAAuC;AACvC,gEAMuC;AAEvC,8DAAuD;AACvD,uCAA0E;AAC1E,0CAA+C;AAG/C,sCAAoD;AAEpD,SAAS,aAAa;IACpB,IAAI,CAAC,oBAAK,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,gKAAgK,CACjK,CAAC;IACJ,CAAC;AACH,CAAC;AAEY,QAAA,YAAY,GAAG;IAC1B,KAAK,EAAE,EAAwB;IAC/B,WAAW,EAAE,IAAI,GAAG,EAAc;IAClC,SAAS,CAAC,QAAoB;QAC5B,oBAAY,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,OAAO,GAAG,EAAE;YACV,oBAAY,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC,CAAC;IACJ,CA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AC,WAAW;gBACV,wFAAwF;gBACxF,gBAAgB,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3F,IAAI,+BAA+B,EAAE,CAAC;YACpC,MAAM;QACR,CAAC;QAED,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,WAAW,GAAG,UAAU,CAAC;QACzB,eAAe,GAAG,mBAAsC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n NavigationAction,\n type NavigationState,\n PartialRoute,\n type PartialState,\n type NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/native';\nimport { IS_DOM } from 'expo/dom';\nimport * as Linking from 'expo-linking';\nimport { type RefObject } from 'react';\nimport { Platform } from 'react-native';\n\nimport { store } from './router-store';\nimport {\n emitDomDismiss,\n emitDomDismissAll,\n emitDomGoBack,\n emitDomLinkEvent,\n emitDomSetParams,\n} from '../domComponents/emitDomEvent';\nimport { ResultState } from '../fork/getStateFromPath';\nimport { applyRedirects } from '../getRoutesRedirects';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { matchDynamicName } from '../matchers';\nimport { Href } from '../types';\nimport { SingularOptions } from '../useScreens';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction assertIsReady() {\n if (!store.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n}\n\nexport const routingQueue = {\n queue: [] as NavigationAction[],\n subscribers: new Set<() => void>(),\n subscribe(callback: () => void) {\n routingQueue.subscribers.add(callback);\n return () => {\n routingQueue.subscribers.delete(callback);\n };\n },\n snapshot() {\n return routingQueue.queue;\n },\n add(action: NavigationAction) {\n routingQueue.queue.push(action);\n for (const callback of routingQueue.subscribers) {\n callback();\n }\n },\n run(ref: RefObject<NavigationContainerRef<ParamListBase> | null>) {\n // Reset the identity of the queue.\n const events = routingQueue.queue;\n routingQueue.queue = [];\n let action: NavigationAction | undefined;\n while ((action = events.shift())) {\n if (ref.current) {\n ref.current.dispatch(action);\n }\n }\n },\n};\n\nexport type NavigationOptions = Omit<LinkToOptions, 'event'>;\n\nexport function navigate(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'NAVIGATE' });\n}\n\nexport function reload() {\n // TODO(EvanBacon): add `reload` support.\n throw new Error('The reload method is not implemented in the client-side router yet.');\n}\n\nexport function prefetch(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'PRELOAD' });\n}\n\nexport function push(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'PUSH' });\n}\n\nexport function dismiss(count: number = 1) {\n if (emitDomDismiss(count)) {\n return;\n }\n\n routingQueue.add({ type: 'POP', payload: { count } });\n}\n\nexport function dismissTo(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'POP_TO' });\n}\n\nexport function replace(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'REPLACE' });\n}\n\nexport function dismissAll() {\n if (emitDomDismissAll()) {\n return;\n }\n routingQueue.add({ type: 'POP_TO_TOP' });\n}\n\nexport function goBack() {\n if (emitDomGoBack()) {\n return;\n }\n assertIsReady();\n routingQueue.add({ type: 'GO_BACK' });\n}\n\nexport function canGoBack(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canGoBack imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n // Return a default value here if the navigation hasn't mounted yet.\n // This can happen if the user calls `canGoBack` from the Root Layout route\n // before mounting a navigator. This behavior exists due to React Navigation being dynamically\n // constructed at runtime. We can get rid of this in the future if we use\n // the static configuration internally.\n if (!store.navigationRef.isReady()) {\n return false;\n }\n return store.navigationRef?.current?.canGoBack() ?? false;\n}\n\nexport function canDismiss(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canDismiss imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n let state = store.state;\n\n // Keep traversing down the state tree until we find a stack navigator that we can pop\n while (state) {\n if (state.type === 'stack' && state.routes.length > 1) {\n return true;\n }\n if (state.index === undefined) return false;\n\n state = state.routes?.[state.index]?.state as any;\n }\n\n return false;\n}\n\nexport function setParams(\n params: Record<string, undefined | string | number | (string | number)[]> = {}\n) {\n if (emitDomSetParams(params)) {\n return;\n }\n assertIsReady();\n return (store.navigationRef?.current?.setParams as any)(params);\n}\n\nexport type LinkToOptions = {\n event?: string;\n\n /**\n * Relative URL references are either relative to the directory or the document. By default, relative paths are relative to the document.\n * @see: [MDN's documentation on Resolving relative references to a URL](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Include the anchor when navigating to a new navigator\n */\n withAnchor?: boolean;\n\n /**\n * When navigating in a Stack, remove all screen from the history that match the singular condition\n *\n * If used with `push`, the history will be filtered even if no navigation occurs.\n */\n dangerouslySingular?: SingularOptions;\n\n __internal__PreviewKey?: string;\n};\n\nexport function linkTo(originalHref: Href, options: LinkToOptions = {}) {\n originalHref = typeof originalHref == 'string' ? originalHref : resolveHref(originalHref);\n let href: string | undefined | null = originalHref;\n\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n\n if (shouldLinkExternally(href)) {\n if (href.startsWith('//') && Platform.OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return;\n }\n\n assertIsReady();\n const navigationRef = store.navigationRef.current;\n\n if (navigationRef == null) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n if (!store.linking) {\n throw new Error('Attempted to link to route when no routes are present');\n }\n\n if (href === '..' || href === '../') {\n navigationRef.goBack();\n return;\n }\n\n const rootState = navigationRef.getRootState();\n\n href = resolveHrefStringWithSegments(href, store.getRouteInfo(), options);\n href = applyRedirects(href, store.redirects);\n\n // If the href is undefined, it means that the redirect has already been handled the navigation\n if (!href) {\n return;\n }\n\n const state = store.linking.getStateFromPath!(href, store.linking.config);\n\n if (!state || state.routes.length === 0) {\n console.error('Could not generate a valid navigation state for the given path: ' + href);\n return;\n }\n\n routingQueue.add(\n getNavigateAction(\n state,\n rootState,\n options.event,\n options.withAnchor,\n options.dangerouslySingular,\n !!options.__internal__PreviewKey\n )\n );\n}\n\nfunction getNavigateAction(\n _actionState: ResultState,\n _navigationState: NavigationState,\n type = 'NAVIGATE',\n withAnchor?: boolean,\n singular?: SingularOptions,\n isPreviewNavigation?: boolean\n) {\n /**\n * We need to find the deepest navigator where the action and current state diverge, If they do not diverge, the\n * lowest navigator is the target.\n *\n * By default React Navigation will target the current navigator, but this doesn't work for all actions\n * For example:\n * - /deeply/nested/route -> /top-level-route the target needs to be the top-level navigator\n * - /stack/nestedStack/page -> /stack1/nestedStack/other-page needs to target the nestedStack navigator\n *\n * This matching needs to done by comparing the route names and the dynamic path, for example\n * - /1/page -> /2/anotherPage needs to target the /[id] navigator\n *\n * Other parameters such as search params and hash are not evaluated.\n */\n\n const { actionStateRoute, navigationState } = findDivergentState(\n _actionState,\n _navigationState,\n type === 'PRELOAD'\n );\n\n /*\n * We found the target navigator, but the payload is in the incorrect format\n * We need to convert the action state to a payload that can be dispatched\n */\n const rootPayload = getPayloadFromStateRoute(actionStateRoute || {});\n\n if (type === 'PUSH' && navigationState.type !== 'stack') {\n type = 'NAVIGATE';\n } else if (navigationState.type === 'expo-tab') {\n type = 'JUMP_TO';\n } else if (type === 'REPLACE' && navigationState.type === 'drawer') {\n type = 'JUMP_TO';\n }\n\n if (withAnchor !== undefined) {\n if (rootPayload.params.initial) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`The parameter 'initial' is a reserved parameter name in React Navigation`);\n }\n }\n /*\n * The logic for initial can seen backwards depending on your perspective\n * True: The initialRouteName is not loaded. The incoming screen is the initial screen (default)\n * False: The initialRouteName is loaded. THe incoming screen is placed after the initialRouteName\n *\n * withAnchor flips the perspective.\n * True: You want the initialRouteName to load.\n * False: You do not want the initialRouteName to load.\n */\n rootPayload.params.initial = !withAnchor;\n }\n\n const previewKeyParams = isPreviewNavigation\n ? { __internal__expoRouterIsPreviewNavigation: isPreviewNavigation }\n : {};\n const params = { ...rootPayload.params, ...previewKeyParams };\n\n return {\n type,\n target: navigationState.key,\n payload: {\n // key: rootPayload.key,\n name: rootPayload.screen,\n params,\n singular,\n },\n };\n}\n\n/**\n * React Navigation uses params to store information about the screens, rather then create new state for each level.\n * This function traverses the action state that will not be part of state and returns a payload that can be used in action.\n */\nexport function getPayloadFromStateRoute(_actionStateRoute: PartialRoute<any>) {\n const rootPayload: Record<string, any> = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n let actionStateRoute: PartialRoute<any> | undefined = _actionStateRoute;\n\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n return rootPayload;\n}\n\n/*\n * Traverse the state tree comparing the current state and the action state until we find where they diverge\n */\nexport function findDivergentState(\n _actionState: ResultState,\n _navigationState: NavigationState,\n // If true, look through all tabs to find the target state, rather then just the current tab\n lookThroughAllTabs: boolean = false\n) {\n let actionState: PartialState<NavigationState> | undefined = _actionState;\n let navigationState: NavigationState | undefined = _navigationState;\n let actionStateRoute: PartialRoute<any> | undefined;\n const navigationRoutes = [];\n while (actionState && navigationState) {\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n const stateRoute = (() => {\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n return (\n navigationState.routes.find((route) => route.name === actionStateRoute?.name) ||\n navigationState.routes[navigationState.index ?? 0]\n );\n }\n return navigationState.routes[navigationState.index ?? 0];\n })();\n\n const childState: PartialState<NavigationState> | undefined = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName &&\n // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails\n actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]);\n\n if (didActionAndCurrentStateDiverge) {\n break;\n }\n\n navigationRoutes.push(stateRoute);\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n return {\n actionState,\n navigationState,\n actionStateRoute,\n navigationRoutes,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,4BAEC;AAED,wBAGC;AAED,4BAEC;AAED,oBAEC;AAED,0BAMC;AAED,8BAEC;AAED,0BAEC;AAED,gCAKC;AAED,wBAMC;AAED,8BAeC;AAED,gCAmBC;AAED,8BAQC;AA0BD,wBA8DC;AAuFD,4DAwBC;AAKD,gDAmDC;AA5ZD,kCAAkC;AAClC,sDAAwC;AAExC,+CAAwC;AAExC,iDAAuC;AACvC,gEAMuC;AAEvC,8DAAuD;AACvD,uCAA0E;AAC1E,0CAA+C;AAC/C,0DAAoG;AAGpG,sCAAoD;AAEpD,SAAS,aAAa;IACpB,IAAI,CAAC,oBAAK,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,gKAAgK,CACjK,CAAC;IACJ,CAAC;AACH,CAAC;AAEY,QAAA,YAAY,GAAG;IAC1B,KAA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8C,gBAAgB,CAAC,KAAK,CAAC;QACrF,MAAM,mBAAmB,GAAG,UAAU,CAAC,KAAK,CAAC;QAE7C,MAAM,WAAW,GAAG,IAAA,2BAAgB,EAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE5D,MAAM,+BAA+B,GACnC,gBAAgB,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;YACzC,CAAC,UAAU;YACX,CAAC,mBAAmB;YACpB,CAAC,WAAW;gBACV,wFAAwF;gBACxF,gBAAgB,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3F,IAAI,+BAA+B,EAAE,CAAC;YACpC,MAAM;QACR,CAAC;QAED,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,WAAW,GAAG,UAAU,CAAC;QACzB,eAAe,GAAG,mBAAsC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n NavigationAction,\n type NavigationState,\n PartialRoute,\n type PartialState,\n type NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/native';\nimport { IS_DOM } from 'expo/dom';\nimport * as Linking from 'expo-linking';\nimport { type RefObject } from 'react';\nimport { Platform } from 'react-native';\n\nimport { store } from './router-store';\nimport {\n emitDomDismiss,\n emitDomDismissAll,\n emitDomGoBack,\n emitDomLinkEvent,\n emitDomSetParams,\n} from '../domComponents/emitDomEvent';\nimport { ResultState } from '../fork/getStateFromPath';\nimport { applyRedirects } from '../getRoutesRedirects';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { matchDynamicName } from '../matchers';\nimport { appendInternalExpoRouterParams, type InternalExpoRouterParams } from '../navigationParams';\nimport { Href } from '../types';\nimport { SingularOptions } from '../useScreens';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction assertIsReady() {\n if (!store.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n}\n\nexport const routingQueue = {\n queue: [] as NavigationAction[],\n subscribers: new Set<() => void>(),\n subscribe(callback: () => void) {\n routingQueue.subscribers.add(callback);\n return () => {\n routingQueue.subscribers.delete(callback);\n };\n },\n snapshot() {\n return routingQueue.queue;\n },\n add(action: NavigationAction) {\n routingQueue.queue.push(action);\n for (const callback of routingQueue.subscribers) {\n callback();\n }\n },\n run(ref: RefObject<NavigationContainerRef<ParamListBase> | null>) {\n // Reset the identity of the queue.\n const events = routingQueue.queue;\n routingQueue.queue = [];\n let action: NavigationAction | undefined;\n while ((action = events.shift())) {\n if (ref.current) {\n ref.current.dispatch(action);\n }\n }\n },\n};\n\nexport type NavigationOptions = Omit<LinkToOptions, 'event'>;\n\nexport function navigate(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'NAVIGATE' });\n}\n\nexport function reload() {\n // TODO(EvanBacon): add `reload` support.\n throw new Error('The reload method is not implemented in the client-side router yet.');\n}\n\nexport function prefetch(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'PRELOAD' });\n}\n\nexport function push(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'PUSH' });\n}\n\nexport function dismiss(count: number = 1) {\n if (emitDomDismiss(count)) {\n return;\n }\n\n routingQueue.add({ type: 'POP', payload: { count } });\n}\n\nexport function dismissTo(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'POP_TO' });\n}\n\nexport function replace(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'REPLACE' });\n}\n\nexport function dismissAll() {\n if (emitDomDismissAll()) {\n return;\n }\n routingQueue.add({ type: 'POP_TO_TOP' });\n}\n\nexport function goBack() {\n if (emitDomGoBack()) {\n return;\n }\n assertIsReady();\n routingQueue.add({ type: 'GO_BACK' });\n}\n\nexport function canGoBack(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canGoBack imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n // Return a default value here if the navigation hasn't mounted yet.\n // This can happen if the user calls `canGoBack` from the Root Layout route\n // before mounting a navigator. This behavior exists due to React Navigation being dynamically\n // constructed at runtime. We can get rid of this in the future if we use\n // the static configuration internally.\n if (!store.navigationRef.isReady()) {\n return false;\n }\n return store.navigationRef?.current?.canGoBack() ?? false;\n}\n\nexport function canDismiss(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canDismiss imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n let state = store.state;\n\n // Keep traversing down the state tree until we find a stack navigator that we can pop\n while (state) {\n if (state.type === 'stack' && state.routes.length > 1) {\n return true;\n }\n if (state.index === undefined) return false;\n\n state = state.routes?.[state.index]?.state as any;\n }\n\n return false;\n}\n\nexport function setParams(\n params: Record<string, undefined | string | number | (string | number)[]> = {}\n) {\n if (emitDomSetParams(params)) {\n return;\n }\n assertIsReady();\n return (store.navigationRef?.current?.setParams as any)(params);\n}\n\nexport type LinkToOptions = {\n event?: string;\n\n /**\n * Relative URL references are either relative to the directory or the document. By default, relative paths are relative to the document.\n * @see: [MDN's documentation on Resolving relative references to a URL](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Include the anchor when navigating to a new navigator\n */\n withAnchor?: boolean;\n\n /**\n * When navigating in a Stack, remove all screen from the history that match the singular condition\n *\n * If used with `push`, the history will be filtered even if no navigation occurs.\n */\n dangerouslySingular?: SingularOptions;\n\n __internal__PreviewKey?: string;\n};\n\nexport function linkTo(originalHref: Href, options: LinkToOptions = {}) {\n originalHref = typeof originalHref == 'string' ? originalHref : resolveHref(originalHref);\n let href: string | undefined | null = originalHref;\n\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n\n if (shouldLinkExternally(href)) {\n if (href.startsWith('//') && Platform.OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return;\n }\n\n assertIsReady();\n const navigationRef = store.navigationRef.current;\n\n if (navigationRef == null) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n if (!store.linking) {\n throw new Error('Attempted to link to route when no routes are present');\n }\n\n if (href === '..' || href === '../') {\n navigationRef.goBack();\n return;\n }\n\n const rootState = navigationRef.getRootState();\n\n href = resolveHrefStringWithSegments(href, store.getRouteInfo(), options);\n href = applyRedirects(href, store.redirects);\n\n // If the href is undefined, it means that the redirect has already been handled the navigation\n if (!href) {\n return;\n }\n\n const state = store.linking.getStateFromPath!(href, store.linking.config);\n\n if (!state || state.routes.length === 0) {\n console.error('Could not generate a valid navigation state for the given path: ' + href);\n return;\n }\n\n routingQueue.add(\n getNavigateAction(\n state,\n rootState,\n options.event,\n options.withAnchor,\n options.dangerouslySingular,\n !!options.__internal__PreviewKey\n )\n );\n}\n\nfunction getNavigateAction(\n _actionState: ResultState,\n _navigationState: NavigationState,\n type = 'NAVIGATE',\n withAnchor?: boolean,\n singular?: SingularOptions,\n isPreviewNavigation?: boolean\n) {\n /**\n * We need to find the deepest navigator where the action and current state diverge, If they do not diverge, the\n * lowest navigator is the target.\n *\n * By default React Navigation will target the current navigator, but this doesn't work for all actions\n * For example:\n * - /deeply/nested/route -> /top-level-route the target needs to be the top-level navigator\n * - /stack/nestedStack/page -> /stack1/nestedStack/other-page needs to target the nestedStack navigator\n *\n * This matching needs to done by comparing the route names and the dynamic path, for example\n * - /1/page -> /2/anotherPage needs to target the /[id] navigator\n *\n * Other parameters such as search params and hash are not evaluated.\n */\n\n const { actionStateRoute, navigationState } = findDivergentState(\n _actionState,\n _navigationState,\n type === 'PRELOAD'\n );\n\n /*\n * We found the target navigator, but the payload is in the incorrect format\n * We need to convert the action state to a payload that can be dispatched\n */\n const rootPayload = getPayloadFromStateRoute(actionStateRoute || {});\n\n if (type === 'PUSH' && navigationState.type !== 'stack') {\n type = 'NAVIGATE';\n } else if (navigationState.type === 'expo-tab') {\n type = 'JUMP_TO';\n } else if (type === 'REPLACE' && navigationState.type === 'drawer') {\n type = 'JUMP_TO';\n }\n\n if (withAnchor !== undefined) {\n if (rootPayload.params.initial) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`The parameter 'initial' is a reserved parameter name in React Navigation`);\n }\n }\n /*\n * The logic for initial can seen backwards depending on your perspective\n * True: The initialRouteName is not loaded. The incoming screen is the initial screen (default)\n * False: The initialRouteName is loaded. THe incoming screen is placed after the initialRouteName\n *\n * withAnchor flips the perspective.\n * True: You want the initialRouteName to load.\n * False: You do not want the initialRouteName to load.\n */\n rootPayload.params.initial = !withAnchor;\n }\n\n const expoParams: InternalExpoRouterParams = isPreviewNavigation\n ? {\n __internal__expo_router_is_preview_navigation: true,\n __internal_expo_router_no_animation: true,\n }\n : {};\n const params = appendInternalExpoRouterParams(rootPayload.params, expoParams);\n\n return {\n type,\n target: navigationState.key,\n payload: {\n // key: rootPayload.key,\n name: rootPayload.screen,\n params,\n singular,\n },\n };\n}\n\n/**\n * React Navigation uses params to store information about the screens, rather then create new state for each level.\n * This function traverses the action state that will not be part of state and returns a payload that can be used in action.\n */\nexport function getPayloadFromStateRoute(_actionStateRoute: PartialRoute<any>) {\n const rootPayload: Record<string, any> = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n let actionStateRoute: PartialRoute<any> | undefined = _actionStateRoute;\n\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n return rootPayload;\n}\n\n/*\n * Traverse the state tree comparing the current state and the action state until we find where they diverge\n */\nexport function findDivergentState(\n _actionState: ResultState,\n _navigationState: NavigationState,\n // If true, look through all tabs to find the target state, rather then just the current tab\n lookThroughAllTabs: boolean = false\n) {\n let actionState: PartialState<NavigationState> | undefined = _actionState;\n let navigationState: NavigationState | undefined = _navigationState;\n let actionStateRoute: PartialRoute<any> | undefined;\n const navigationRoutes = [];\n while (actionState && navigationState) {\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n const stateRoute = (() => {\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n return (\n navigationState.routes.find((route) => route.name === actionStateRoute?.name) ||\n navigationState.routes[navigationState.index ?? 0]\n );\n }\n return navigationState.routes[navigationState.index ?? 0];\n })();\n\n const childState: PartialState<NavigationState> | undefined = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName &&\n // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails\n actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]);\n\n if (didActionAndCurrentStateDiverge) {\n break;\n }\n\n navigationRoutes.push(stateRoute);\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n return {\n actionState,\n navigationState,\n actionStateRoute,\n navigationRoutes,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParamListBase, StackRouter as RNStackRouter, StackNavigationState } from '@react-navigation/native';
|
|
1
|
+
import { ParamListBase, StackRouter as RNStackRouter, StackNavigationState, type RouteProp } from '@react-navigation/native';
|
|
2
2
|
import { NativeStackNavigationEventMap, NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
3
3
|
import { ComponentProps } from 'react';
|
|
4
4
|
import { Protected } from '../views/Protected';
|
|
@@ -45,7 +45,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
|
|
|
45
45
|
layout?: ((props: {
|
|
46
46
|
state: StackNavigationState<ParamListBase>;
|
|
47
47
|
navigation: import("@react-navigation/native").NavigationHelpers<ParamListBase, {}>;
|
|
48
|
-
descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>,
|
|
48
|
+
descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>, RouteProp<ParamListBase, string>>>;
|
|
49
49
|
children: React.ReactNode;
|
|
50
50
|
}) => React.ReactElement) | undefined;
|
|
51
51
|
screenListeners?: Partial<{
|
|
@@ -58,7 +58,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
|
|
|
58
58
|
state: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "state", unknown>;
|
|
59
59
|
beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
60
60
|
}> | ((props: {
|
|
61
|
-
route:
|
|
61
|
+
route: RouteProp<ParamListBase, string>;
|
|
62
62
|
navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
|
|
63
63
|
}) => Partial<{
|
|
64
64
|
transitionStart: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
@@ -71,7 +71,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
|
|
|
71
71
|
beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
72
72
|
}>) | undefined;
|
|
73
73
|
screenOptions?: NativeStackNavigationOptions | ((props: {
|
|
74
|
-
route:
|
|
74
|
+
route: RouteProp<ParamListBase, string>;
|
|
75
75
|
navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
|
|
76
76
|
theme: ReactNavigation.Theme;
|
|
77
77
|
}) => NativeStackNavigationOptions) | undefined;
|
|
@@ -89,7 +89,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
|
|
|
89
89
|
layout?: ((props: {
|
|
90
90
|
state: StackNavigationState<ParamListBase>;
|
|
91
91
|
navigation: import("@react-navigation/native").NavigationHelpers<ParamListBase, {}>;
|
|
92
|
-
descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>,
|
|
92
|
+
descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>, RouteProp<ParamListBase, string>>>;
|
|
93
93
|
children: React.ReactNode;
|
|
94
94
|
}) => React.ReactElement) | undefined;
|
|
95
95
|
screenListeners?: Partial<{
|
|
@@ -102,7 +102,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
|
|
|
102
102
|
state: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "state", unknown>;
|
|
103
103
|
beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
104
104
|
}> | ((props: {
|
|
105
|
-
route:
|
|
105
|
+
route: RouteProp<ParamListBase, string>;
|
|
106
106
|
navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
|
|
107
107
|
}) => Partial<{
|
|
108
108
|
transitionStart: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
@@ -115,7 +115,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
|
|
|
115
115
|
beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
116
116
|
}>) | undefined;
|
|
117
117
|
screenOptions?: NativeStackNavigationOptions | ((props: {
|
|
118
|
-
route:
|
|
118
|
+
route: RouteProp<ParamListBase, string>;
|
|
119
119
|
navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
|
|
120
120
|
theme: ReactNavigation.Theme;
|
|
121
121
|
}) => NativeStackNavigationOptions) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackClient.d.ts","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAKb,WAAW,IAAI,aAAa,EAE5B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"StackClient.d.ts","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAKb,WAAW,IAAI,aAAa,EAE5B,oBAAoB,EACpB,KAAK,SAAS,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,cAAc,EAAW,MAAM,OAAO,CAAC;AAOhD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/C;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,4BAA4B,GAAG;IAC1E,aAAa,CAAC,EAAE;QACd;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC5B;;;WAGG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC3B;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKU,CAAC;AA+BxB;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAqT9F,CAAC;AA8DF,QAAA,MAAM,KAAK,WACD,cAAc,CAAC,OAAO,OAAO,CAAC;YAcV,CACxB,KAAK,EAAE,cAAc,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAClE,IAAI;;CAGZ,CAAC;AAoCF,eAAe,KAAK,CAAC;AAErB,eAAO,MAAM,WAAW,EAAE,OAAO,aAMhC,CAAC"}
|
|
@@ -8,6 +8,7 @@ const react_1 = require("react");
|
|
|
8
8
|
const withLayoutContext_1 = require("./withLayoutContext");
|
|
9
9
|
const createNativeStackNavigator_1 = require("../fork/native-stack/createNativeStackNavigator");
|
|
10
10
|
const LinkPreviewContext_1 = require("../link/preview/LinkPreviewContext");
|
|
11
|
+
const navigationParams_1 = require("../navigationParams");
|
|
11
12
|
const useScreens_1 = require("../useScreens");
|
|
12
13
|
const Protected_1 = require("../views/Protected");
|
|
13
14
|
const NativeStackNavigator = (0, createNativeStackNavigator_1.createNativeStackNavigator)().Navigator;
|
|
@@ -22,10 +23,8 @@ function isStackAction(action) {
|
|
|
22
23
|
}
|
|
23
24
|
const isPreviewAction = (action) => !!action.payload &&
|
|
24
25
|
'params' in action.payload &&
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'__internal__expoRouterIsPreviewNavigation' in action.payload.params &&
|
|
28
|
-
!!action.payload.params.__internal__expoRouterIsPreviewNavigation;
|
|
26
|
+
typeof action.payload.params === 'object' &&
|
|
27
|
+
!!(0, navigationParams_1.getInternalExpoRouterParams)(action.payload?.params ?? undefined)['__internal__expo_router_is_preview_navigation'];
|
|
29
28
|
/**
|
|
30
29
|
* React Navigation matches a screen by its name or a 'getID' function that uniquely identifies a screen.
|
|
31
30
|
* When a screen has been uniquely identified, the Stack can only have one instance of that screen.
|
|
@@ -91,7 +90,7 @@ const stackRouterOverride = (original) => {
|
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
// START FORK
|
|
94
|
-
if (isPreviewAction(action)) {
|
|
93
|
+
if (isPreviewAction(action) && !route) {
|
|
95
94
|
route = state.preloadedRoutes.find((route) => route.name === action.payload.name && id === route.key);
|
|
96
95
|
}
|
|
97
96
|
// END FORK
|
|
@@ -344,38 +343,41 @@ function filterSingular(state, getId) {
|
|
|
344
343
|
const Stack = Object.assign((props) => {
|
|
345
344
|
const { isStackAnimationDisabled } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
|
|
346
345
|
const screenOptions = (0, react_1.useMemo)(() => {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
return props.screenOptions;
|
|
346
|
+
const condition = isStackAnimationDisabled ? () => true : shouldDisableAnimationBasedOnParams;
|
|
347
|
+
return disableAnimationInScreenOptions(props.screenOptions, condition);
|
|
351
348
|
}, [props.screenOptions, isStackAnimationDisabled]);
|
|
352
349
|
return (<RNStack {...props} screenOptions={screenOptions} UNSTABLE_router={exports.stackRouterOverride}/>);
|
|
353
350
|
}, {
|
|
354
351
|
Screen: RNStack.Screen,
|
|
355
352
|
Protected: Protected_1.Protected,
|
|
356
353
|
});
|
|
357
|
-
function disableAnimationInScreenOptions(options) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const oldResult = options(...args);
|
|
354
|
+
function disableAnimationInScreenOptions(options, condition) {
|
|
355
|
+
if (options && typeof options === 'function') {
|
|
356
|
+
return (props) => {
|
|
357
|
+
const oldOptions = options(props);
|
|
358
|
+
if (condition(props.route)) {
|
|
363
359
|
return {
|
|
364
|
-
...
|
|
365
|
-
animation:
|
|
360
|
+
...oldOptions,
|
|
361
|
+
animation: 'none',
|
|
366
362
|
};
|
|
367
|
-
}
|
|
368
|
-
return
|
|
369
|
-
}
|
|
370
|
-
return {
|
|
371
|
-
...options,
|
|
372
|
-
animation: animationNone,
|
|
363
|
+
}
|
|
364
|
+
return oldOptions ?? {};
|
|
373
365
|
};
|
|
374
366
|
}
|
|
375
|
-
return {
|
|
376
|
-
|
|
367
|
+
return (props) => {
|
|
368
|
+
if (condition(props.route)) {
|
|
369
|
+
return {
|
|
370
|
+
...(options ?? {}),
|
|
371
|
+
animation: 'none',
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
return options ?? {};
|
|
377
375
|
};
|
|
378
376
|
}
|
|
377
|
+
function shouldDisableAnimationBasedOnParams(route) {
|
|
378
|
+
const expoParams = (0, navigationParams_1.getInternalExpoRouterParams)(route.params);
|
|
379
|
+
return !!expoParams.__internal_expo_router_no_animation;
|
|
380
|
+
}
|
|
379
381
|
exports.default = Stack;
|
|
380
382
|
const StackRouter = (options) => {
|
|
381
383
|
const router = (0, native_1.StackRouter)(options);
|
|
@@ -1 +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G,MAAM;QACT,GAAG,IAAA,2BAAmB,EAAC,MAAM,CAAC;KAC/B,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB","sourcesContent":["'use client';\nimport {\n CommonNavigationAction,\n NavigationAction,\n ParamListBase,\n PartialRoute,\n PartialState,\n Route,\n RouterConfigOptions,\n StackRouter as RNStackRouter,\n StackActionType,\n StackNavigationState,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack';\nimport { nanoid } from 'nanoid/non-secure';\nimport { ComponentProps, useMemo } from 'react';\nimport { StackAnimationTypes } from 'react-native-screens';\n\nimport { withLayoutContext } from './withLayoutContext';\nimport { createNativeStackNavigator } from '../fork/native-stack/createNativeStackNavigator';\nimport { useLinkPreviewContext } from '../link/preview/LinkPreviewContext';\nimport { SingularOptions, getSingularId } from '../useScreens';\nimport { Protected } from '../views/Protected';\n\ntype GetId = NonNullable<RouterConfigOptions['routeGetIdList'][string]>;\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\n/**\n * We extend NativeStackNavigationOptions with our custom props\n * to allow for several extra props to be used on web, like modalWidth\n */\nexport type ExtendedStackNavigationOptions = NativeStackNavigationOptions & {\n webModalStyle?: {\n /**\n * Override the width of the modal (px or percentage). Only applies on web platform.\n * @platform web\n */\n width?: number | string;\n /**\n * Override the height of the modal (px or percentage). Applies on web desktop.\n * @platform web\n */\n height?: number | string;\n /**\n * Minimum height of the desktop modal (px or percentage). Overrides the default 640px clamp.\n * @platform web\n */\n minHeight?: number | string;\n /**\n * Minimum width of the desktop modal (px or percentage). Overrides the default 580px.\n * @platform web\n */\n minWidth?: number | string;\n /**\n * Override the border of the desktop modal (any valid CSS border value, e.g. '1px solid #ccc' or 'none').\n * @platform web\n */\n border?: string;\n /**\n * Override the overlay background color (any valid CSS color or rgba/hsla value).\n * @platform web\n */\n overlayBackground?: string;\n };\n};\n\nconst RNStack = withLayoutContext<\n ExtendedStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState<ParamListBase>,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\ntype RNNavigationAction = Extract<CommonNavigationAction, { type: 'NAVIGATE' }>;\ntype RNPreloadAction = Extract<CommonNavigationAction, { type: 'PRELOAD' }>;\ntype ExpoNavigationAction = Omit<RNNavigationAction, 'payload'> & {\n payload: Omit<RNNavigationAction['payload'], 'params'> & {\n params: {\n __internal__expoRouterIsPreviewNavigation?: boolean;\n params?: Record<string, unknown>;\n };\n };\n};\n\nfunction isStackAction(\n action: NavigationAction\n): action is StackActionType | RNPreloadAction | ExpoNavigationAction {\n return (\n action.type === 'PUSH' ||\n action.type === 'NAVIGATE' ||\n action.type === 'POP' ||\n action.type === 'POP_TO_TOP' ||\n action.type === 'REPLACE' ||\n action.type === 'PRELOAD'\n );\n}\n\nconst isPreviewAction = (action: NavigationAction): action is ExpoNavigationAction =>\n !!action.payload &&\n 'params' in action.payload &&\n !!action.payload.params &&\n typeof action.payload === 'object' &&\n '__internal__expoRouterIsPreviewNavigation' in (action.payload.params as any) &&\n !!(action.payload.params as any).__internal__expoRouterIsPreviewNavigation;\n\n/**\n * React Navigation matches a screen by its name or a 'getID' function that uniquely identifies a screen.\n * When a screen has been uniquely identified, the Stack can only have one instance of that screen.\n *\n * Expo Router allows for a screen to be matched by name and path params, a 'getID' function or a singular id.\n *\n * Instead of reimplementing the entire StackRouter, we can override the getStateForAction method to handle the singular screen logic.\n *\n */\nexport const stackRouterOverride: NonNullable<ComponentProps<typeof RNStack>['UNSTABLE_router']> = (\n original\n) => {\n return {\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if (!isStackAction(action)) {\n return original.getStateForAction(state, action, options);\n }\n\n // The dynamic getId added to an action, `router.push('screen', { singular: true })`\n const actionSingularOptions =\n action.payload && 'singular' in action.payload\n ? (action.payload.singular as SingularOptions)\n : undefined;\n\n // Handle if 'getID' or 'singular' is set.\n function getIdFunction(): GetId | undefined {\n // Actions can be fired by the user, so we do need to validate their structure.\n if (\n !('payload' in action) ||\n !action.payload ||\n !('name' in action.payload) ||\n typeof action.payload.name !== 'string'\n ) {\n return;\n }\n\n const actionName = action.payload.name;\n\n return (\n // The dynamic singular added to an action, `router.push('screen', { singular: () => 'id' })`\n getActionSingularIdFn(actionSingularOptions, actionName) ||\n // The static getId added as a prop to `<Screen singular />` or `<Screen getId={} />`\n options.routeGetIdList[actionName]\n );\n }\n\n const { routeParamList } = options;\n\n switch (action.type) {\n case 'PUSH':\n case 'NAVIGATE': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n // START FORK\n const getId = getIdFunction();\n // const getId = options.routeGetIdList[action.payload.name];\n // END FORK\n const id = getId?.({ params: action.payload.params });\n\n let route: Route<string> | undefined;\n\n if (id !== undefined) {\n route = state.routes.findLast(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (action.type === 'NAVIGATE') {\n const currentRoute = state.routes[state.index];\n\n // If the route matches the current one, then navigate to it\n if (action.payload.name === currentRoute.name) {\n route = currentRoute;\n } else if (action.payload.pop) {\n route = state.routes.findLast((route) => route.name === action.payload.name);\n }\n }\n\n // START FORK\n if (isPreviewAction(action)) {\n route = state.preloadedRoutes.find(\n (route) => route.name === action.payload.name && id === route.key\n );\n }\n // END FORK\n\n if (!route) {\n route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n let params;\n\n if (action.type === 'NAVIGATE' && action.payload.merge && route) {\n params =\n action.payload.params !== undefined ||\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n }\n\n let routes: Route<string>[];\n\n if (route) {\n if (action.type === 'NAVIGATE' && action.payload.pop) {\n routes = [];\n\n // Get all routes until the matching one\n for (const r of state.routes) {\n if (r.key === route.key) {\n routes.push({\n ...route,\n path: action.payload.path !== undefined ? action.payload.path : route.path,\n params,\n });\n break;\n }\n\n routes.push(r);\n }\n } else {\n // START FORK\n // If there is an id, then filter out the existing route with the same id.\n // THIS ACTION IS DANGEROUS. This can cause React Native Screens to freeze\n if (id !== undefined) {\n routes = state.routes.filter((r) => r.key !== route.key);\n } else if (action.type === 'NAVIGATE' && state.routes.length > 0) {\n // The navigation action should only replace the last route if it has the same name and path params.\n const lastRoute = state.routes[state.routes.length - 1];\n if (\n getSingularId(lastRoute.name, { params: lastRoute.params }) ===\n getSingularId(route.name, { params })\n ) {\n routes = state.routes.slice(0, -1);\n } else {\n routes = [...state.routes];\n }\n } else {\n routes = [...state.routes];\n }\n\n // If the routes length is the same as the state routes length, then we are navigating to a new route.\n // Otherwise we are replacing an existing route.\n const key =\n routes.length === state.routes.length && !isPreviewAction(action)\n ? `${action.payload.name}-${nanoid()}`\n : route.key;\n\n routes.push({\n ...route,\n key,\n path:\n action.type === 'NAVIGATE' && action.payload.path !== undefined\n ? action.payload.path\n : route.path,\n params,\n });\n\n // routes = state.routes.filter((r) => r.key !== route.key);\n // routes.push({\n // ...route,\n // path:\n // action.type === 'NAVIGATE' && action.payload.path !== undefined\n // ? action.payload.path\n // : route.path,\n // params,\n // });\n // END FORK\n }\n } else {\n routes = [\n ...state.routes,\n {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n path: action.type === 'NAVIGATE' ? action.payload.path : undefined,\n params,\n },\n ];\n }\n\n // START FORK\n // return filterSingular(\n const result = {\n ...state,\n index: routes.length - 1,\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => routes[routes.length - 1].key !== route.key\n ),\n routes,\n };\n\n if (actionSingularOptions) {\n return filterSingular(result, getId);\n }\n\n return result;\n // return {\n // ...state,\n // index: routes.length - 1,\n // preloadedRoutes: state.preloadedRoutes.filter(\n // (route) => routes[routes.length - 1].key !== route.key\n // ),\n // routes,\n // };\n // END FORK\n }\n case 'PRELOAD': {\n // START FORK\n // This will be the case for example for protected route\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n // END FORK\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route<string> | undefined;\n\n if (id !== undefined) {\n route = state.routes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n if (route) {\n return {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route?.key) {\n return r;\n }\n return {\n ...r,\n params:\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params,\n };\n }),\n };\n } else {\n // START FORK\n const currentPreloadedRoute: (typeof state)['preloadedRoutes'][number] = {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n params:\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params,\n };\n // END FORK\n return {\n ...state,\n // START FORK\n // Adding the current preloaded route to the beginning of the preloadedRoutes array\n // This ensures that the preloaded route will be the next one after the visible route\n // and when navigation will happen, there will be no reshuffling\n // This is a workaround for the link preview navigation issue, when screen would freeze after navigation from native side\n // and reshuffling from react-navigation\n preloadedRoutes: [currentPreloadedRoute].concat(\n state.preloadedRoutes.filter(\n (r) => r.name !== action.payload.name || id !== getId?.({ params: r.params })\n )\n ),\n // preloadedRoutes: state.preloadedRoutes\n // .filter(\n // (r) =>\n // r.name !== action.payload.name ||\n // id !== getId?.({ params: r.params })\n // )\n // .concat({\n // key: `${action.payload.name}-${nanoid()}`,\n // name: action.payload.name,\n // params:\n // routeParamList[action.payload.name] !== undefined\n // ? {\n // ...routeParamList[action.payload.name],\n // ...action.payload.params,\n // }\n // : action.payload.params,\n // }),\n // END FORK\n };\n }\n }\n default: {\n return original.getStateForAction(state, action, options);\n }\n }\n },\n };\n};\n\nfunction getActionSingularIdFn(\n actionGetId: SingularOptions | undefined,\n name: string\n): GetId | undefined {\n if (typeof actionGetId === 'function') {\n return (options) => actionGetId(name, options.params ?? {});\n } else if (actionGetId === true) {\n return (options) => getSingularId(name, options);\n }\n\n return undefined;\n}\n\n/**\n * If there is a dynamic singular on an action, then we need to filter the state to only have singular screens.\n * As multiples may have been added before we did the singular navigation.\n */\nfunction filterSingular<\n T extends\n | StackNavigationState<ParamListBase>\n | PartialState<StackNavigationState<ParamListBase>>\n | null,\n>(state: T, getId?: GetId): T {\n if (!state) {\n return state;\n }\n\n if (!state.routes) {\n return state;\n }\n\n const currentIndex = state.index || state.routes.length - 1;\n const current = state.routes[currentIndex];\n const name = current.name;\n\n const id = getId?.({ params: current.params });\n\n if (!id) {\n return state;\n }\n\n // TypeScript needs a type assertion here for the filter to work.\n let routes = state.routes as PartialRoute<Route<string, object | undefined>>[];\n routes = routes.filter((route, index) => {\n // If the route is the current route, keep it.\n if (index === currentIndex) {\n return true;\n }\n\n // Remove all other routes with the same name and id.\n return name !== route.name || id !== getId?.({ params: route.params });\n });\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n };\n}\n\nconst Stack = Object.assign(\n (props: ComponentProps<typeof RNStack>) => {\n const { isStackAnimationDisabled } = useLinkPreviewContext();\n const screenOptions = useMemo(() => {\n if (isStackAnimationDisabled) {\n return disableAnimationInScreenOptions(props.screenOptions);\n }\n return props.screenOptions;\n }, [props.screenOptions, isStackAnimationDisabled]);\n\n return (\n <RNStack {...props} screenOptions={screenOptions} UNSTABLE_router={stackRouterOverride} />\n );\n },\n {\n Screen: RNStack.Screen as (\n props: ComponentProps<typeof RNStack.Screen> & { singular?: boolean }\n ) => null,\n Protected,\n }\n);\n\ntype NativeStackScreenOptions = ComponentProps<typeof RNStack>['screenOptions'];\n\nfunction disableAnimationInScreenOptions(\n options: NativeStackScreenOptions | undefined\n): NativeStackScreenOptions {\n const animationNone: StackAnimationTypes = 'none';\n if (options) {\n if (typeof options === 'function') {\n const newOptions: typeof options = (...args) => {\n const oldResult = options(...args);\n return {\n ...oldResult,\n animation: animationNone,\n };\n };\n return newOptions;\n }\n return {\n ...options,\n animation: animationNone,\n };\n }\n return {\n animation: animationNone,\n };\n}\n\nexport default Stack;\n\nexport const StackRouter: typeof RNStackRouter = (options) => {\n const router = RNStackRouter(options);\n return {\n ...router,\n ...stackRouterOverride(router),\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"StackClient.js","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,qDAYkC;AAKlC,kDAA2C;AAC3C,iCAAgD;AAEhD,2DAAwD;AACxD,gGAA6F;AAC7F,2EAA2E;AAC3E,0DAAiG;AACjG,8CAA+D;AAC/D,kDAA+C;AAI/C,MAAM,oBAAoB,GAAG,IAAA,uDAA0B,GAAE,CAAC,SAAS,CAAC;AAyCpE,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAK/B,oBAAoB,CAAC,CAAC;AAUxB,SAAS,aAAa,CACpB,MAAwB;IAExB,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,MAAM;QACtB,MAAM,CAAC,IAAI,KAAK,UAAU;QAC1B,MAAM,CAAC,IAAI,KAAK,KAAK;QACrB,MAAM,CAAC,IAAI,KAAK,YAAY;QAC5B,MAAM,CAAC,IAAI,KAAK,SAAS;QACzB,MAAM,CAAC,IAAI,KAAK,SAAS,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,CAAC,MAAwB,EAAkC,EAAE,CACnF,CAAC,CAAC,MAAM,CAAC,OAAO;IAChB,QAAQ,IAAI,MAAM,CAAC,OAAO;IAC1B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ;IACzC,CAAC,CAAC,IAAA,8CAA2B,EAAC,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,CAChE,+CAA+C,CAChD,CAAC;AAEJ;;;;;;;;GAQG;AACI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D,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACL,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;gBAClB,SAAS,EAAE,MAAM;aAClB,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,mCAAmC,CAAC,KAAuC;IAClF,MAAM,UAAU,GAAG,IAAA,8CAA2B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC,UAAU,CAAC,mCAAmC,CAAC;AAC1D,CAAC;AAED,kBAAe,KAAK,CAAC;AAEd,MAAM,WAAW,GAAyB,CAAC,OAAO,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,IAAA,oBAAa,EAAC,OAAO,CAAC,CAAC;IACtC,OAAO;QACL,GAAG,MAAM;QACT,GAAG,IAAA,2BAAmB,EAAC,MAAM,CAAC;KAC/B,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB","sourcesContent":["'use client';\nimport {\n CommonNavigationAction,\n NavigationAction,\n ParamListBase,\n PartialRoute,\n PartialState,\n Route,\n RouterConfigOptions,\n StackRouter as RNStackRouter,\n StackActionType,\n StackNavigationState,\n type RouteProp,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack';\nimport { nanoid } from 'nanoid/non-secure';\nimport { ComponentProps, useMemo } from 'react';\n\nimport { withLayoutContext } from './withLayoutContext';\nimport { createNativeStackNavigator } from '../fork/native-stack/createNativeStackNavigator';\nimport { useLinkPreviewContext } from '../link/preview/LinkPreviewContext';\nimport { getInternalExpoRouterParams, type InternalExpoRouterParams } from '../navigationParams';\nimport { SingularOptions, getSingularId } from '../useScreens';\nimport { Protected } from '../views/Protected';\n\ntype GetId = NonNullable<RouterConfigOptions['routeGetIdList'][string]>;\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\n/**\n * We extend NativeStackNavigationOptions with our custom props\n * to allow for several extra props to be used on web, like modalWidth\n */\nexport type ExtendedStackNavigationOptions = NativeStackNavigationOptions & {\n webModalStyle?: {\n /**\n * Override the width of the modal (px or percentage). Only applies on web platform.\n * @platform web\n */\n width?: number | string;\n /**\n * Override the height of the modal (px or percentage). Applies on web desktop.\n * @platform web\n */\n height?: number | string;\n /**\n * Minimum height of the desktop modal (px or percentage). Overrides the default 640px clamp.\n * @platform web\n */\n minHeight?: number | string;\n /**\n * Minimum width of the desktop modal (px or percentage). Overrides the default 580px.\n * @platform web\n */\n minWidth?: number | string;\n /**\n * Override the border of the desktop modal (any valid CSS border value, e.g. '1px solid #ccc' or 'none').\n * @platform web\n */\n border?: string;\n /**\n * Override the overlay background color (any valid CSS color or rgba/hsla value).\n * @platform web\n */\n overlayBackground?: string;\n };\n};\n\nconst RNStack = withLayoutContext<\n ExtendedStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState<ParamListBase>,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\ntype RNNavigationAction = Extract<CommonNavigationAction, { type: 'NAVIGATE' }>;\ntype RNPreloadAction = Extract<CommonNavigationAction, { type: 'PRELOAD' }>;\ntype ExpoNavigationAction = Omit<RNNavigationAction, 'payload'> & {\n payload: Omit<RNNavigationAction['payload'], 'params'> & {\n params: RNNavigationAction['payload']['params'] & InternalExpoRouterParams;\n };\n};\n\nfunction isStackAction(\n action: NavigationAction\n): action is StackActionType | RNPreloadAction | ExpoNavigationAction {\n return (\n action.type === 'PUSH' ||\n action.type === 'NAVIGATE' ||\n action.type === 'POP' ||\n action.type === 'POP_TO_TOP' ||\n action.type === 'REPLACE' ||\n action.type === 'PRELOAD'\n );\n}\n\nconst isPreviewAction = (action: NavigationAction): action is ExpoNavigationAction =>\n !!action.payload &&\n 'params' in action.payload &&\n typeof action.payload.params === 'object' &&\n !!getInternalExpoRouterParams(action.payload?.params ?? undefined)[\n '__internal__expo_router_is_preview_navigation'\n ];\n\n/**\n * React Navigation matches a screen by its name or a 'getID' function that uniquely identifies a screen.\n * When a screen has been uniquely identified, the Stack can only have one instance of that screen.\n *\n * Expo Router allows for a screen to be matched by name and path params, a 'getID' function or a singular id.\n *\n * Instead of reimplementing the entire StackRouter, we can override the getStateForAction method to handle the singular screen logic.\n *\n */\nexport const stackRouterOverride: NonNullable<ComponentProps<typeof RNStack>['UNSTABLE_router']> = (\n original\n) => {\n return {\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if (!isStackAction(action)) {\n return original.getStateForAction(state, action, options);\n }\n\n // The dynamic getId added to an action, `router.push('screen', { singular: true })`\n const actionSingularOptions =\n action.payload && 'singular' in action.payload\n ? (action.payload.singular as SingularOptions)\n : undefined;\n\n // Handle if 'getID' or 'singular' is set.\n function getIdFunction(): GetId | undefined {\n // Actions can be fired by the user, so we do need to validate their structure.\n if (\n !('payload' in action) ||\n !action.payload ||\n !('name' in action.payload) ||\n typeof action.payload.name !== 'string'\n ) {\n return;\n }\n\n const actionName = action.payload.name;\n\n return (\n // The dynamic singular added to an action, `router.push('screen', { singular: () => 'id' })`\n getActionSingularIdFn(actionSingularOptions, actionName) ||\n // The static getId added as a prop to `<Screen singular />` or `<Screen getId={} />`\n options.routeGetIdList[actionName]\n );\n }\n\n const { routeParamList } = options;\n\n switch (action.type) {\n case 'PUSH':\n case 'NAVIGATE': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n // START FORK\n const getId = getIdFunction();\n // const getId = options.routeGetIdList[action.payload.name];\n // END FORK\n const id = getId?.({ params: action.payload.params });\n\n let route: Route<string> | undefined;\n\n if (id !== undefined) {\n route = state.routes.findLast(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (action.type === 'NAVIGATE') {\n const currentRoute = state.routes[state.index];\n\n // If the route matches the current one, then navigate to it\n if (action.payload.name === currentRoute.name) {\n route = currentRoute;\n } else if (action.payload.pop) {\n route = state.routes.findLast((route) => route.name === action.payload.name);\n }\n }\n\n // START FORK\n if (isPreviewAction(action) && !route) {\n route = state.preloadedRoutes.find(\n (route) => route.name === action.payload.name && id === route.key\n );\n }\n // END FORK\n\n if (!route) {\n route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n let params;\n\n if (action.type === 'NAVIGATE' && action.payload.merge && route) {\n params =\n action.payload.params !== undefined ||\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n }\n\n let routes: Route<string>[];\n\n if (route) {\n if (action.type === 'NAVIGATE' && action.payload.pop) {\n routes = [];\n\n // Get all routes until the matching one\n for (const r of state.routes) {\n if (r.key === route.key) {\n routes.push({\n ...route,\n path: action.payload.path !== undefined ? action.payload.path : route.path,\n params,\n });\n break;\n }\n\n routes.push(r);\n }\n } else {\n // START FORK\n // If there is an id, then filter out the existing route with the same id.\n // THIS ACTION IS DANGEROUS. This can cause React Native Screens to freeze\n if (id !== undefined) {\n routes = state.routes.filter((r) => r.key !== route.key);\n } else if (action.type === 'NAVIGATE' && state.routes.length > 0) {\n // The navigation action should only replace the last route if it has the same name and path params.\n const lastRoute = state.routes[state.routes.length - 1];\n if (\n getSingularId(lastRoute.name, { params: lastRoute.params }) ===\n getSingularId(route.name, { params })\n ) {\n routes = state.routes.slice(0, -1);\n } else {\n routes = [...state.routes];\n }\n } else {\n routes = [...state.routes];\n }\n\n // If the routes length is the same as the state routes length, then we are navigating to a new route.\n // Otherwise we are replacing an existing route.\n const key =\n routes.length === state.routes.length && !isPreviewAction(action)\n ? `${action.payload.name}-${nanoid()}`\n : route.key;\n\n routes.push({\n ...route,\n key,\n path:\n action.type === 'NAVIGATE' && action.payload.path !== undefined\n ? action.payload.path\n : route.path,\n params,\n });\n\n // routes = state.routes.filter((r) => r.key !== route.key);\n // routes.push({\n // ...route,\n // path:\n // action.type === 'NAVIGATE' && action.payload.path !== undefined\n // ? action.payload.path\n // : route.path,\n // params,\n // });\n // END FORK\n }\n } else {\n routes = [\n ...state.routes,\n {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n path: action.type === 'NAVIGATE' ? action.payload.path : undefined,\n params,\n },\n ];\n }\n\n // START FORK\n // return filterSingular(\n const result = {\n ...state,\n index: routes.length - 1,\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => routes[routes.length - 1].key !== route.key\n ),\n routes,\n };\n\n if (actionSingularOptions) {\n return filterSingular(result, getId);\n }\n\n return result;\n // return {\n // ...state,\n // index: routes.length - 1,\n // preloadedRoutes: state.preloadedRoutes.filter(\n // (route) => routes[routes.length - 1].key !== route.key\n // ),\n // routes,\n // };\n // END FORK\n }\n case 'PRELOAD': {\n // START FORK\n // This will be the case for example for protected route\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n // END FORK\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route<string> | undefined;\n\n if (id !== undefined) {\n route = state.routes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n if (route) {\n return {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route?.key) {\n return r;\n }\n return {\n ...r,\n params:\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params,\n };\n }),\n };\n } else {\n // START FORK\n const currentPreloadedRoute: (typeof state)['preloadedRoutes'][number] = {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n params:\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params,\n };\n // END FORK\n return {\n ...state,\n // START FORK\n // Adding the current preloaded route to the beginning of the preloadedRoutes array\n // This ensures that the preloaded route will be the next one after the visible route\n // and when navigation will happen, there will be no reshuffling\n // This is a workaround for the link preview navigation issue, when screen would freeze after navigation from native side\n // and reshuffling from react-navigation\n preloadedRoutes: [currentPreloadedRoute].concat(\n state.preloadedRoutes.filter(\n (r) => r.name !== action.payload.name || id !== getId?.({ params: r.params })\n )\n ),\n // preloadedRoutes: state.preloadedRoutes\n // .filter(\n // (r) =>\n // r.name !== action.payload.name ||\n // id !== getId?.({ params: r.params })\n // )\n // .concat({\n // key: `${action.payload.name}-${nanoid()}`,\n // name: action.payload.name,\n // params:\n // routeParamList[action.payload.name] !== undefined\n // ? {\n // ...routeParamList[action.payload.name],\n // ...action.payload.params,\n // }\n // : action.payload.params,\n // }),\n // END FORK\n };\n }\n }\n default: {\n return original.getStateForAction(state, action, options);\n }\n }\n },\n };\n};\n\nfunction getActionSingularIdFn(\n actionGetId: SingularOptions | undefined,\n name: string\n): GetId | undefined {\n if (typeof actionGetId === 'function') {\n return (options) => actionGetId(name, options.params ?? {});\n } else if (actionGetId === true) {\n return (options) => getSingularId(name, options);\n }\n\n return undefined;\n}\n\n/**\n * If there is a dynamic singular on an action, then we need to filter the state to only have singular screens.\n * As multiples may have been added before we did the singular navigation.\n */\nfunction filterSingular<\n T extends\n | StackNavigationState<ParamListBase>\n | PartialState<StackNavigationState<ParamListBase>>\n | null,\n>(state: T, getId?: GetId): T {\n if (!state) {\n return state;\n }\n\n if (!state.routes) {\n return state;\n }\n\n const currentIndex = state.index || state.routes.length - 1;\n const current = state.routes[currentIndex];\n const name = current.name;\n\n const id = getId?.({ params: current.params });\n\n if (!id) {\n return state;\n }\n\n // TypeScript needs a type assertion here for the filter to work.\n let routes = state.routes as PartialRoute<Route<string, object | undefined>>[];\n routes = routes.filter((route, index) => {\n // If the route is the current route, keep it.\n if (index === currentIndex) {\n return true;\n }\n\n // Remove all other routes with the same name and id.\n return name !== route.name || id !== getId?.({ params: route.params });\n });\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n };\n}\n\nconst Stack = Object.assign(\n (props: ComponentProps<typeof RNStack>) => {\n const { isStackAnimationDisabled } = useLinkPreviewContext();\n\n const screenOptions = useMemo(() => {\n const condition = isStackAnimationDisabled ? () => true : shouldDisableAnimationBasedOnParams;\n\n return disableAnimationInScreenOptions(props.screenOptions, condition);\n }, [props.screenOptions, isStackAnimationDisabled]);\n\n return (\n <RNStack {...props} screenOptions={screenOptions} UNSTABLE_router={stackRouterOverride} />\n );\n },\n {\n Screen: RNStack.Screen as (\n props: ComponentProps<typeof RNStack.Screen> & { singular?: boolean }\n ) => null,\n Protected,\n }\n);\n\ntype NativeStackScreenOptions = ComponentProps<typeof RNStack>['screenOptions'];\n\nfunction disableAnimationInScreenOptions(\n options: NativeStackScreenOptions | undefined,\n condition: (route: RouteProp<ParamListBase, string>) => boolean\n): NativeStackScreenOptions {\n if (options && typeof options === 'function') {\n return (props) => {\n const oldOptions = options(props);\n if (condition(props.route)) {\n return {\n ...oldOptions,\n animation: 'none',\n };\n }\n return oldOptions ?? {};\n };\n }\n return (props) => {\n if (condition(props.route)) {\n return {\n ...(options ?? {}),\n animation: 'none',\n };\n }\n return options ?? {};\n };\n}\n\nfunction shouldDisableAnimationBasedOnParams(route: RouteProp<ParamListBase, string>): boolean {\n const expoParams = getInternalExpoRouterParams(route.params);\n return !!expoParams.__internal_expo_router_no_animation;\n}\n\nexport default Stack;\n\nexport const StackRouter: typeof RNStackRouter = (options) => {\n const router = RNStackRouter(options);\n return {\n ...router,\n ...stackRouterOverride(router),\n };\n};\n"]}
|