expo-router 4.0.0-canary-20240927-ab8a962 → 4.0.0-canary-20241018-bf4b2f7

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 (222) hide show
  1. package/_async-server-import.js +17 -0
  2. package/build/ExpoRoot.d.ts +3 -0
  3. package/build/ExpoRoot.d.ts.map +1 -1
  4. package/build/ExpoRoot.js +9 -9
  5. package/build/ExpoRoot.js.map +1 -1
  6. package/build/LocationProvider.d.ts.map +1 -1
  7. package/build/LocationProvider.js +24 -5
  8. package/build/LocationProvider.js.map +1 -1
  9. package/build/exports.d.ts +7 -2
  10. package/build/exports.d.ts.map +1 -1
  11. package/build/exports.js +3 -0
  12. package/build/exports.js.map +1 -1
  13. package/build/fork/NavigationContainer.d.ts +6 -9
  14. package/build/fork/NavigationContainer.d.ts.map +1 -1
  15. package/build/fork/NavigationContainer.js +60 -66
  16. package/build/fork/NavigationContainer.js.map +1 -1
  17. package/build/fork/createMemoryHistory.d.ts +1 -1
  18. package/build/fork/createMemoryHistory.d.ts.map +1 -1
  19. package/build/fork/createMemoryHistory.js +2 -1
  20. package/build/fork/createMemoryHistory.js.map +1 -1
  21. package/build/fork/extractPathFromURL.d.ts +1 -1
  22. package/build/fork/extractPathFromURL.d.ts.map +1 -1
  23. package/build/fork/extractPathFromURL.js +1 -1
  24. package/build/fork/extractPathFromURL.js.map +1 -1
  25. package/build/fork/findFocusedRoute.d.ts +1 -9
  26. package/build/fork/findFocusedRoute.d.ts.map +1 -1
  27. package/build/fork/getPathFromState-forks.d.ts +27 -0
  28. package/build/fork/getPathFromState-forks.d.ts.map +1 -0
  29. package/build/fork/getPathFromState-forks.js +165 -0
  30. package/build/fork/getPathFromState-forks.js.map +1 -0
  31. package/build/fork/getPathFromState.d.ts +7 -13
  32. package/build/fork/getPathFromState.d.ts.map +1 -1
  33. package/build/fork/getPathFromState.js +198 -390
  34. package/build/fork/getPathFromState.js.map +1 -1
  35. package/build/fork/getStateFromPath-forks.d.ts +66 -0
  36. package/build/fork/getStateFromPath-forks.d.ts.map +1 -0
  37. package/build/fork/getStateFromPath-forks.js +404 -0
  38. package/build/fork/getStateFromPath-forks.js.map +1 -0
  39. package/build/fork/getStateFromPath.d.ts +18 -33
  40. package/build/fork/getStateFromPath.d.ts.map +1 -1
  41. package/build/fork/getStateFromPath.js +357 -475
  42. package/build/fork/getStateFromPath.js.map +1 -1
  43. package/build/fork/useBackButton.d.ts +4 -0
  44. package/build/fork/useBackButton.d.ts.map +1 -0
  45. package/build/fork/useBackButton.js +9 -0
  46. package/build/fork/useBackButton.js.map +1 -0
  47. package/build/fork/useBackButton.native.d.ts +7 -0
  48. package/build/fork/useBackButton.native.d.ts.map +1 -0
  49. package/build/fork/useBackButton.native.js +46 -0
  50. package/build/fork/useBackButton.native.js.map +1 -0
  51. package/build/fork/useDocumentTitle.d.ts +8 -0
  52. package/build/fork/useDocumentTitle.d.ts.map +1 -0
  53. package/build/fork/useDocumentTitle.js +49 -0
  54. package/build/fork/useDocumentTitle.js.map +1 -0
  55. package/build/fork/useDocumentTitle.native.d.ts +2 -0
  56. package/build/fork/useDocumentTitle.native.d.ts.map +1 -0
  57. package/build/fork/useDocumentTitle.native.js +11 -0
  58. package/build/fork/useDocumentTitle.native.js.map +1 -0
  59. package/build/fork/useLinking.d.ts +6 -24
  60. package/build/fork/useLinking.d.ts.map +1 -1
  61. package/build/fork/useLinking.js +45 -28
  62. package/build/fork/useLinking.js.map +1 -1
  63. package/build/fork/useLinking.native.d.ts +5 -21
  64. package/build/fork/useLinking.native.d.ts.map +1 -1
  65. package/build/fork/useLinking.native.js +60 -60
  66. package/build/fork/useLinking.native.js.map +1 -1
  67. package/build/fork/useThenable.d.ts +2 -0
  68. package/build/fork/useThenable.d.ts.map +1 -0
  69. package/build/fork/useThenable.js +63 -0
  70. package/build/fork/useThenable.js.map +1 -0
  71. package/build/getLinkingConfig.d.ts +1 -1
  72. package/build/getReactNavigationConfig.d.ts +1 -1
  73. package/build/getReactNavigationConfig.d.ts.map +1 -1
  74. package/build/getReactNavigationConfig.js +12 -4
  75. package/build/getReactNavigationConfig.js.map +1 -1
  76. package/build/global-state/routeInfo.d.ts +6 -0
  77. package/build/global-state/routeInfo.d.ts.map +1 -0
  78. package/build/global-state/routeInfo.js +57 -0
  79. package/build/global-state/routeInfo.js.map +1 -0
  80. package/build/global-state/router-store.d.ts +5 -4
  81. package/build/global-state/router-store.d.ts.map +1 -1
  82. package/build/global-state/router-store.js +4 -1
  83. package/build/global-state/router-store.js.map +1 -1
  84. package/build/global-state/routing.js +2 -2
  85. package/build/global-state/routing.js.map +1 -1
  86. package/build/global-state/serverLocationContext.d.ts +9 -0
  87. package/build/global-state/serverLocationContext.d.ts.map +1 -0
  88. package/build/global-state/{serverContext.js → serverLocationContext.js} +3 -3
  89. package/build/global-state/serverLocationContext.js.map +1 -0
  90. package/build/head/ExpoHeadModule.js +1 -1
  91. package/build/head/ExpoHeadModule.js.map +1 -1
  92. package/build/hooks.d.ts +66 -14
  93. package/build/hooks.d.ts.map +1 -1
  94. package/build/hooks.js +37 -7
  95. package/build/hooks.js.map +1 -1
  96. package/build/imperative-api.d.ts +3 -0
  97. package/build/imperative-api.d.ts.map +1 -1
  98. package/build/imperative-api.js +3 -0
  99. package/build/imperative-api.js.map +1 -1
  100. package/build/layouts/Drawer.d.ts +114 -78
  101. package/build/layouts/Drawer.d.ts.map +1 -1
  102. package/build/layouts/Stack.d.ts +101 -81
  103. package/build/layouts/Stack.d.ts.map +1 -1
  104. package/build/layouts/Tabs.d.ts +4 -150
  105. package/build/layouts/Tabs.d.ts.map +1 -1
  106. package/build/layouts/Tabs.js +2 -0
  107. package/build/layouts/Tabs.js.map +1 -1
  108. package/build/layouts/withLayoutContext.d.ts +4 -4
  109. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  110. package/build/layouts/withLayoutContext.js +27 -7
  111. package/build/layouts/withLayoutContext.js.map +1 -1
  112. package/build/link/Link.d.ts +5 -78
  113. package/build/link/Link.d.ts.map +1 -1
  114. package/build/link/Link.js +6 -75
  115. package/build/link/Link.js.map +1 -1
  116. package/build/link/linking.d.ts +2 -2
  117. package/build/link/linking.d.ts.map +1 -1
  118. package/build/link/linking.js +6 -7
  119. package/build/link/linking.js.map +1 -1
  120. package/build/link/useLinkHooks.d.ts +94 -0
  121. package/build/link/useLinkHooks.d.ts.map +1 -0
  122. package/build/link/useLinkHooks.js +49 -0
  123. package/build/link/useLinkHooks.js.map +1 -0
  124. package/build/link/useLinkToPathProps.d.ts +3 -3
  125. package/build/link/useLinkToPathProps.d.ts.map +1 -1
  126. package/build/link/useLinkToPathProps.js +25 -2
  127. package/build/link/useLinkToPathProps.js.map +1 -1
  128. package/build/primitives.d.ts +1 -18
  129. package/build/primitives.d.ts.map +1 -1
  130. package/build/rsc/exports.d.ts +28 -0
  131. package/build/rsc/exports.d.ts.map +1 -1
  132. package/build/rsc/exports.js +82 -1
  133. package/build/rsc/exports.js.map +1 -1
  134. package/build/rsc/middleware.d.ts.map +1 -1
  135. package/build/rsc/middleware.js +50 -14
  136. package/build/rsc/middleware.js.map +1 -1
  137. package/build/rsc/router/client.d.ts +8 -17
  138. package/build/rsc/router/client.d.ts.map +1 -1
  139. package/build/rsc/router/client.js +91 -39
  140. package/build/rsc/router/client.js.map +1 -1
  141. package/build/rsc/rsc-renderer.d.ts +2 -2
  142. package/build/rsc/rsc-renderer.d.ts.map +1 -1
  143. package/build/rsc/rsc-renderer.js +52 -40
  144. package/build/rsc/rsc-renderer.js.map +1 -1
  145. package/build/rsc/runtime.d.ts.map +1 -1
  146. package/build/rsc/runtime.js +4 -2
  147. package/build/rsc/runtime.js.map +1 -1
  148. package/build/rsc/server.d.ts.map +1 -1
  149. package/build/rsc/server.js.map +1 -1
  150. package/build/static/renderStaticContent.d.ts +1 -1
  151. package/build/testing-library/context-stubs.d.ts +4 -9
  152. package/build/testing-library/context-stubs.d.ts.map +1 -1
  153. package/build/testing-library/context-stubs.js.map +1 -1
  154. package/build/testing-library/index.js +2 -2
  155. package/build/testing-library/index.js.map +1 -1
  156. package/build/testing-library/mock-config.d.ts +1 -1
  157. package/build/testing-library/mocks.js +0 -2
  158. package/build/testing-library/mocks.js.map +1 -1
  159. package/build/typed-routes/types.d.ts +80 -25
  160. package/build/typed-routes/types.d.ts.map +1 -1
  161. package/build/typed-routes/types.js.map +1 -1
  162. package/build/types.d.ts +7 -1
  163. package/build/types.d.ts.map +1 -1
  164. package/build/types.js.map +1 -1
  165. package/build/ui/TabContext.d.ts +68 -76
  166. package/build/ui/TabContext.d.ts.map +1 -1
  167. package/build/ui/TabContext.js +1 -0
  168. package/build/ui/TabContext.js.map +1 -1
  169. package/build/ui/TabRouter.d.ts +18 -32
  170. package/build/ui/TabRouter.d.ts.map +1 -1
  171. package/build/ui/TabSlot.d.ts +1 -1
  172. package/build/ui/TabTrigger.d.ts +4 -148
  173. package/build/ui/TabTrigger.d.ts.map +1 -1
  174. package/build/ui/Tabs.d.ts +104 -136
  175. package/build/ui/Tabs.d.ts.map +1 -1
  176. package/build/ui/Tabs.js.map +1 -1
  177. package/build/useFocusEffect.d.ts +24 -4
  178. package/build/useFocusEffect.d.ts.map +1 -1
  179. package/build/useFocusEffect.js +22 -4
  180. package/build/useFocusEffect.js.map +1 -1
  181. package/build/useNavigation.d.ts +44 -3
  182. package/build/useNavigation.d.ts.map +1 -1
  183. package/build/useNavigation.js +44 -3
  184. package/build/useNavigation.js.map +1 -1
  185. package/build/useScreens.d.ts +6 -6
  186. package/build/useScreens.d.ts.map +1 -1
  187. package/build/useScreens.js +5 -0
  188. package/build/useScreens.js.map +1 -1
  189. package/build/views/ErrorBoundary.d.ts +2 -2
  190. package/build/views/ErrorBoundary.d.ts.map +1 -1
  191. package/build/views/ErrorBoundary.js +6 -10
  192. package/build/views/ErrorBoundary.js.map +1 -1
  193. package/build/views/Navigator.d.ts +516 -136
  194. package/build/views/Navigator.d.ts.map +1 -1
  195. package/build/views/Navigator.js +63 -46
  196. package/build/views/Navigator.js.map +1 -1
  197. package/build/views/Sitemap.d.ts.map +1 -1
  198. package/build/views/Sitemap.js +0 -1
  199. package/build/views/Sitemap.js.map +1 -1
  200. package/build/views/Unmatched.d.ts +5 -1
  201. package/build/views/Unmatched.d.ts.map +1 -1
  202. package/build/views/Unmatched.js +5 -1
  203. package/build/views/Unmatched.js.map +1 -1
  204. package/entry-classic.js +10 -0
  205. package/entry.js +3 -10
  206. package/link/index.js +1 -1
  207. package/package.json +20 -16
  208. package/rsc/index.js +1 -0
  209. package/rsc/internal.js +1 -0
  210. package/types/react-navigation.d.ts +2 -0
  211. package/build/fork/NavigationContainer.native.d.ts +0 -21
  212. package/build/fork/NavigationContainer.native.d.ts.map +0 -1
  213. package/build/fork/NavigationContainer.native.js +0 -111
  214. package/build/fork/NavigationContainer.native.js.map +0 -1
  215. package/build/global-state/serverContext.d.ts +0 -10
  216. package/build/global-state/serverContext.d.ts.map +0 -1
  217. package/build/global-state/serverContext.js.map +0 -1
  218. package/build/server-actions.d.ts +0 -4
  219. package/build/server-actions.d.ts.map +0 -1
  220. package/build/server-actions.js +0 -41
  221. package/build/server-actions.js.map +0 -1
  222. /package/{entry-rsc.js → rsc/entry.js} +0 -0
