expo-router 4.0.17 → 4.0.18-canary-20250303-4dba60e

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.
Files changed (94) hide show
  1. package/build/Route.d.ts +10 -10
  2. package/build/Route.d.ts.map +1 -1
  3. package/build/Route.js +4 -27
  4. package/build/Route.js.map +1 -1
  5. package/build/exports.d.ts +1 -0
  6. package/build/exports.d.ts.map +1 -1
  7. package/build/exports.js +3 -1
  8. package/build/exports.js.map +1 -1
  9. package/build/fast-refresh.d.ts.map +1 -1
  10. package/build/fast-refresh.js +0 -4
  11. package/build/fast-refresh.js.map +1 -1
  12. package/build/fork/getPathFromState.d.ts.map +1 -1
  13. package/build/fork/getPathFromState.js +29 -7
  14. package/build/fork/getPathFromState.js.map +1 -1
  15. package/build/fork/getStateFromPath-forks.d.ts +1 -1
  16. package/build/fork/native-stack/NativeStackView.d.ts +4 -0
  17. package/build/fork/native-stack/NativeStackView.d.ts.map +1 -0
  18. package/build/fork/native-stack/NativeStackView.js +27 -0
  19. package/build/fork/native-stack/NativeStackView.js.map +1 -0
  20. package/build/fork/native-stack/createNativeStackNavigator.d.ts +17 -0
  21. package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -0
  22. package/build/fork/native-stack/createNativeStackNavigator.js +66 -0
  23. package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -0
  24. package/build/fork/useLinking.d.ts +1 -0
  25. package/build/fork/useLinking.d.ts.map +1 -1
  26. package/build/fork/useLinking.js +5 -1
  27. package/build/fork/useLinking.js.map +1 -1
  28. package/build/fork/useLinking.native.d.ts +1 -0
  29. package/build/fork/useLinking.native.d.ts.map +1 -1
  30. package/build/fork/useLinking.native.js +21 -9
  31. package/build/fork/useLinking.native.js.map +1 -1
  32. package/build/getRoutesCore.js +23 -19
  33. package/build/getRoutesCore.js.map +1 -1
  34. package/build/global-state/routing.d.ts +1 -1
  35. package/build/global-state/routing.js.map +1 -1
  36. package/build/hooks.d.ts +23 -8
  37. package/build/hooks.d.ts.map +1 -1
  38. package/build/hooks.js +4 -4
  39. package/build/hooks.js.map +1 -1
  40. package/build/imperative-api.d.ts +2 -2
  41. package/build/imperative-api.js.map +1 -1
  42. package/build/layouts/RootModal.d.ts +13 -0
  43. package/build/layouts/RootModal.d.ts.map +1 -0
  44. package/build/layouts/RootModal.js +26 -0
  45. package/build/layouts/RootModal.js.map +1 -0
  46. package/build/layouts/StackClient.d.ts.map +1 -1
  47. package/build/layouts/StackClient.js +2 -2
  48. package/build/layouts/StackClient.js.map +1 -1
  49. package/build/layouts/withLayoutContext.d.ts +26 -0
  50. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  51. package/build/layouts/withLayoutContext.js +26 -0
  52. package/build/layouts/withLayoutContext.js.map +1 -1
  53. package/build/link/Link.d.ts +1 -1
  54. package/build/link/Link.d.ts.map +1 -1
  55. package/build/link/Link.js.map +1 -1
  56. package/build/link/linking.d.ts.map +1 -1
  57. package/build/link/linking.js +19 -17
  58. package/build/link/linking.js.map +1 -1
  59. package/build/link/useLinkHooks.d.ts +1 -1
  60. package/build/link/useLinkHooks.js.map +1 -1
  61. package/build/link/useLinkToPathProps.d.ts.map +1 -1
  62. package/build/link/useLinkToPathProps.js +2 -2
  63. package/build/link/useLinkToPathProps.js.map +1 -1
  64. package/build/rsc/router/host.d.ts.map +1 -1
  65. package/build/rsc/router/host.js +15 -1
  66. package/build/rsc/router/host.js.map +1 -1
  67. package/build/typed-routes/types.d.ts +40 -16
  68. package/build/typed-routes/types.d.ts.map +1 -1
  69. package/build/typed-routes/types.js.map +1 -1
  70. package/build/ui/TabContext.d.ts +2 -8
  71. package/build/ui/TabContext.d.ts.map +1 -1
  72. package/build/ui/TabContext.js.map +1 -1
  73. package/build/ui/TabRouter.d.ts +1 -1
  74. package/build/ui/TabRouter.d.ts.map +1 -1
  75. package/build/ui/TabRouter.js.map +1 -1
  76. package/build/ui/TabSlot.d.ts +5 -6
  77. package/build/ui/TabSlot.d.ts.map +1 -1
  78. package/build/ui/TabSlot.js +4 -7
  79. package/build/ui/TabSlot.js.map +1 -1
  80. package/build/ui/Tabs.d.ts +13 -8
  81. package/build/ui/Tabs.d.ts.map +1 -1
  82. package/build/ui/Tabs.js +5 -2
  83. package/build/ui/Tabs.js.map +1 -1
  84. package/build/useNavigation.d.ts +2 -2
  85. package/build/useNavigation.js +2 -2
  86. package/build/useNavigation.js.map +1 -1
  87. package/build/useScreens.d.ts +5 -5
  88. package/build/useScreens.d.ts.map +1 -1
  89. package/build/useScreens.js +14 -8
  90. package/build/useScreens.js.map +1 -1
  91. package/expo-module.config.json +2 -3
  92. package/package.json +8 -8
  93. package/plugin/build/index.js +0 -4
  94. package/plugin/src/index.ts +0 -5