@@ -0,0 +1,17 @@
1
+ // Outside the build dir to preserve the import syntax.
2
+ export async function asyncServerImport(moduleId) {
3
+ // Not running in cloudflare, use Node.js require.
4
+ if (typeof caches === 'undefined') {
5
+ return $$require_external(moduleId);
6
+ }
7
+
8
+ const m = await import(/* @metro-ignore */ moduleId);
9
+
10
+ if ('default' in m && typeof m.default === 'object' && m.default) {
11
+ const def = m.default;
12
+ if ('default' in def && typeof def.default === 'object' && def.default) {
13
+ return def;
14
+ }
15
+ }
16
+ return m;
17
+ }
@@ -13,5 +13,8 @@ export type NativeIntent = {
13
13
  initial: boolean;
14
14
  }) => Promise<string | null | undefined> | string | null | undefined;
15
15
  };
16
+ /**
17
+ * @hidden
18
+ */
16
19
  export declare function ExpoRoot({ wrapper: ParentWrapper, ...props }: ExpoRootProps): React.JSX.Element;
17
20
  //# sourceMappingURL=ExpoRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAK7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtE,CAAC;AAYF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAqBtF"}
1
+ {"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAK7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtE,CAAC;AAYF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAqBtF"}
package/build/ExpoRoot.js CHANGED
@@ -23,17 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  __setModuleDefault(result, mod);
24
24
  return result;
25
25
  };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
26
  Object.defineProperty(exports, "__esModule", { value: true });
30
27
  exports.ExpoRoot = void 0;
31
28
  const react_1 = __importStar(require("react"));
32
29
  const react_native_1 = require("react-native");
33
30
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
34
- const NavigationContainer_1 = __importDefault(require("./fork/NavigationContainer"));
31
+ const NavigationContainer_1 = require("./fork/NavigationContainer");
35
32
  const router_store_1 = require("./global-state/router-store");
36
- const serverContext_1 = __importDefault(require("./global-state/serverContext"));
33
+ const serverLocationContext_1 = require("./global-state/serverLocationContext");
37
34
  const statusbar_1 = require("./utils/statusbar");
38
35
  const Splash_1 = require("./views/Splash");
39
36
  const isTestEnv = process.env.NODE_ENV === 'test';
@@ -43,6 +40,9 @@ const INITIAL_METRICS = react_native_1.Platform.OS === 'web' || isTestEnv
43
40
  insets: { top: 0, left: 0, right: 0, bottom: 0 },
44
41
  }
45
42
  : undefined;
43
+ /**
44
+ * @hidden
45
+ */
46
46
  function ExpoRoot({ wrapper: ParentWrapper = react_1.Fragment, ...props }) {
47
47
  /*
48
48
  * Due to static rendering we need to wrap these top level views in second wrapper
@@ -120,15 +120,15 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
120
120
  }
121
121
  }
122
122
  const Component = store.rootComponent;
123
- return (<NavigationContainer_1.default ref={store.navigationRef} initialState={store.initialState} linking={store.linking} onUnhandledAction={onUnhandledAction} documentTitle={{
123
+ return (<NavigationContainer_1.NavigationContainer ref={store.navigationRef} initialState={store.initialState} linking={store.linking} onUnhandledAction={onUnhandledAction} documentTitle={{
124
124
  enabled: false,
125
125
  }}>
126
- <serverContext_1.default.Provider value={serverContext}>
126
+ <serverLocationContext_1.ServerContext.Provider value={serverContext}>
127
127
  <WrapperComponent>
128
128
  <Component />
129
129
  </WrapperComponent>
130
- </serverContext_1.default.Provider>
131
- </NavigationContainer_1.default>);
130
+ </serverLocationContext_1.ServerContext.Provider>
131
+ </NavigationContainer_1.NavigationContainer>);
132
132
  }
133
133
  let onUnhandledAction;
134
134
  if (process.env.NODE_ENV !== 'production') {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,qFAAqE;AAErE,8DAAsE;AACtE,iFAAgF;AAEhF,iDAA8E;AAC9E,2CAA8C;AAgB9C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAElD,MAAM,eAAe,GACnB,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI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CAAC;QAErC,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,OAAO,EAAE,IAAI,EAAE;oBACjB,OAAO,IAAI,kCAAkC,OAAO,CAAC,IAAI,IAAI,CAAC;iBAC/D;qBAAM;oBACL,OAAO,IAAI,gFAAgF,CAAC;iBAC7F;gBAED,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,KAAK,CAAC;YACX,KAAK,YAAY;gBACf,OAAO,IAAI,wCAAwC,CAAC;gBACpD,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,cAAc,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;SACT;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;CACH;KAAM;IACL,iBAAiB,GAAG,cAAa,CAAC,CAAC;CACpC","sourcesContent":["'use client';\n\nimport { LinkingOptions, NavigationAction } from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport UpstreamNavigationContainer from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport ServerContext, { ServerContextType } from './global-state/serverContext';\nimport { RequireContext } from './types';\nimport { hasViewControllerBasedStatusBarAppearance } from './utils/statusbar';\nimport { SplashScreen } from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useInitializeExpoRouter(context, {\n ...linking,\n serverUrl,\n });\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
1
+ {"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,oEAAgG;AAEhG,8DAAsE;AACtE,gFAAwF;AAExF,iDAA8E;AAC9E,2CAA8C;AAgB9C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAElD,MAAM,eAAe,GACnB,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,SAAS;IAChC,CAAC,CAAC;QACE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QAC1C,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;KACjD;IACH,CAAC,CAAC,SAAS,CAAC;AAEhB;;GAEG;AACH,SAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,gBAAQ,EAAE,GAAG,KAAK,EAAiB;IACrF;;;;OAIG;IACH,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAqB,EAAE,EAAE;QAClD,OAAO,CACL,CAAC,aAAa,CACZ;QAAA,CAAC,iDAAgB;QACf,cAAc;QACd,cAAc,CAAC,CAAC,eAAe,CAAC,CAChC;UAAA,CAAC,wGAAwG,CACzG;UAAA,CAAC,CAAC,qDAAyC,IAAI,CAAC,aAAa,CAAC,AAAD,EAAG,CAChE;UAAA,C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AO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;CACH;KAAM;IACL,iBAAiB,GAAG,cAAa,CAAC,CAAC;CACpC","sourcesContent":["'use client';\n\nimport { LinkingOptions, NavigationAction } from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { RequireContext } from './types';\nimport { hasViewControllerBasedStatusBarAppearance } from './utils/statusbar';\nimport { SplashScreen } from './views/Splash';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useInitializeExpoRouter(context, {\n ...linking,\n serverUrl,\n });\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGnE,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBA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CAAC;CACb,EACD,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CASxC"}
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNormalizedStatePath = exports.getRouteInfoFromState = void 0;
4
- const getPathFromState_1 = require("./fork/getPathFromState");
5
- const getStateFromPath_1 = require("./fork/getStateFromPath");
4
+ const getStateFromPath_forks_1 = require("./fork/getStateFromPath-forks");
6
5
  function getRouteInfoFromState(getPathFromState, state, baseUrl) {
7
6
  const { path } = getPathFromState(state, false);
8
7
  const qualified = getPathFromState(state, true);
9
8
  return {
10
9
  // TODO: This may have a predefined origin attached in the future.
11
10
  unstable_globalHref: path,
12
- pathname: (0, getStateFromPath_1.stripBaseUrl)(path, baseUrl).split('?')['0'],
11
+ pathname: (0, getStateFromPath_forks_1.stripBaseUrl)(path, baseUrl).split('?')['0'],
13
12
  isIndex: isIndexPath(state),
14
13
  ...getNormalizedStatePath(qualified, baseUrl),
15
14
  };
@@ -39,11 +38,31 @@ function getNormalizedStatePath({ path: statePath, params, }, baseUrl) {
39
38
  const [pathname] = statePath.split('?');
40
39
  return {
41
40
  // Strip empty path at the start
42
- segments: (0, getStateFromPath_1.stripBaseUrl)(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent),
41
+ segments: (0, getStateFromPath_forks_1.stripBaseUrl)(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent),
43
42
  // TODO: This is not efficient, we should generate based on the state instead
44
43
  // of converting to string then back to object
45
- params: (0, getPathFromState_1.decodeParams)(params),
44
+ params: decodeParams(params),
46
45
  };
47
46
  }
48
47
  exports.getNormalizedStatePath = getNormalizedStatePath;
48
+ function decodeParams(params) {
49
+ const parsed = {};
50
+ for (const [key, value] of Object.entries(params)) {
51
+ try {
52
+ if (key === 'params' && typeof value === 'object') {
53
+ parsed[key] = decodeParams(value);
54
+ }
55
+ else if (Array.isArray(value)) {
56
+ parsed[key] = value.map((v) => decodeURIComponent(v));
57
+ }
58
+ else {
59
+ parsed[key] = decodeURIComponent(value);
60
+ }
61
+ }
62
+ catch {
63
+ parsed[key] = value;
64
+ }
65
+ }
66
+ return parsed;
67
+ }
49
68
  //# sourceMappingURL=LocationProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;;AAAA,8DAAmE;AACnE,8DAAuD;AAYvD,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF,KAAY,EACZ,OAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO;QACL,kEAAkE;QAClE,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAA,+BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;QACrD,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC;QAC3B,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC;AAfD,sDAeC;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,+EAA+E;IAC/E,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;QAC5C,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,CAAC;KACxC;IAED,yDAAyD;IACzD,+EAA+E;IAC/E,qEAAqE;IACrE,qCAAqC;IACrC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAEhD,2GAA2G;IAC3G,kEAAkE;IAElE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,mEAAmE;AACnE,SAAgB,sBAAsB,CACpC,EACE,IAAI,EAAE,SAAS,EACf,MAAM,GAIP,EACD,OAAgB;IAEhB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,OAAO;QACL,gCAAgC;QAChC,QAAQ,EAAE,IAAA,+BAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC5F,6EAA6E;QAC7E,8CAA8C;QAC9C,MAAM,EAAE,IAAA,+BAAY,EAAC,MAAM,CAAC;KAC7B,CAAC;AACJ,CAAC;AAlBD,wDAkBC","sourcesContent":["import { decodeParams, type State } from './fork/getPathFromState';\nimport { stripBaseUrl } from './fork/getStateFromPath';\n\ntype SearchParams = Record<string, string | string[]>;\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: SearchParams;\n segments: string[];\n isIndex: boolean;\n};\n\nexport function getRouteInfoFromState(\n getPathFromState: (state: State, asPath: boolean) => { path: string; params: any },\n state: State,\n baseUrl?: string\n): UrlObject {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n\n return {\n // TODO: This may have a predefined origin attached in the future.\n unstable_globalHref: path,\n pathname: stripBaseUrl(path, baseUrl).split('?')['0'],\n isIndex: isIndexPath(state),\n ...getNormalizedStatePath(qualified, baseUrl),\n };\n}\n\nfunction isIndexPath(state: State) {\n const route = state.routes[state.index ?? state.routes.length - 1];\n if (route.state) {\n return isIndexPath(route.state);\n }\n\n // Index routes on the same level as a layout do not have `index` in their name\n if (route.params && 'screen' in route.params) {\n return route.params.screen === 'index';\n }\n\n // The `params` key will not exist if there are no params\n // So we need to do a positive lookahead to check if the route ends with /index\n // Nested routes that are hoisted will have a name ending with /index\n // e.g name could be /user/[id]/index\n if (route.name.match(/.+\\/index$/)) return true;\n\n // The state will either have params (because there are multiple _layout) or it will be hoisted with a name\n // If we don't match the above cases, then it's not an index route\n\n return false;\n}\n\n// TODO: Split up getPathFromState to return all this info at once.\nexport function getNormalizedStatePath(\n {\n path: statePath,\n params,\n }: {\n path: string;\n params: any;\n },\n baseUrl?: string\n): Pick<UrlObject, 'segments' | 'params'> {\n const [pathname] = statePath.split('?');\n return {\n // Strip empty path at the start\n segments: stripBaseUrl(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent),\n // TODO: This is not efficient, we should generate based on the state instead\n // of converting to string then back to object\n params: decodeParams(params),\n };\n}\n"]}
1
+ {"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;;AACA,0EAA6D;AAY7D,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF,KAAY,EACZ,OAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO;QACL,kEAAkE;QAClE,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAA,qCAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;QACrD,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC;QAC3B,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC;AAfD,sDAeC;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,KAA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,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBACjD,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;aACnC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;aACvD;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;aACzC;SACF;QAAC,MAAM;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACrB;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { type State } from './fork/getPathFromState';\nimport { stripBaseUrl } from './fork/getStateFromPath-forks';\n\ntype SearchParams = Record<string, string | string[]>;\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: SearchParams;\n segments: string[];\n isIndex: boolean;\n};\n\nexport function getRouteInfoFromState(\n getPathFromState: (state: State, asPath: boolean) => { path: string; params: any },\n state: State,\n baseUrl?: string\n): UrlObject {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n\n return {\n // TODO: This may have a predefined origin attached in the future.\n unstable_globalHref: path,\n pathname: stripBaseUrl(path, baseUrl).split('?')['0'],\n isIndex: isIndexPath(state),\n ...getNormalizedStatePath(qualified, baseUrl),\n };\n}\n\nfunction isIndexPath(state: State) {\n const route = state.routes[state.index ?? state.routes.length - 1];\n if (route.state) {\n return isIndexPath(route.state);\n }\n\n // Index routes on the same level as a layout do not have `index` in their name\n if (route.params && 'screen' in route.params) {\n return route.params.screen === 'index';\n }\n\n // The `params` key will not exist if there are no params\n // So we need to do a positive lookahead to check if the route ends with /index\n // Nested routes that are hoisted will have a name ending with /index\n // e.g name could be /user/[id]/index\n if (route.name.match(/.+\\/index$/)) return true;\n\n // The state will either have params (because there are multiple _layout) or it will be hoisted with a name\n // If we don't match the above cases, then it's not an index route\n\n return false;\n}\n\n// TODO: Split up getPathFromState to return all this info at once.\nexport function getNormalizedStatePath(\n {\n path: statePath,\n params,\n }: {\n path: string;\n params: any;\n },\n baseUrl?: string\n): Pick<UrlObject, 'segments' | 'params'> {\n const [pathname] = statePath.split('?');\n return {\n // Strip empty path at the start\n segments: stripBaseUrl(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent),\n // TODO: This is not efficient, we should generate based on the state instead\n // of converting to string then back to object\n params: decodeParams(params),\n };\n}\n\nfunction decodeParams(params: Record<string, string>) {\n const parsed: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(params)) {\n try {\n if (key === 'params' && typeof value === 'object') {\n parsed[key] = decodeParams(value);\n } else if (Array.isArray(value)) {\n parsed[key] = value.map((v) => decodeURIComponent(v));\n } else {\n parsed[key] = decodeURIComponent(value);\n }\n } catch {\n parsed[key] = value;\n }\n }\n\n return parsed;\n}\n"]}
@@ -1,15 +1,20 @@
1
1
  import { Navigator, Slot } from './views/Navigator';
2
2
  export { useRouter, useUnstableGlobalHref, usePathname, useNavigationContainerRef, useGlobalSearchParams, useLocalSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from './hooks';
3
3
  export { router, Router } from './imperative-api';
4
- export { Link, Redirect, LinkProps } from './link/Link';
4
+ export { Link, Redirect, LinkProps, WebAnchorProps } from './link/Link';
5
5
  export { withLayoutContext } from './layouts/withLayoutContext';
6
6
  export { Navigator, Slot };
7
7
  export { ExpoRoot } from './ExpoRoot';
8
8
  export { Unmatched } from './views/Unmatched';
9
9
  export { ErrorBoundaryProps } from './views/Try';
10
10
  export { ErrorBoundary } from './views/ErrorBoundary';
11
+ export { ScreenProps } from './useScreens';
12
+ /**
13
+ * @hidden
14
+ */
11
15
  export { SplashScreen } from './views/Splash';
12
16
  export { useNavigation } from './useNavigation';
13
- export { useFocusEffect } from './useFocusEffect';
17
+ export { useFocusEffect, EffectCallback } from './useFocusEffect';
18
+ export { ResultState } from './fork/getStateFromPath';
14
19
  export type * from './types';
15
20
  //# sourceMappingURL=exports.d.ts.map
@@ -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,SAAS,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,mBAAmB,SAAS,CAAC"}
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,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,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,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,mBAAmB,SAAS,CAAC"}
package/build/exports.js CHANGED
@@ -30,6 +30,9 @@ Object.defineProperty(exports, "Unmatched", { enumerable: true, get: function ()
30
30
  var ErrorBoundary_1 = require("./views/ErrorBoundary");
31
31
  Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorBoundary; } });