package/build/Route.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import React, { ReactNode } from 'react';
2
- import type { ErrorBoundaryProps } from './exports';
1
+ import { type ComponentType, type PropsWithChildren } from 'react';
3
2
  import { sortRoutesWithInitial, sortRoutes } from './sortRoutes';
3
+ import { type ErrorBoundaryProps } from './views/Try';
4
4
  export type DynamicConvention = {
5
5
  name: string;
6
6
  deep: boolean;
7
7
  notFound?: boolean;
8
8
  };
9
9
  export type LoadedRoute = {
10
- ErrorBoundary?: React.ComponentType<ErrorBoundaryProps>;
11
- default?: React.ComponentType<any>;
10
+ ErrorBoundary?: ComponentType<ErrorBoundaryProps>;
11
+ default?: ComponentType<any>;
12
12
  unstable_settings?: Record<string, any>;
13
13
  getNavOptions?: (args: any) => any;
14
14
  generateStaticParams?: (props: {
@@ -22,7 +22,7 @@ export type RouteNode = {
22
22
  loadRoute: () => Partial<LoadedRoute>;
23
23
  /** Loaded initial route name. */
24
24
  initialRouteName?: string;
25
- /** nested routes */
25
+ /** Nested routes */
26
26
  children: RouteNode[];
27
27
  /** Is the route a dynamic path */
28
28
  dynamic: null | DynamicConvention[];
@@ -37,17 +37,17 @@ export type RouteNode = {
37
37
  /** File paths for async entry modules that should be included in the initial chunk request to ensure the runtime JavaScript matches the statically rendered HTML representation. */
38
38
  entryPoints?: string[];
39
39
  };
40
- export declare const LocalRouteParamsContext: React.Context<Record<string, string | undefined> | undefined>;
40
+ export declare const LocalRouteParamsContext: import("react").Context<Record<string, string | undefined> | undefined>;
41
41
  /** Return the RouteNode at the current contextual boundary. */
42
42
  export declare function useRouteNode(): RouteNode | null;
43
43
  export declare function useContextKey(): string;
44
- /** Provides the matching routes and filename to the children. */
45
- export declare function Route({ children, node, route, }: {
46
- children: ReactNode;
44
+ export type RouteProps = PropsWithChildren<{
47
45
  node: RouteNode;
48
46
  route?: {
49
47
  params: Record<string, string | undefined>;
50
48
  };
51
- }): React.JSX.Element;
49
+ }>;
50
+ /** Provides the matching routes and filename to the children. */
51
+ export declare function Route({ children, node, route }: RouteProps): import("react").JSX.Element;
52
52
  export { sortRoutesWithInitial, sortRoutes };
53
53
  //# sourceMappingURL=Route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,CAA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,oBAAoB;IACpB,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,kCAAkC;IAClC,OAAO,EAAE,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACpC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oLAAoL;IACpL,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,uBAAuB,yEAE/B,CAAC;AAMN,+DAA+D;AAC/D,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;KAAE,CAAC;CACxD,CAAC,CAAC;AAEH,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,UAAU,+BAM1D;AAED,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,CAAC"}
package/build/Route.js CHANGED
@@ -1,37 +1,14 @@
1
1
  'use client';
2
2
  "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
3
  Object.defineProperty(exports, "__esModule", { value: true });
27
4
  exports.sortRoutes = exports.sortRoutesWithInitial = exports.Route = exports.useContextKey = exports.useRouteNode = exports.LocalRouteParamsContext = void 0;
28
- const react_1 = __importStar(require("react"));
5
+ const react_1 = require("react");
29
6
  const matchers_1 = require("./matchers");
30
7
  const sortRoutes_1 = require("./sortRoutes");
31
8
  Object.defineProperty(exports, "sortRoutesWithInitial", { enumerable: true, get: function () { return sortRoutes_1.sortRoutesWithInitial; } });
32
9
  Object.defineProperty(exports, "sortRoutes", { enumerable: true, get: function () { return sortRoutes_1.sortRoutes; } });
33
- const CurrentRouteContext = react_1.default.createContext(null);
34
- exports.LocalRouteParamsContext = react_1.default.createContext({});
10
+ const CurrentRouteContext = (0, react_1.createContext)(null);
11
+ exports.LocalRouteParamsContext = (0, react_1.createContext)({});
35
12
  if (process.env.NODE_ENV !== 'production') {
36
13
  CurrentRouteContext.displayName = 'RouteNode';
37
14
  }
@@ -49,7 +26,7 @@ function useContextKey() {
49
26
  }
50
27
  exports.useContextKey = useContextKey;
51
28
  /** Provides the matching routes and filename to the children. */
52
- function Route({ children, node, route, }) {
29
+ function Route({ children, node, route }) {
53
30
  return (<exports.LocalRouteParamsContext.Provider value={route?.params}>
54
31
  <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>
55
32
  </exports.LocalRouteParamsContext.Provider>);
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,+CAAqD;AAGrD,yCAA2C;AAC3C,6CAAiE;AA4ExD,sGA5EA,kCAAqB,OA4EA;AAAE,2FA5EA,uBAAU,OA4EA;AAvC1C,MAAM,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AAC3D,QAAA,uBAAuB,GAAG,eAAK,CAAC,aAAa,CAExD,EAAE,CAAC,CAAC;AAEN,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;CAC/C;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAND,sCAMC;AAED,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,IAAI,EACJ,KAAK,GAKN;IACC,OAAO,CACL,CAAC,+BAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CACrD;MAAA,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CACrF;IAAA,EAAE,+BAAuB,CAAC,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC;AAdD,sBAcC","sourcesContent":["'use client';\n\nimport React, { ReactNode, useContext } from 'react';\n\nimport type { ErrorBoundaryProps } from './exports';\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\n\nexport type DynamicConvention = { name: string; deep: boolean; notFound?: boolean };\n\nexport type LoadedRoute = {\n ErrorBoundary?: React.ComponentType<ErrorBoundaryProps>;\n default?: React.ComponentType<any>;\n unstable_settings?: Record<string, any>;\n getNavOptions?: (args: any) => any;\n generateStaticParams?: (props: {\n params?: Record<string, string | string[]>;\n }) => Record<string, string | string[]>[];\n};\n\nexport type RouteNode = {\n /** The type of RouteNode */\n type: 'route' | 'api' | 'layout';\n /** Load a route into memory. Returns the exports from a route. */\n loadRoute: () => Partial<LoadedRoute>;\n /** Loaded initial route name. */\n initialRouteName?: string;\n /** nested routes */\n children: RouteNode[];\n /** Is the route a dynamic path */\n dynamic: null | DynamicConvention[];\n /** `index`, `error-boundary`, etc. */\n route: string;\n /** Context Module ID, used for matching children. */\n contextKey: string;\n /** Added in-memory */\n generated?: boolean;\n /** Internal screens like the directory or the auto 404 should be marked as internal. */\n internal?: boolean;\n /** File paths for async entry modules that should be included in the initial chunk request to ensure the runtime JavaScript matches the statically rendered HTML representation. */\n entryPoints?: string[];\n};\n\nconst CurrentRouteContext = React.createContext<RouteNode | null>(null);\nexport const LocalRouteParamsContext = React.createContext<\n Record<string, string | undefined> | undefined\n>({});\n\nif (process.env.NODE_ENV !== 'production') {\n CurrentRouteContext.displayName = 'RouteNode';\n}\n\n/** Return the RouteNode at the current contextual boundary. */\nexport function useRouteNode(): RouteNode | null {\n return useContext(CurrentRouteContext);\n}\n\nexport function useContextKey(): string {\n const node = useRouteNode();\n if (node == null) {\n throw new Error('No filename found. This is likely a bug in expo-router.');\n }\n return getContextKey(node.contextKey);\n}\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({\n children,\n node,\n route,\n}: {\n children: ReactNode;\n node: RouteNode;\n route?: { params: Record<string, string | undefined> };\n}) {\n return (\n <LocalRouteParamsContext.Provider value={route?.params}>\n <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>\n </LocalRouteParamsContext.Provider>\n );\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
1
+ {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,iCAA8F;AAE9F,yCAA2C;AAC3C,6CAAiE;AA0ExD,sGA1EA,kCAAqB,OA0EA;AAAE,2FA1EA,uBAAU,OA0EA;AApC1C,MAAM,mBAAmB,GAAG,IAAA,qBAAa,EAAmB,IAAI,CAAC,CAAC;AACrD,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAElD,EAAE,CAAC,CAAC;AAEN,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;CAC/C;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAND,sCAMC;AAOD,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAc;IACzD,OAAO,CACL,CAAC,+BAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CACrD;MAAA,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CACrF;IAAA,EAAE,+BAAuB,CAAC,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC;AAND,sBAMC","sourcesContent":["'use client';\n\nimport { createContext, useContext, type ComponentType, type PropsWithChildren } from 'react';\n\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\nimport { type ErrorBoundaryProps } from './views/Try';\n\nexport type DynamicConvention = { name: string; deep: boolean; notFound?: boolean };\n\nexport type LoadedRoute = {\n ErrorBoundary?: ComponentType<ErrorBoundaryProps>;\n default?: ComponentType<any>;\n unstable_settings?: Record<string, any>;\n getNavOptions?: (args: any) => any;\n generateStaticParams?: (props: {\n params?: Record<string, string | string[]>;\n }) => Record<string, string | string[]>[];\n};\n\nexport type RouteNode = {\n /** The type of RouteNode */\n type: 'route' | 'api' | 'layout';\n /** Load a route into memory. Returns the exports from a route. */\n loadRoute: () => Partial<LoadedRoute>;\n /** Loaded initial route name. */\n initialRouteName?: string;\n /** Nested routes */\n children: RouteNode[];\n /** Is the route a dynamic path */\n dynamic: null | DynamicConvention[];\n /** `index`, `error-boundary`, etc. */\n route: string;\n /** Context Module ID, used for matching children. */\n contextKey: string;\n /** Added in-memory */\n generated?: boolean;\n /** Internal screens like the directory or the auto 404 should be marked as internal. */\n internal?: boolean;\n /** File paths for async entry modules that should be included in the initial chunk request to ensure the runtime JavaScript matches the statically rendered HTML representation. */\n entryPoints?: string[];\n};\n\nconst CurrentRouteContext = createContext<RouteNode | null>(null);\nexport const LocalRouteParamsContext = createContext<\n Record<string, string | undefined> | undefined\n>({});\n\nif (process.env.NODE_ENV !== 'production') {\n CurrentRouteContext.displayName = 'RouteNode';\n}\n\n/** Return the RouteNode at the current contextual boundary. */\nexport function useRouteNode(): RouteNode | null {\n return useContext(CurrentRouteContext);\n}\n\nexport function useContextKey(): string {\n const node = useRouteNode();\n if (node == null) {\n throw new Error('No filename found. This is likely a bug in expo-router.');\n }\n return getContextKey(node.contextKey);\n}\n\nexport type RouteProps = PropsWithChildren<{\n node: RouteNode;\n route?: { params: Record<string, string | undefined> };\n}>;\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({ children, node, route }: RouteProps) {\n return (\n <LocalRouteParamsContext.Provider value={route?.params}>\n <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>\n </LocalRouteParamsContext.Provider>\n );\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
@@ -6,6 +6,7 @@ export { withLayoutContext } from './layouts/withLayoutContext';
6
6
  export { Navigator, Slot };
7
7
  export { ExpoRoot } from './ExpoRoot';
8
8
  export { Unmatched } from './views/Unmatched';
9
+ export { Sitemap } from './views/Sitemap';
9
10
  export { ErrorBoundaryProps } from './views/Try';
10
11
  export { ErrorBoundary } from './views/ErrorBoundary';
11
12
  export type { ScreenProps } from './useScreens';
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY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AM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,mBAAmB,SAAS,CAAC"}
package/build/exports.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.useFocusEffect = exports.useNavigation = exports.SplashScreen = exports.ErrorBoundary = exports.Unmatched = exports.ExpoRoot = exports.Slot = exports.Navigator = exports.withLayoutContext = exports.Redirect = exports.Link = exports.router = exports.useRootNavigationState = exports.useRootNavigation = exports.useSegments = exports.useLocalSearchParams = exports.useGlobalSearchParams = exports.useNavigationContainerRef = exports.usePathname = exports.useUnstableGlobalHref = exports.useRouter = void 0;
26
+ exports.useFocusEffect = exports.useNavigation = exports.SplashScreen = exports.ErrorBoundary = exports.Sitemap = exports.Unmatched = exports.ExpoRoot = exports.Slot = exports.Navigator = exports.withLayoutContext = exports.Redirect = exports.Link = exports.router = exports.useRootNavigationState = exports.useRootNavigation = exports.useSegments = exports.useLocalSearchParams = exports.useGlobalSearchParams = exports.useNavigationContainerRef = exports.usePathname = exports.useUnstableGlobalHref = exports.useRouter = void 0;
27
27
  // Expo Router API
28
28
  const Navigator_1 = require("./views/Navigator");
29
29
  Object.defineProperty(exports, "Navigator", { enumerable: true, get: function () { return Navigator_1.Navigator; } });
@@ -50,6 +50,8 @@ var ExpoRoot_1 = require("./ExpoRoot");
50
50
  Object.defineProperty(exports, "ExpoRoot", { enumerable: true, get: function () { return ExpoRoot_1.ExpoRoot; } });
51
51
  var Unmatched_1 = require("./views/Unmatched");
52
52
  Object.defineProperty(exports, "Unmatched", { enumerable: true, get: function () { return Unmatched_1.Unmatched; } });
53
+ var Sitemap_1 = require("./views/Sitemap");
54
+ Object.defineProperty(exports, "Sitemap", { enumerable: true, get: function () { return Sitemap_1.Sitemap; } });
53
55
  var ErrorBoundary_1 = require("./views/ErrorBoundary");
54
56
  Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorBoundary; } });
55
57
  // Platform
@@ -1 +1 @@
1
- {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,iDAAoD;AAmB3C,0FAnBA,qBAAS,OAmBA;AAAE,qFAnBA,gBAAI,OAmBA;AAjBxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAAkD;AAAzC,wGAAA,MAAM,OAAA;AAEf,oCAAuF;AAA9E,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAGtB,WAAW;AACX;;GAEG;AACH,+DAA+C;AAE/C,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkE;AAAzD,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router, Router } from './imperative-api';\n\nexport { Link, Redirect, RedirectProps, LinkProps, WebAnchorProps } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport type { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport * as SplashScreen from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, EffectCallback } from './useFocusEffect';\nexport type { ResultState } from './fork/getStateFromPath';\n\nexport type * from './types';\n"]}
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,iDAAoD;AAmB3C,0FAnBA,qBAAS,OAmBA;AAAE,qFAnBA,gBAAI,OAmBA;AAjBxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAAkD;AAAzC,wGAAA,MAAM,OAAA;AAEf,oCAAuF;AAA9E,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAClB,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAEhB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAGtB,WAAW;AACX;;GAEG;AACH,+DAA+C;AAE/C,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkE;AAAzD,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router, Router } from './imperative-api';\n\nexport { Link, Redirect, RedirectProps, LinkProps, WebAnchorProps } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { Sitemap } from './views/Sitemap';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport type { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport * as SplashScreen from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, EffectCallback } from './useFocusEffect';\nexport type { ResultState } from './fork/getStateFromPath';\n\nexport type * from './types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fast-refresh.d.ts","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":"AA4EA,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"fast-refresh.d.ts","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":"AAwEA,OAAO,EAAE,CAAC"}
@@ -54,10 +54,6 @@ if (process.env.NODE_ENV === 'development') {
54
54
  if ('generateStaticParams' in value) {
55
55
  expoRouterExports.add(value.generateStaticParams);
56
56
  }
57
- // When ErrorBoundary is exported, the inverse dependency will also include the _ctx file.
58
- if ('ctx' in value && value.ctx.name === 'metroContext') {
59
- expoRouterExports.add(value.ctx);
60
- }
61
57
  }
62
58
  }
63
59
  catch {
@@ -1 +1 @@
1
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;oBAC5E,4CAA4C;iBAC7C;gBACD,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;KACJ;CACF","sourcesContent":["declare let __METRO_GLOBAL_PREFIX__: string;\n\n/**\n * This is a hack for Expo Router to support Fast Refresh on _layout files\n *\n * Fast Refresh only works when:\n * - Files only export React Components\n * - All inverse dependencies only export React Components\n *\n * Expo Router's _layout files support exporting both 'unstable_settings' and 'ErrorBoundary'\n *\n * 'unstable_settings':\n * - This is a plain object, so it will break Fast Refresh\n *\n * 'ErrorBoundary'\n * - While this is a React component, it is imported from 'expo-router'\n * - 'expo-router' has an inverse dependency on _ctx, which is a require.context object\n *\n * 'generateStaticParams'\n * - This is a function that is not a React Component, so it will break Fast Refresh\n *\n *\n * To resolve this issue, we extend ReactRefresh to flag these exports as React components\n *\n * @see https://reactnative.dev/docs/fast-refresh\n */\nif (process.env.NODE_ENV === 'development') {\n if (\n // Should be a string at runtime\n typeof __METRO_GLOBAL_PREFIX__ !== 'undefined' &&\n // Should be set by Metro's require polyfill\n global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh']\n ) {\n // source: https://github.com/facebook/metro/blob/main/packages/metro-runtime/src/polyfills/require.js\n const Refresh = global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'];\n // Keep a reference to the original\n const isLikelyComponentType = Refresh.isLikelyComponentType;\n // Modules can be dereferenced at any time\n const expoRouterExports = new WeakSet();\n\n Object.assign(Refresh, {\n /*\n * isLikelyComponentType is called twice.\n * 1. Initially with a modules export object\n * 2. With each individual export of a module\n */\n isLikelyComponentType(value) {\n try {\n if (typeof value === 'object') {\n if ('unstable_settings' in value) {\n expoRouterExports.add(value.unstable_settings);\n }\n if ('ErrorBoundary' in value) {\n expoRouterExports.add(value.ErrorBoundary);\n }\n if ('generateStaticParams' in value) {\n expoRouterExports.add(value.generateStaticParams);\n }\n // When ErrorBoundary is exported, the inverse dependency will also include the _ctx file.\n if ('ctx' in value && value.ctx.name === 'metroContext') {\n expoRouterExports.add(value.ctx);\n }\n }\n } catch {\n // Ignore - we're just trying to avoid breaking Fast Refresh by using exports\n // that aren't JS objects valid as keys for the WeakSet - like we've seen with\n // some JSI::HostObject instances that are exported in a module - see #33670\n // https://github.com/expo/expo/issues/33670\n }\n return expoRouterExports.has(value) || isLikelyComponentType(value);\n },\n });\n }\n}\n\n// Export an empty object so TypeScript doesn't consider this an ambient module\nexport {};\n"]}
1
+ {"version":3,"file":"fast-refresh.js","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;IAC1C;IACE,gCAAgC;IAChC,OAAO,uBAAuB,KAAK,WAAW;QAC9C,4CAA4C;QAC5C,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,EAClD;QACA,sGAAsG;QACtG,MAAM,OAAO,GAAG,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,CAAC;QACnE,mCAAmC;QACnC,MAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAC5D,0CAA0C;QAC1C,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB;;;;eAIG;YACH,qBAAqB,CAAC,KAAK;gBACzB,IAAI;oBACF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;wBAC7B,IAAI,mBAAmB,IAAI,KAAK,EAAE;4BAChC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;yBAChD;wBACD,IAAI,eAAe,IAAI,KAAK,EAAE;4BAC5B,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;yBAC5C;wBACD,IAAI,sBAAsB,IAAI,KAAK,EAAE;4BACnC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;yBACnD;qBACF;iBACF;gBAAC,MAAM;oBACN,6EAA6E;oBAC7E,8EAA8E;oBAC9E,4EAA4E;oBAC5E,4CAA4C;iBAC7C;gBACD,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;KACJ;CACF","sourcesContent":["declare let __METRO_GLOBAL_PREFIX__: string;\n\n/**\n * This is a hack for Expo Router to support Fast Refresh on _layout files\n *\n * Fast Refresh only works when:\n * - Files only export React Components\n * - All inverse dependencies only export React Components\n *\n * Expo Router's _layout files support exporting both 'unstable_settings' and 'ErrorBoundary'\n *\n * 'unstable_settings':\n * - This is a plain object, so it will break Fast Refresh\n *\n * 'ErrorBoundary'\n * - While this is a React component, it is imported from 'expo-router'\n * - 'expo-router' has an inverse dependency on _ctx, which is a require.context object\n *\n * 'generateStaticParams'\n * - This is a function that is not a React Component, so it will break Fast Refresh\n *\n *\n * To resolve this issue, we extend ReactRefresh to flag these exports as React components\n *\n * @see https://reactnative.dev/docs/fast-refresh\n */\nif (process.env.NODE_ENV === 'development') {\n if (\n // Should be a string at runtime\n typeof __METRO_GLOBAL_PREFIX__ !== 'undefined' &&\n // Should be set by Metro's require polyfill\n global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh']\n ) {\n // source: https://github.com/facebook/metro/blob/main/packages/metro-runtime/src/polyfills/require.js\n const Refresh = global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'];\n // Keep a reference to the original\n const isLikelyComponentType = Refresh.isLikelyComponentType;\n // Modules can be dereferenced at any time\n const expoRouterExports = new WeakSet();\n\n Object.assign(Refresh, {\n /*\n * isLikelyComponentType is called twice.\n * 1. Initially with a modules export object\n * 2. With each individual export of a module\n */\n isLikelyComponentType(value) {\n try {\n if (typeof value === 'object') {\n if ('unstable_settings' in value) {\n expoRouterExports.add(value.unstable_settings);\n }\n if ('ErrorBoundary' in value) {\n expoRouterExports.add(value.ErrorBoundary);\n }\n if ('generateStaticParams' in value) {\n expoRouterExports.add(value.generateStaticParams);\n }\n }\n } catch {\n // Ignore - we're just trying to avoid breaking Fast Refresh by using exports\n // that aren't JS objects valid as keys for the WeakSet - like we've seen with\n // some JSI::HostObject instances that are exported in a module - see #33670\n // https://github.com/expo/expo/issues/33670\n }\n return expoRouterExports.has(value) || isLikelyComponentType(value);\n },\n });\n }\n}\n\n// Export an empty object so TypeScript doesn't consider this an ambient module\nexport {};\n"]}
@@ -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;AAG5E,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,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BAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,GAAG,SAAqC,UAQxD"}
@@ -143,14 +143,36 @@ function getPathDataFromState(state, options) {
143
143
  // If there is no `screens` property or no nested state, we return pattern
144
144
  if (!currentOptions[route.name].screens || route.state === undefined) {
145
145
  // START FORK
146
- // Expo Router can end up in some configs that React Navigation doesn't seem to support
147
- // We can get around this by providing a fake state
146
+ // Expo Router allows you to navigate to a (group) and not specify a target screen
147
+ // This is different from React Navigation, which requires a target screen
148
+ // We need to handle this case here, by selecting either the index screen or the first screen of the group
149
+ // IMPORTANT: This does not affect groups that use _layout files with initialRouteNames
150
+ // Layout files create a new route config. This only affects groups without layouts that have their screens
151
+ // hoisted.
152
+ // Example:
153
+ // - /home/_layout
154
+ // - /home/(a|b|c)/index --> Hoisted to /home/_layout navigator
155
+ // - /home/(a|b|c)/other --> Hoisted to /home/_layout navigator
156
+ // - /home/(profile)/me --> Hoisted to /home/_layout navigator
157
+ //
158
+ // route.push('/home/(a)') --> This should navigate to /home/(a)/index
159
+ // route.push('/home/(profile)') --> This should navigate to /home/(profile)/me
148
160
  const screens = currentOptions[route.name].screens;
149
- const screen = route.params && 'screen' in route.params
150
- ? route.params.screen?.toString()
151
- : screens
152
- ? Object.keys(screens)[0]
153
- : undefined;
161
+ // Determine what screen the user wants to navigate to. If no screen is specified, assume there is an index screen
162
+ // In the examples above, this ensures that /home/(a) navigates to /home/(a)/index
163
+ const targetScreen =
164
+ // This is typed as unknown, so we need to add these extra assertions
165
+ route.params && 'screen' in route.params && typeof route.params.screen === 'string'
166
+ ? route.params.screen
167
+ : 'index';
168
+ // If the target screen is not in the screens object, default to the first screen
169
+ // In the examples above, this ensures that /home/(profile) navigates to /home/(profile)/me
170
+ // As there is no index screen in the group
171
+ const screen = screens
172
+ ? screens[targetScreen]
173
+ ? targetScreen
174
+ : Object.keys(screens)[0]
175
+ : undefined;
154
176
  if (screen && screens && currentOptions[route.name].screens?.[screen]) {
155
177
  route = { ...screens[screen], name: screen, key: screen };
156
178
  currentOptions = screens;
@@ -1 +1 @@
1
- {"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAA4C;AAE5C,+DAAiD;AAqBjD,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;QACf,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACpC;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;AALD,4CAKC;AAED,SAAgB,oBAAoB,CAClC,KAAY,EACZ,OAA4B;IAE5B,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,MAAM,KAAK,CAAC,+EAA+E,CAAC,CAAC;KAC9F;IAED,IAAI,OAAO,EAAE;QACX,aAAa;QACb,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACjC,+BAA+B;QAC/B,WAAW;KACZ;IAED,iEAAiE;IACjE,IAAI,uBAAuB,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,OAAO,EAAE;QACnD,uBAAuB,GAAG;Y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AC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;SACpE;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,sCAUC","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 can end up in some configs that React Navigation doesn't seem to support\n // We can get around this by providing a fake state\n const screens = currentOptions[route.name].screens;\n const screen =\n route.params && 'screen' in route.params\n ? route.params.screen?.toString()\n : screens\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAA4C;AAE5C,+DAAiD;AAqBjD,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;QACf,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACpC;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;AALD,4CAKC;AAED,SAAgB,oBAAoB,CAClC,KAAY,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,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACtD,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC9B,OAA8B,EAC9B,OAAgB,EACY,EAAE,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;QAC1C,IAAI,OAAO,EAAE;YACX,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;SACpE;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,sCAUC","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"]}
@@ -44,7 +44,7 @@ export declare function spreadParamsAcrossAllStates(state: InitialState, params?
44
44
  export declare function stripBaseUrl(path: string, baseUrl?: string | undefined): string;
45
45
  export declare function matchForEmptyPath(configs: RouteConfig[]): {
46
46
  path: string;
47
- type: "static" | "dynamic" | "layout";
47
+ type: "layout" | "static" | "dynamic";
48
48
  userReadableName: string;
49
49
  isIndex: boolean;
50
50
  isInitial?: boolean | undefined;
@@ -0,0 +1,4 @@
1
+ import { NativeStackView as RNNativeStackView } from '@react-navigation/native-stack';
2
+ import { ComponentProps } from 'react';
3
+ export declare function NativeStackView(props: ComponentProps<typeof RNNativeStackView>): import("react").JSX.Element;
4
+ //# sourceMappingURL=NativeStackView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeStackView.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/NativeStackView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAC;AAI5D,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,iBAAiB,CAAC,+BAM9E"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeStackView = void 0;
4
+ const native_stack_1 = require("@react-navigation/native-stack");
5
+ const react_1 = require("react");
6
+ const RootModal_1 = require("../../layouts/RootModal");
7
+ function NativeStackView(props) {
8
+ return (<RootModal_1.RootModalProvider>
9
+ <NativeStackViewInner {...props}/>
10
+ </RootModal_1.RootModalProvider>);
11
+ }
12
+ exports.NativeStackView = NativeStackView;
13
+ function NativeStackViewInner(props) {
14
+ const rootModals = (0, react_1.useContext)(RootModal_1.RootModalContext);
15
+ // Append the root modals to the state
16
+ const state = (0, react_1.useMemo)(() => {
17
+ if (rootModals.routes.length === 0) {
18
+ return props.state;
19
+ }
20
+ return {
21
+ ...props.state,
22
+ routes: props.state.routes.concat(rootModals.routes),
23
+ };
24
+ }, [props.state, rootModals.routes]);
25
+ return <native_stack_1.NativeStackView {...props} state={state}/>;
26
+ }
27
+ //# sourceMappingURL=NativeStackView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeStackView.js","sourceRoot":"","sources":["../../../src/fork/native-stack/NativeStackView.tsx"],"names":[],"mappings":";;;AAAA,iEAAsF;AACtF,iCAA4D;AAE5D,uDAA8E;AAE9E,SAAgB,eAAe,CAAC,KAA+C;IAC7E,OAAO,CACL,CAAC,6BAAiB,CAChB;MAAA,CAAC,oBAAoB,CAAC,IAAI,KAAK,CAAC,EAClC;IAAA,EAAE,6BAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAND,0CAMC;AAED,SAAS,oBAAoB,CAAC,KAA+C;IAC3E,MAAM,UAAU,GAAG,IAAA,kBAAU,EAAC,4BAAgB,CAAC,CAAC;IAEhD,sCAAsC;IACtC,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzB,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,KAAK,CAAC,KAAK,CAAC;SACpB;QAED,OAAO;YACL,GAAG,KAAK,CAAC,KAAK;YACd,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;SACrD,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAErC,OAAO,CAAC,8BAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;AACxD,CAAC","sourcesContent":["import { NativeStackView as RNNativeStackView } from '@react-navigation/native-stack';\nimport { ComponentProps, useContext, useMemo } from 'react';\n\nimport { RootModalContext, RootModalProvider } from '../../layouts/RootModal';\n\nexport function NativeStackView(props: ComponentProps<typeof RNNativeStackView>) {\n return (\n <RootModalProvider>\n <NativeStackViewInner {...props} />\n </RootModalProvider>\n );\n}\n\nfunction NativeStackViewInner(props: ComponentProps<typeof RNNativeStackView>) {\n const rootModals = useContext(RootModalContext);\n\n // Append the root modals to the state\n const state = useMemo(() => {\n if (rootModals.routes.length === 0) {\n return props.state;\n }\n\n return {\n ...props.state,\n routes: props.state.routes.concat(rootModals.routes),\n };\n }, [props.state, rootModals.routes]);\n\n return <RNNativeStackView {...props} state={state} />;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { type NavigatorTypeBagBase, type ParamListBase, type StackNavigationState, type StaticConfig, type TypedNavigator } from '@react-navigation/native';
2
+ import { NativeStackNavigatorProps, NativeStackNavigationOptions, NativeStackNavigationEventMap, NativeStackNavigationProp } from '@react-navigation/native-stack';
3
+ import * as React from 'react';
4
+ declare function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_getStateForRouteNamesChange, ...rest }: NativeStackNavigatorProps): React.JSX.Element;
5
+ export declare function createNativeStackNavigator<const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = {
6
+ ParamList: ParamList;
7
+ NavigatorID: NavigatorID;
8
+ State: StackNavigationState<ParamList>;
9
+ ScreenOptions: NativeStackNavigationOptions;
10
+ EventMap: NativeStackNavigationEventMap;
11
+ NavigationList: {
12
+ [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
13
+ };
14
+ Navigator: typeof NativeStackNavigator;
15
+ }, const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>>(config?: Config): TypedNavigator<TypeBag, Config>;
16
+ export {};
17
+ //# sourceMappingURL=createNativeStackNavigator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,6BAA6B,EAE7B,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,iBAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,oCAAoC,EACpC,GAAG,IAAI,EACR,EAAE,yBAAyB,qBAmD3B;AAED,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACxD,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE,6BAA6B,CAAC;IACxC,cAAc,EAAE;SACb,SAAS,IAAI,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC7F,CAAC;IACF,SAAS,EAAE,OAAO,oBAAoB,CAAC;CACxC,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAClE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.createNativeStackNavigator = void 0;
27
+ const native_1 = require("@react-navigation/native");
28
+ const native_stack_1 = require("@react-navigation/native-stack");
29
+ const React = __importStar(require("react"));
30
+ function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_getStateForRouteNamesChange, ...rest }) {
31
+ const { state, describe, descriptors, navigation, NavigationContent } = (0, native_1.useNavigationBuilder)(native_1.StackRouter, {
32
+ id,
33
+ initialRouteName,
34
+ children,
35
+ layout,
36
+ screenListeners,
37
+ screenOptions,
38
+ screenLayout,
39
+ UNSTABLE_getStateForRouteNamesChange,
40
+ });
41
+ React.useEffect(() =>
42
+ // @ts-expect-error: there may not be a tab navigator in parent
43
+ navigation?.addListener?.('tabPress', (e) => {
44
+ const isFocused = navigation.isFocused();
45
+ // Run the operation in the next frame so we're sure all listeners have been run
46
+ // This is necessary to know if preventDefault() has been called
47
+ requestAnimationFrame(() => {
48
+ if (state.index > 0 && isFocused && !e.defaultPrevented) {
49
+ // When user taps on already focused tab and we're inside the tab,
50
+ // reset the stack to replicate native behaviour
51
+ navigation.dispatch({
52
+ ...native_1.StackActions.popToTop(),
53
+ target: state.key,
54
+ });
55
+ }
56
+ });
57
+ }), [navigation, state.index, state.key]);
58
+ return (<NavigationContent>
59
+ <native_stack_1.NativeStackView {...rest} state={state} navigation={navigation} descriptors={descriptors} describe={describe}/>
60
+ </NavigationContent>);
61
+ }
62
+ function createNativeStackNavigator(config) {
63
+ return (0, native_1.createNavigatorFactory)(NativeStackNavigator)(config);
64
+ }
65
+ exports.createNativeStackNavigator = createNativeStackNavigator;
66
+ //# sourceMappingURL=createNativeStackNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAakC;AAClC,iEAMwC;AACxC,6CAA+B;AAE/B,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,oCAAoC,EACpC,GAAG,IAAI,EACmB;IAC1B,MAAM,EAAE,KAAK,EAAE,QAAQ,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,gEAiBC","sourcesContent":["import {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigatorProps,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap,\n NativeStackView,\n NativeStackNavigationProp,\n} from '@react-navigation/native-stack';\nimport * as React from 'react';\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_getStateForRouteNamesChange,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_getStateForRouteNamesChange,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n return (\n <NavigationContent>\n <NativeStackView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState<ParamList>;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]}
@@ -32,5 +32,6 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
32
32
  }> & any) | undefined;
33
33
  }) | undefined>;
34
34
  };
35
+ export declare function getInitialURLWithTimeout(): string | null | Promise<string | null>;
35
36
  export {};
36
37
  //# sourceMappingURL=useLinking.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAKd,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgD/B;;GAEG;AACH,eAAO,MAAM,MAAM,OAAQ,MAAM,QAAQ,IAAI,CAAC,eAM7C,CAAC;AAIF,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EA6WtE"}
1
+ {"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAKd,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgD/B;;GAEG;AACH,eAAO,MAAM,MAAM,OAAQ,MAAM,QAAQ,IAAI,CAAC,eAM7C,CAAC;AAIF,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EA6WtE;AAED,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEjF"}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.useLinking = exports.series = void 0;
29
+ exports.getInitialURLWithTimeout = exports.useLinking = exports.series = void 0;
30
30
  const native_1 = require("@react-navigation/native");
31
31
  const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
32
32
  const React = __importStar(require("react"));
@@ -368,4 +368,8 @@ function useLinking(ref, { enabled = true, config, getStateFromPath = native_1.g
368
368
  };
369
369
  }
370
370
  exports.useLinking = useLinking;
371
+ function getInitialURLWithTimeout() {
372
+ return typeof window === 'undefined' ? '' : window.location.href;
373
+ }
374
+ exports.getInitialURLWithTimeout = getInitialURLWithTimeout;
371
375
  //# sourceMappingURL=useLinking.js.map