32
32
  // Platform
33
+ /**
34
+ * @hidden
35
+ */
33
36
  var Splash_1 = require("./views/Splash");
34
37
  Object.defineProperty(exports, "SplashScreen", { enumerable: true, get: function () { return Splash_1.SplashScreen; } });
35
38
  // React Navigation
@@ -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,oCAAwD;AAA/C,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAEtB,WAAW;AACX,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n 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, LinkProps } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\n\n// Platform\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect } from './useFocusEffect';\n\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,oCAAwE;AAA/D,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,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,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, 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 { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, EffectCallback } from './useFocusEffect';\nexport { ResultState } from './fork/getStateFromPath';\n\nexport type * from './types';\n"]}
@@ -1,26 +1,23 @@
1
- import { NavigationContainerProps, NavigationContainerRef } from '@react-navigation/core';
2
- import { DocumentTitleOptions, LinkingOptions, Theme } from '@react-navigation/native';
3
- import * as React from 'react';
1
+ import { DocumentTitleOptions, LinkingOptions, LocaleDirection, NavigationContainerProps, NavigationContainerRef } from '@react-navigation/native';
2
+ import React from 'react';
4
3
  declare global {
5
4
  var REACT_NAVIGATION_DEVTOOLS: WeakMap<NavigationContainerRef<any>, {
6
5
  readonly linking: LinkingOptions<any>;
7
6
  }>;
8
7
  }
9
8
  type Props<ParamList extends object> = NavigationContainerProps & {
10
- theme?: Theme;
9
+ direction?: LocaleDirection;
11
10
  linking?: LinkingOptions<ParamList>;
12
11
  fallback?: React.ReactNode;
13
12
  documentTitle?: DocumentTitleOptions;
14
- onReady?: () => void;
15
13
  };
16
- declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: NavigationContainerProps & {
17
- theme?: Theme | undefined;
14
+ export declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: NavigationContainerProps & {
15
+ direction?: LocaleDirection | undefined;
18
16
  linking?: LinkingOptions<RootParamList> | undefined;
19
17
  fallback?: React.ReactNode;
20
18
  documentTitle?: DocumentTitleOptions | undefined;
21
- onReady?: (() => void) | undefined;
22
19
  } & {
23
20
  ref?: React.Ref<NavigationContainerRef<RootParamList>> | undefined;
24
21
  }) => React.ReactElement;
25
- export default NavigationContainer;
22
+ export {};
26
23
  //# sourceMappingURL=NavigationContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,wBAAwB,EACxB,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,oBAAoB,EACpB,cAAc,EAEd,KAAK,EACN,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAC;CACH;AAID,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAuGF,QAAA,MAAM,mBAAmB;;;eA1GZ,MAAM,SAAS;;qBAEV,IAAI;;;MA8GjB,MAAM,YAAY,CAAC;AAExB,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EAEpB,cAAc,EAEd,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EASvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAC;CACH;AAID,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC,CAAC;AAuIF,eAAO,MAAM,mBAAmB;;;eAzInB,MAAM,SAAS;;;;MA+IvB,MAAM,YAAY,CAAC"}
@@ -1,41 +1,18 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- // Forked from React Navigation in order to use a custom `useLinking` function.
30
- // https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/NavigationContainer.tsx
31
- const core_1 = require("@react-navigation/core");
6
+ exports.NavigationContainer = void 0;
32
7
  const native_1 = require("@react-navigation/native");
33
- const useBackButton_1 = __importDefault(require("@react-navigation/native/src/useBackButton"));
34
- const useDocumentTitle_1 = __importDefault(require("@react-navigation/native/src/useDocumentTitle"));
35
- const useThenable_1 = __importDefault(require("@react-navigation/native/src/useThenable"));
36
- const React = __importStar(require("react"));
37
- const useLinking_1 = __importDefault(require("./useLinking"));
38
- global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
8
+ const react_1 = __importDefault(require("react"));
9
+ const react_native_1 = require("react-native");
10
+ const use_latest_callback_1 = __importDefault(require("use-latest-callback"));
11
+ const useBackButton_1 = require("./useBackButton");
12
+ const useDocumentTitle_1 = require("./useDocumentTitle");
13
+ const useLinking_1 = require("./useLinking");
14
+ const useThenable_1 = require("./useThenable");
15
+ globalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
39
16
  /**
40
17
  * Container component which holds the navigation state designed for React Native apps.
41
18
  * This should be rendered at the root wrapping the whole app.
@@ -43,30 +20,56 @@ global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
43
20
  * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).
44
21
  * @param props.onReady Callback which is called after the navigation tree mounts.
45
22
  * @param props.onStateChange Callback which is called with the latest navigation state when it changes.
46
- * @param props.theme Theme object for the navigators.
23
+ * @param props.onUnhandledAction Callback which is called when an action is not handled.
24
+ * @param props.direction Text direction of the components. Defaults to `'ltr'`.
25
+ * @param props.theme Theme object for the UI elements.
47
26
  * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.
48
27
  * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.
49
28
  * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.
50
29
  * @param props.children Child elements to render the content.
51
30
  * @param props.ref Ref object which refers to the navigation object containing helper methods.
52
31
  */
53
- function NavigationContainerInner({ theme = native_1.DefaultTheme, linking, fallback = null, documentTitle, onReady, ...rest }, ref) {
32
+ function NavigationContainerInner({ direction = react_native_1.I18nManager.getConstants().isRTL ? 'rtl' : 'ltr', theme = native_1.DefaultTheme, linking, fallback = null, documentTitle, onReady, onStateChange, ...rest }, ref) {
54
33
  const isLinkingEnabled = linking ? linking.enabled !== false : false;
55
34
  if (linking?.config) {
56
- (0, core_1.validatePathConfig)(linking.config);
35
+ (0, native_1.validatePathConfig)(linking.config);
57
36
  }
58
- const refContainer = React.useRef(null);
59
- (0, useBackButton_1.default)(refContainer);
60
- (0, useDocumentTitle_1.default)(refContainer, documentTitle);
61
- const { getInitialState } = (0, useLinking_1.default)(refContainer, {
62
- independent: rest.independent,
37
+ const refContainer = react_1.default.useRef(null);
38
+ (0, useBackButton_1.useBackButton)(refContainer);
39
+ (0, useDocumentTitle_1.useDocumentTitle)(refContainer, documentTitle);
40
+ const [lastUnhandledLink, setLastUnhandledLink] = react_1.default.useState();
41
+ const { getInitialState } = (0, useLinking_1.useLinking)(refContainer, {
63
42
  enabled: isLinkingEnabled,
64
43
  prefixes: [],
65
44
  ...linking,
45
+ }, setLastUnhandledLink);
46
+ const linkingContext = react_1.default.useMemo(() => ({ options: linking }), [linking]);
47
+ const unhandledLinkingContext = react_1.default.useMemo(() => ({ lastUnhandledLink, setLastUnhandledLink }), [lastUnhandledLink, setLastUnhandledLink]);
48
+ const onReadyForLinkingHandling = (0, use_latest_callback_1.default)(() => {
49
+ // If the screen path matches lastUnhandledLink, we do not track it
50
+ const path = refContainer.current?.getCurrentRoute()?.path;
51
+ setLastUnhandledLink((previousLastUnhandledLink) => {
52
+ if (previousLastUnhandledLink === path) {
53
+ return undefined;
54
+ }
55
+ return previousLastUnhandledLink;
56
+ });
57
+ onReady?.();
58
+ });
59
+ const onStateChangeForLinkingHandling = (0, use_latest_callback_1.default)((state) => {
60
+ // If the screen path matches lastUnhandledLink, we do not track it
61
+ const path = refContainer.current?.getCurrentRoute()?.path;
62
+ setLastUnhandledLink((previousLastUnhandledLink) => {
63
+ if (previousLastUnhandledLink === path) {
64
+ return undefined;
65
+ }
66
+ return previousLastUnhandledLink;
67
+ });
68
+ onStateChange?.(state);
66
69
  });
67
70
  // Add additional linking related info to the ref
68
71
  // This will be used by the devtools
69
- React.useEffect(() => {
72
+ react_1.default.useEffect(() => {
70
73
  if (refContainer.current) {
71
74
  REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {
72
75
  get linking() {
@@ -74,38 +77,29 @@ function NavigationContainerInner({ theme = native_1.DefaultTheme, linking, fall
74
77
  ...linking,
75
78
  enabled: isLinkingEnabled,
76
79
  prefixes: linking?.prefixes ?? [],
77
- getStateFromPath: linking?.getStateFromPath ?? core_1.getStateFromPath,
78
- getPathFromState: linking?.getPathFromState ?? core_1.getPathFromState,
79
- getActionFromState: linking?.getActionFromState ?? core_1.getActionFromState,
80
+ getStateFromPath: linking?.getStateFromPath ?? native_1.getStateFromPath,
81
+ getPathFromState: linking?.getPathFromState ?? native_1.getPathFromState,
82
+ getActionFromState: linking?.getActionFromState ?? native_1.getActionFromState,
80
83
  };
81
84
  },
82
85
  });
83
86
  }
84
87
  });
85
- const [isResolved, initialState] = (0, useThenable_1.default)(getInitialState);
86
- React.useImperativeHandle(ref, () => refContainer.current);
87
- const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);
88
- const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;
89
- const onReadyRef = React.useRef(onReady);
90
- React.useEffect(() => {
91
- onReadyRef.current = onReady;
92
- });
93
- React.useEffect(() => {
94
- if (isReady) {
95
- onReadyRef.current?.();
96
- }
97
- }, [isReady]);
98
- if (!isReady) {
88
+ const [isResolved, initialState] = (0, useThenable_1.useThenable)(getInitialState);
89
+ react_1.default.useImperativeHandle(ref, () => refContainer.current);
90
+ const isLinkingReady = rest.initialState != null || !isLinkingEnabled || isResolved;
91
+ if (!isLinkingReady) {
99
92
  // This is temporary until we have Suspense for data-fetching
100
93
  // Then the fallback will be handled by a parent `Suspense` component
101
- return fallback;
94
+ return <native_1.ThemeProvider value={theme}>{fallback}</native_1.ThemeProvider>;
102
95
  }
103
- return (<native_1.LinkingContext.Provider value={linkingContext}>
104
- <native_1.ThemeProvider value={theme}>
105
- <core_1.BaseNavigationContainer {...rest} initialState={rest.initialState == null ? initialState : rest.initialState} ref={refContainer}/>
106
- </native_1.ThemeProvider>
107
- </native_1.LinkingContext.Provider>);
96
+ return (<native_1.LocaleDirContext.Provider value={direction}>
97
+ <native_1.UNSTABLE_UnhandledLinkingContext.Provider value={unhandledLinkingContext}>
98
+ <native_1.LinkingContext.Provider value={linkingContext}>
99
+ <native_1.BaseNavigationContainer {...rest} theme={theme} onReady={onReadyForLinkingHandling} onStateChange={onStateChangeForLinkingHandling} initialState={rest.initialState == null ? initialState : rest.initialState} ref={refContainer}/>
100
+ </native_1.LinkingContext.Provider>
101
+ </native_1.UNSTABLE_UnhandledLinkingContext.Provider>
102
+ </native_1.LocaleDirContext.Provider>);
108
103
  }
109
- const NavigationContainer = React.forwardRef(NavigationContainerInner);
110
- exports.default = NavigationContainer;
104
+ exports.NavigationContainer = react_1.default.forwardRef(NavigationContainerInner);
111
105
  //# sourceMappingURL=NavigationContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,4GAA4G;AAC5G,iDASgC;AAChC,qDAOkC;AAClC,+FAAuE;AACvE,qGAA6E;AAC7E,2FAAmE;AACnE,6CAA+B;AAE/B,8DAAsC;AAUtC,MAAM,CAAC,y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AAY,CAAC,CAC3E,GAAG,CAAC,CAAC,YAAY,CAAC,EAEtB;MAAA,EAAE,sBAAa,CACjB;IAAA,EAAE,uBAAc,CAAC,QAAQ,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,wBAAwB,CAM9C,CAAC;AAExB,kBAAe,mBAAmB,CAAC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/NavigationContainer.tsx\nimport {\n BaseNavigationContainer,\n getActionFromState,\n getPathFromState,\n getStateFromPath,\n NavigationContainerProps,\n NavigationContainerRef,\n ParamListBase,\n validatePathConfig,\n} from '@react-navigation/core';\nimport {\n DefaultTheme,\n ThemeProvider,\n DocumentTitleOptions,\n LinkingOptions,\n LinkingContext,\n Theme,\n} from '@react-navigation/native';\nimport useBackButton from '@react-navigation/native/src/useBackButton';\nimport useDocumentTitle from '@react-navigation/native/src/useDocumentTitle';\nimport useThenable from '@react-navigation/native/src/useThenable';\nimport * as React from 'react';\n\nimport useLinking from './useLinking';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var REACT_NAVIGATION_DEVTOOLS: WeakMap<\n NavigationContainerRef<any>,\n { readonly linking: LinkingOptions<any> }\n >;\n}\n\nglobal.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends object> = NavigationContainerProps & {\n theme?: Theme;\n linking?: LinkingOptions<ParamList>;\n fallback?: React.ReactNode;\n documentTitle?: DocumentTitleOptions;\n onReady?: () => void;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.theme Theme object for the navigators.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n {\n theme = DefaultTheme,\n linking,\n fallback = null,\n documentTitle,\n onReady,\n ...rest\n }: Props<ParamListBase>,\n ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n if (linking?.config) {\n validatePathConfig(linking.config);\n }\n\n const refContainer = React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n useBackButton(refContainer);\n useDocumentTitle(refContainer, documentTitle);\n\n const { getInitialState } = useLinking(refContainer, {\n independent: rest.independent,\n enabled: isLinkingEnabled,\n prefixes: [],\n ...linking,\n });\n\n // Add additional linking related info to the ref\n // This will be used by the devtools\n React.useEffect(() => {\n if (refContainer.current) {\n REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n get linking() {\n return {\n ...linking,\n enabled: isLinkingEnabled,\n prefixes: linking?.prefixes ?? [],\n getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n getPathFromState: linking?.getPathFromState ?? getPathFromState,\n getActionFromState: linking?.getActionFromState ?? getActionFromState,\n };\n },\n });\n }\n });\n\n const [isResolved, initialState] = useThenable(getInitialState);\n\n React.useImperativeHandle(ref, () => refContainer.current);\n\n const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n\n const onReadyRef = React.useRef(onReady);\n\n React.useEffect(() => {\n onReadyRef.current = onReady;\n });\n\n React.useEffect(() => {\n if (isReady) {\n onReadyRef.current?.();\n }\n }, [isReady]);\n\n if (!isReady) {\n // This is temporary until we have Suspense for data-fetching\n // Then the fallback will be handled by a parent `Suspense` component\n return fallback as React.ReactElement;\n }\n\n return (\n <LinkingContext.Provider value={linkingContext}>\n <ThemeProvider value={theme}>\n <BaseNavigationContainer\n {...rest}\n initialState={rest.initialState == null ? initialState : rest.initialState}\n ref={refContainer}\n />\n </ThemeProvider>\n </LinkingContext.Provider>\n );\n}\n\nconst NavigationContainer = React.forwardRef(NavigationContainerInner) as <\n RootParamList extends object = ReactNavigation.RootParamList,\n>(\n props: Props<RootParamList> & {\n ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n }\n) => React.ReactElement;\n\nexport default NavigationContainer;\n"]}
1
+ {"version":3,"file":"NavigationContainer.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAkBkC;AAClC,kDAA0B;AAC1B,+CAA2C;AAC3C,8EAAoD;AAEpD,mDAAgD;AAChD,yDAAsD;AACtD,6CAA0C;AAC1C,+CAA4C;AAU5C,UAAU,CAAC,yBAAyB,GAAG,IAAI,OAAO,EAAE,CAAC;AASrD;;;;;;;;;;;;;;;GAeG;AACH,SAAS,wBAAwB,CAC/B,EACE,SAAS,GAAG,0BAAW,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAC5D,KAAK,GAAG,qBAAY,EACpB,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,aAAa,EACb,OAAO,EACP,aAAa,EACb,GAAG,IAAI,EACc,EACvB,GAA6D;IAE7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,OAAO,EAAE,MAAM,EAAE;QACnB,IAAA,2BAAkB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACpC;IAED,MAAM,YAAY,GAAG,eAAK,CAAC,MAAM,CAAwC,IAAI,CAAC,CAAC;IAE/E,IAAA,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AAK,CAAC,CAAC,SAAS,CAAC,CAC1C;MAAA,CAAC,yCAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAC/D;QAAA,CAAC,uBAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAC7C;UAAA,CAAC,gCAAuB,CACtB,IAAI,IAAI,CAAC,CACT,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,yBAAyB,CAAC,CACnC,aAAa,CAAC,CAAC,+BAA+B,CAAC,CAC/C,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3E,GAAG,CAAC,CAAC,YAAY,CAAC,EAEtB;QAAA,EAAE,uBAAc,CAAC,QAAQ,CAC3B;MAAA,EAAE,yCAAuB,CAAC,QAAQ,CACpC;IAAA,EAAE,yBAAgB,CAAC,QAAQ,CAAC,CAC7B,CAAC;AACJ,CAAC;AAEY,QAAA,mBAAmB,GAAG,eAAK,CAAC,UAAU,CAAC,wBAAwB,CAMrD,CAAC","sourcesContent":["import {\n BaseNavigationContainer,\n DefaultTheme,\n DocumentTitleOptions,\n LinkingContext,\n LinkingOptions,\n LocaleDirContext,\n LocaleDirection,\n NavigationContainerProps,\n NavigationContainerRef,\n NavigationState,\n ParamListBase,\n ThemeProvider,\n UNSTABLE_UnhandledLinkingContext as UnhandledLinkingContext,\n getActionFromState,\n getPathFromState,\n getStateFromPath,\n validatePathConfig,\n} from '@react-navigation/native';\nimport React from 'react';\nimport { I18nManager } from 'react-native';\nimport useLatestCallback from 'use-latest-callback';\n\nimport { useBackButton } from './useBackButton';\nimport { useDocumentTitle } from './useDocumentTitle';\nimport { useLinking } from './useLinking';\nimport { useThenable } from './useThenable';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var REACT_NAVIGATION_DEVTOOLS: WeakMap<\n NavigationContainerRef<any>,\n { readonly linking: LinkingOptions<any> }\n >;\n}\n\nglobalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends object> = NavigationContainerProps & {\n direction?: LocaleDirection;\n linking?: LinkingOptions<ParamList>;\n fallback?: React.ReactNode;\n documentTitle?: DocumentTitleOptions;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.onUnhandledAction Callback which is called when an action is not handled.\n * @param props.direction Text direction of the components. Defaults to `'ltr'`.\n * @param props.theme Theme object for the UI elements.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n {\n direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',\n theme = DefaultTheme,\n linking,\n fallback = null,\n documentTitle,\n onReady,\n onStateChange,\n ...rest\n }: Props<ParamListBase>,\n ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n if (linking?.config) {\n validatePathConfig(linking.config);\n }\n\n const refContainer = React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n useBackButton(refContainer);\n useDocumentTitle(refContainer, documentTitle);\n\n const [lastUnhandledLink, setLastUnhandledLink] = React.useState<string | undefined>();\n\n const { getInitialState } = useLinking(\n refContainer,\n {\n enabled: isLinkingEnabled,\n prefixes: [],\n ...linking,\n },\n setLastUnhandledLink\n );\n\n const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n const unhandledLinkingContext = React.useMemo(\n () => ({ lastUnhandledLink, setLastUnhandledLink }),\n [lastUnhandledLink, setLastUnhandledLink]\n );\n\n const onReadyForLinkingHandling = useLatestCallback(() => {\n // If the screen path matches lastUnhandledLink, we do not track it\n const path = refContainer.current?.getCurrentRoute()?.path;\n setLastUnhandledLink((previousLastUnhandledLink) => {\n if (previousLastUnhandledLink === path) {\n return undefined;\n }\n return previousLastUnhandledLink;\n });\n onReady?.();\n });\n\n const onStateChangeForLinkingHandling = useLatestCallback(\n (state: Readonly<NavigationState> | undefined) => {\n // If the screen path matches lastUnhandledLink, we do not track it\n const path = refContainer.current?.getCurrentRoute()?.path;\n setLastUnhandledLink((previousLastUnhandledLink) => {\n if (previousLastUnhandledLink === path) {\n return undefined;\n }\n return previousLastUnhandledLink;\n });\n onStateChange?.(state);\n }\n );\n // Add additional linking related info to the ref\n // This will be used by the devtools\n React.useEffect(() => {\n if (refContainer.current) {\n REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n get linking() {\n return {\n ...linking,\n enabled: isLinkingEnabled,\n prefixes: linking?.prefixes ?? [],\n getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n getPathFromState: linking?.getPathFromState ?? getPathFromState,\n getActionFromState: linking?.getActionFromState ?? getActionFromState,\n };\n },\n });\n }\n });\n\n const [isResolved, initialState] = useThenable(getInitialState);\n\n React.useImperativeHandle(ref, () => refContainer.current);\n\n const isLinkingReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n\n if (!isLinkingReady) {\n // This is temporary until we have Suspense for data-fetching\n // Then the fallback will be handled by a parent `Suspense` component\n return <ThemeProvider value={theme}>{fallback}</ThemeProvider>;\n }\n\n return (\n <LocaleDirContext.Provider value={direction}>\n <UnhandledLinkingContext.Provider value={unhandledLinkingContext}>\n <LinkingContext.Provider value={linkingContext}>\n <BaseNavigationContainer\n {...rest}\n theme={theme}\n onReady={onReadyForLinkingHandling}\n onStateChange={onStateChangeForLinkingHandling}\n initialState={rest.initialState == null ? initialState : rest.initialState}\n ref={refContainer}\n />\n </LinkingContext.Provider>\n </UnhandledLinkingContext.Provider>\n </LocaleDirContext.Provider>\n );\n}\n\nexport const NavigationContainer = React.forwardRef(NavigationContainerInner) as <\n RootParamList extends object = ReactNavigation.RootParamList,\n>(\n props: Props<RootParamList> & {\n ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n }\n) => React.ReactElement;\n"]}
@@ -4,7 +4,7 @@ type HistoryRecord = {
4
4
  state: NavigationState;
5
5
  path: string;
6
6
  };
7
- export default function createMemoryHistory(): {
7
+ export declare function createMemoryHistory(): {
8
8
  readonly index: number;
9
9
  get(index: number): HistoryRecord;
10
10
  backIndex({ path }: {
@@ -1 +1 @@
1
- {"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,KAAK,aAAa,GAAG;IAEnB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,eAAe,CAAC;IAEvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB;;eAiC5B,MAAM;;cAIW,MAAM;;;cAaJ,MAAM;eAAS,eAAe;;;cAmB3B,MAAM;eAAS,eAAe;;UAsCzD,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"}
1
+ {"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,KAAK,aAAa,GAAG;IAEnB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,eAAe,CAAC;IAEvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,mBAAmB;;eAiCpB,MAAM;;cAIW,MAAM;;;cAaJ,MAAM;eAAS,eAAe;;;cAmB3B,MAAM;eAAS,eAAe;;UAsCzD,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMemoryHistory = void 0;
3
4
  const non_secure_1 = require("nanoid/non-secure");
4
5
  function createMemoryHistory() {
5
6
  let index = 0;
@@ -176,5 +177,5 @@ function createMemoryHistory() {
176
177
  };
177
178
  return history;
178
179
  }
179
- exports.default = createMemoryHistory;
180
+ exports.createMemoryHistory = createMemoryHistory;
180
181
  //# sourceMappingURL=createMemoryHistory.js.map