expo-router 5.0.2-preview.0 → 5.0.2-preview.2

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 (286) hide show
  1. package/build/ExpoRoot.js +18 -9
  2. package/build/ExpoRoot.js.map +1 -1
  3. package/build/LocationProvider.js +2 -3
  4. package/build/LocationProvider.js.map +1 -1
  5. package/build/Prefetch.d.ts +9 -0
  6. package/build/Prefetch.d.ts.map +1 -0
  7. package/build/Prefetch.js +19 -0
  8. package/build/Prefetch.js.map +1 -0
  9. package/build/Route.js +4 -4
  10. package/build/Route.js.map +1 -1
  11. package/build/doctor/index.js +1 -2
  12. package/build/doctor/index.js.map +1 -1
  13. package/build/exports.js +17 -7
  14. package/build/exports.js.map +1 -1
  15. package/build/fast-refresh.js.map +1 -1
  16. package/build/fork/NavigationContainer.d.ts +2 -7
  17. package/build/fork/NavigationContainer.d.ts.map +1 -1
  18. package/build/fork/NavigationContainer.js.map +1 -1
  19. package/build/fork/createMemoryHistory.d.ts.map +1 -1
  20. package/build/fork/createMemoryHistory.js +1 -2
  21. package/build/fork/createMemoryHistory.js.map +1 -1
  22. package/build/fork/extractPathFromURL.js +3 -4
  23. package/build/fork/extractPathFromURL.js.map +1 -1
  24. package/build/fork/findFocusedRoute.d.ts +1 -11
  25. package/build/fork/findFocusedRoute.d.ts.map +1 -1
  26. package/build/fork/findFocusedRoute.js +1 -2
  27. package/build/fork/findFocusedRoute.js.map +1 -1
  28. package/build/fork/getPathFromState-forks.d.ts.map +1 -1
  29. package/build/fork/getPathFromState-forks.js +24 -14
  30. package/build/fork/getPathFromState-forks.js.map +1 -1
  31. package/build/fork/getPathFromState.js +20 -11
  32. package/build/fork/getPathFromState.js.map +1 -1
  33. package/build/fork/getStateFromPath-forks.d.ts +4 -4
  34. package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
  35. package/build/fork/getStateFromPath-forks.js +18 -19
  36. package/build/fork/getStateFromPath-forks.js.map +1 -1
  37. package/build/fork/getStateFromPath.js +18 -9
  38. package/build/fork/getStateFromPath.js.map +1 -1
  39. package/build/fork/native-stack/NativeStackView.js +1 -2
  40. package/build/fork/native-stack/NativeStackView.js.map +1 -1
  41. package/build/fork/native-stack/createNativeStackNavigator.js +18 -9
  42. package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
  43. package/build/fork/useBackButton.d.ts +0 -1
  44. package/build/fork/useBackButton.d.ts.map +1 -1
  45. package/build/fork/useBackButton.js +1 -2
  46. package/build/fork/useBackButton.js.map +1 -1
  47. package/build/fork/useBackButton.native.js +18 -9
  48. package/build/fork/useBackButton.native.js.map +1 -1
  49. package/build/fork/useDocumentTitle.js +18 -9
  50. package/build/fork/useDocumentTitle.js.map +1 -1
  51. package/build/fork/useDocumentTitle.native.js +1 -2
  52. package/build/fork/useDocumentTitle.native.js.map +1 -1
  53. package/build/fork/useLinking.d.ts +3 -26
  54. package/build/fork/useLinking.d.ts.map +1 -1
  55. package/build/fork/useLinking.js +20 -10
  56. package/build/fork/useLinking.js.map +1 -1
  57. package/build/fork/useLinking.native.d.ts +6 -6
  58. package/build/fork/useLinking.native.js +19 -10
  59. package/build/fork/useLinking.native.js.map +1 -1
  60. package/build/fork/useThenable.js +18 -9
  61. package/build/fork/useThenable.js.map +1 -1
  62. package/build/fork/validatePathConfig.js +1 -1
  63. package/build/fork/validatePathConfig.js.map +1 -1
  64. package/build/getDevServer/index.js.map +1 -1
  65. package/build/getLinkingConfig.js +3 -3
  66. package/build/getLinkingConfig.js.map +1 -1
  67. package/build/getReactNavigationConfig.js +3 -4
  68. package/build/getReactNavigationConfig.js.map +1 -1
  69. package/build/getRoutes.js +3 -3
  70. package/build/getRoutes.js.map +1 -1
  71. package/build/getRoutesCore.js +6 -7
  72. package/build/getRoutesCore.js.map +1 -1
  73. package/build/getRoutesRedirects.d.ts +0 -1
  74. package/build/getRoutesRedirects.d.ts.map +1 -1
  75. package/build/getRoutesRedirects.js +3 -4
  76. package/build/getRoutesRedirects.js.map +1 -1
  77. package/build/getRoutesSSR.js +3 -3
  78. package/build/getRoutesSSR.js.map +1 -1
  79. package/build/getServerManifest.js +2 -3
  80. package/build/getServerManifest.js.map +1 -1
  81. package/build/global-state/routeInfo.js +18 -9
  82. package/build/global-state/routeInfo.js.map +1 -1
  83. package/build/global-state/router-store.d.ts +7 -6
  84. package/build/global-state/router-store.d.ts.map +1 -1
  85. package/build/global-state/router-store.js +24 -13
  86. package/build/global-state/router-store.js.map +1 -1
  87. package/build/global-state/routing.d.ts +1 -0
  88. package/build/global-state/routing.d.ts.map +1 -1
  89. package/build/global-state/routing.js +33 -20
  90. package/build/global-state/routing.js.map +1 -1
  91. package/build/global-state/serverLocationContext.d.ts +0 -1
  92. package/build/global-state/serverLocationContext.d.ts.map +1 -1
  93. package/build/global-state/sort-routes.js +1 -2
  94. package/build/global-state/sort-routes.js.map +1 -1
  95. package/build/head/ExpoHead.android.d.ts +1 -1
  96. package/build/head/ExpoHead.android.js +1 -2
  97. package/build/head/ExpoHead.android.js.map +1 -1
  98. package/build/head/ExpoHead.ios.js.map +1 -1
  99. package/build/head/ExpoHeadModule.js.map +1 -1
  100. package/build/head/url.js +2 -3
  101. package/build/head/url.js.map +1 -1
  102. package/build/hooks.d.ts.map +1 -1
  103. package/build/hooks.js +18 -18
  104. package/build/hooks.js.map +1 -1
  105. package/build/imperative-api.d.ts +4 -0
  106. package/build/imperative-api.d.ts.map +1 -1
  107. package/build/imperative-api.js +1 -0
  108. package/build/imperative-api.js.map +1 -1
  109. package/build/layouts/DrawerClient.d.ts +16 -17
  110. package/build/layouts/DrawerClient.d.ts.map +1 -1
  111. package/build/layouts/RootModal.d.ts +1 -2
  112. package/build/layouts/RootModal.d.ts.map +1 -1
  113. package/build/layouts/RootModal.js +2 -2
  114. package/build/layouts/RootModal.js.map +1 -1
  115. package/build/layouts/StackClient.d.ts +16 -16
  116. package/build/layouts/StackClient.d.ts.map +1 -1
  117. package/build/layouts/StackClient.js.map +1 -1
  118. package/build/layouts/TabsClient.d.ts +12 -12
  119. package/build/layouts/TabsClient.js.map +1 -1
  120. package/build/layouts/withLayoutContext.d.ts +2 -2
  121. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  122. package/build/layouts/withLayoutContext.js +19 -10
  123. package/build/layouts/withLayoutContext.js.map +1 -1
  124. package/build/link/Link.d.ts.map +1 -1
  125. package/build/link/Link.js +10 -5
  126. package/build/link/Link.js.map +1 -1
  127. package/build/link/href.d.ts.map +1 -1
  128. package/build/link/href.js +2 -2
  129. package/build/link/href.js.map +1 -1
  130. package/build/link/linking.d.ts.map +1 -1
  131. package/build/link/linking.js +21 -11
  132. package/build/link/linking.js.map +1 -1
  133. package/build/link/useDomComponentNavigation.js +6 -7
  134. package/build/link/useDomComponentNavigation.js.map +1 -1
  135. package/build/link/useLinkHooks.d.ts +5 -0
  136. package/build/link/useLinkHooks.d.ts.map +1 -1
  137. package/build/link/useLinkHooks.js +2 -2
  138. package/build/link/useLinkHooks.js.map +1 -1
  139. package/build/link/useLinkToPathProps.d.ts.map +1 -1
  140. package/build/link/useLinkToPathProps.js +2 -3
  141. package/build/link/useLinkToPathProps.js.map +1 -1
  142. package/build/link/useLoadedNavigation.d.ts.map +1 -1
  143. package/build/link/useLoadedNavigation.js +2 -3
  144. package/build/link/useLoadedNavigation.js.map +1 -1
  145. package/build/loadStaticParamsAsync.js +3 -4
  146. package/build/loadStaticParamsAsync.js.map +1 -1
  147. package/build/matchers.js +14 -15
  148. package/build/matchers.js.map +1 -1
  149. package/build/onboard/Tutorial.js +1 -2
  150. package/build/onboard/Tutorial.js.map +1 -1
  151. package/build/onboard/createEntryFile.js +2 -3
  152. package/build/onboard/createEntryFile.js.map +1 -1
  153. package/build/qualified-entry.js +1 -2
  154. package/build/qualified-entry.js.map +1 -1
  155. package/build/renderRootComponent.js +18 -9
  156. package/build/renderRootComponent.js.map +1 -1
  157. package/build/routes-manifest.js +1 -2
  158. package/build/routes-manifest.js.map +1 -1
  159. package/build/rsc/entry.js +1 -2
  160. package/build/rsc/entry.js.map +1 -1
  161. package/build/rsc/exports.d.ts +0 -1
  162. package/build/rsc/exports.d.ts.map +1 -1
  163. package/build/rsc/exports.js +18 -18
  164. package/build/rsc/exports.js.map +1 -1
  165. package/build/rsc/middleware.js +2 -3
  166. package/build/rsc/middleware.js.map +1 -1
  167. package/build/rsc/path.d.ts.map +1 -1
  168. package/build/rsc/path.js.map +1 -1
  169. package/build/rsc/router/client.d.ts +7 -7
  170. package/build/rsc/router/client.d.ts.map +1 -1
  171. package/build/rsc/router/client.js +4 -4
  172. package/build/rsc/router/client.js.map +1 -1
  173. package/build/rsc/router/common.js +4 -4
  174. package/build/rsc/router/common.js.map +1 -1
  175. package/build/rsc/router/create-expo-pages.d.ts.map +1 -1
  176. package/build/rsc/router/create-expo-pages.js +1 -2
  177. package/build/rsc/router/create-expo-pages.js.map +1 -1
  178. package/build/rsc/router/create-pages.d.ts +1 -3
  179. package/build/rsc/router/create-pages.d.ts.map +1 -1
  180. package/build/rsc/router/create-pages.js +1 -2
  181. package/build/rsc/router/create-pages.js.map +1 -1
  182. package/build/rsc/router/defineRouter.js +2 -3
  183. package/build/rsc/router/defineRouter.js.map +1 -1
  184. package/build/rsc/router/errors.js.map +1 -1
  185. package/build/rsc/router/expo-definedRouter.d.ts +1 -1
  186. package/build/rsc/router/expo-definedRouter.js.map +1 -1
  187. package/build/rsc/router/fetch.js +1 -2
  188. package/build/rsc/router/fetch.js.map +1 -1
  189. package/build/rsc/router/host.d.ts +3 -3
  190. package/build/rsc/router/host.d.ts.map +1 -1
  191. package/build/rsc/router/host.js.map +1 -1
  192. package/build/rsc/router/noopRouter.d.ts +1 -1
  193. package/build/rsc/router/utils.d.ts.map +1 -1
  194. package/build/rsc/router/utils.js.map +1 -1
  195. package/build/rsc/rsc-renderer.js +1 -2
  196. package/build/rsc/rsc-renderer.js.map +1 -1
  197. package/build/rsc/server.d.ts.map +1 -1
  198. package/build/rsc/server.js +5 -5
  199. package/build/rsc/server.js.map +1 -1
  200. package/build/sortRoutes.d.ts.map +1 -1
  201. package/build/sortRoutes.js +2 -3
  202. package/build/sortRoutes.js.map +1 -1
  203. package/build/static/getRootComponent.js +1 -2
  204. package/build/static/getRootComponent.js.map +1 -1
  205. package/build/static/getServerManifest.js +2 -3
  206. package/build/static/getServerManifest.js.map +1 -1
  207. package/build/static/html.js +2 -3
  208. package/build/static/html.js.map +1 -1
  209. package/build/static/renderStaticContent.js +19 -9
  210. package/build/static/renderStaticContent.js.map +1 -1
  211. package/build/testing-library/context-stubs.d.ts +1 -2
  212. package/build/testing-library/context-stubs.d.ts.map +1 -1
  213. package/build/testing-library/context-stubs.js +3 -3
  214. package/build/testing-library/context-stubs.js.map +1 -1
  215. package/build/testing-library/index.d.ts.map +1 -1
  216. package/build/testing-library/index.js +2 -2
  217. package/build/testing-library/index.js.map +1 -1
  218. package/build/testing-library/mock-config.js +2 -3
  219. package/build/testing-library/mock-config.js.map +1 -1
  220. package/build/testing-library/mocks.js.map +1 -1
  221. package/build/testing-library/require-context-ponyfill.js +1 -1
  222. package/build/testing-library/require-context-ponyfill.js.map +1 -1
  223. package/build/typed-routes/generate.js +4 -5
  224. package/build/typed-routes/generate.js.map +1 -1
  225. package/build/typed-routes/index.d.ts.map +1 -1
  226. package/build/typed-routes/index.js +2 -2
  227. package/build/typed-routes/index.js.map +1 -1
  228. package/build/ui/Slot.d.ts +0 -1
  229. package/build/ui/Slot.d.ts.map +1 -1
  230. package/build/ui/TabContext.d.ts +47 -55
  231. package/build/ui/TabContext.d.ts.map +1 -1
  232. package/build/ui/TabList.js +2 -3
  233. package/build/ui/TabList.js.map +1 -1
  234. package/build/ui/TabRouter.d.ts +27 -27
  235. package/build/ui/TabRouter.d.ts.map +1 -1
  236. package/build/ui/TabRouter.js +18 -9
  237. package/build/ui/TabRouter.js.map +1 -1
  238. package/build/ui/TabSlot.js +4 -5
  239. package/build/ui/TabSlot.js.map +1 -1
  240. package/build/ui/TabTrigger.js +3 -4
  241. package/build/ui/TabTrigger.js.map +1 -1
  242. package/build/ui/Tabs.d.ts +73 -78
  243. package/build/ui/Tabs.d.ts.map +1 -1
  244. package/build/ui/Tabs.js +3 -4
  245. package/build/ui/Tabs.js.map +1 -1
  246. package/build/ui/common.d.ts +2 -3
  247. package/build/ui/common.d.ts.map +1 -1
  248. package/build/ui/common.js +3 -3
  249. package/build/ui/common.js.map +1 -1
  250. package/build/ui/useComponent.d.ts.map +1 -1
  251. package/build/ui/useComponent.js +1 -2
  252. package/build/ui/useComponent.js.map +1 -1
  253. package/build/useDeprecated.js +2 -3
  254. package/build/useDeprecated.js.map +1 -1
  255. package/build/useFocusEffect.js +18 -9
  256. package/build/useFocusEffect.js.map +1 -1
  257. package/build/useNavigation.js +1 -2
  258. package/build/useNavigation.js.map +1 -1
  259. package/build/useScreens.js +5 -6
  260. package/build/useScreens.js.map +1 -1
  261. package/build/utils/splash.js +5 -6
  262. package/build/utils/splash.js.map +1 -1
  263. package/build/utils/url.js +3 -4
  264. package/build/utils/url.js.map +1 -1
  265. package/build/views/EmptyRoute.js +1 -2
  266. package/build/views/EmptyRoute.js.map +1 -1
  267. package/build/views/ErrorBoundary.d.ts +0 -1
  268. package/build/views/ErrorBoundary.d.ts.map +1 -1
  269. package/build/views/ErrorBoundary.js +1 -2
  270. package/build/views/ErrorBoundary.js.map +1 -1
  271. package/build/views/Navigator.js +22 -12
  272. package/build/views/Navigator.js.map +1 -1
  273. package/build/views/Pressable.d.ts.map +1 -1
  274. package/build/views/Screen.js +1 -2
  275. package/build/views/Screen.js.map +1 -1
  276. package/build/views/Sitemap.js +2 -3
  277. package/build/views/Sitemap.js.map +1 -1
  278. package/build/views/SuspenseFallback.js +1 -2
  279. package/build/views/SuspenseFallback.js.map +1 -1
  280. package/build/views/Toast.js +3 -3
  281. package/build/views/Toast.js.map +1 -1
  282. package/build/views/Try.js +17 -7
  283. package/build/views/Try.js.map +1 -1
  284. package/build/views/Unmatched.js +1 -2
  285. package/build/views/Unmatched.js.map +1 -1
  286. package/package.json +4 -4
package/build/ExpoRoot.js CHANGED
@@ -16,15 +16,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
16
16
  }) : function(o, v) {
17
17
  o["default"] = v;
18
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
- };
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
26
36
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.ExpoRoot = void 0;
37
+ exports.ExpoRoot = ExpoRoot;
28
38
  const native_1 = require("@react-navigation/native");
29
39
  const react_1 = __importStar(require("react"));
30
40
  const react_native_1 = require("react-native");
@@ -66,7 +76,6 @@ function ExpoRoot({ wrapper: ParentWrapper = react_1.Fragment, ...props }) {
66
76
  };
67
77
  return <ContextNavigator {...props} wrapper={wrapper}/>;
68
78
  }
69
- exports.ExpoRoot = ExpoRoot;
70
79
  function AutoStatusBar() {
71
80
  return <react_native_1.StatusBar barStyle={(0, react_native_1.useColorScheme)() === 'light' ? 'dark-content' : 'light-content'}/>;
72
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":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C;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 {\n LinkingOptions,\n NavigationAction,\n StackRouter,\n useNavigationBuilder,\n} 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, INTERNAL_SLOT_NAME } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { useDomComponentNavigation } from './link/useDomComponentNavigation';\nimport { Screen } from './primitives';\nimport { RequireContext } from './types';\nimport { canOverrideStatusBarBehavior } from './utils/statusbar';\nimport * as 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 {canOverrideStatusBarBehavior && <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 useDomComponentNavigation(store);\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 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 <Content component={store.rootComponent} />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n );\n}\n\nfunction Content({ component }: { component: ComponentType<any> }) {\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children: <Screen name={INTERNAL_SLOT_NAME} component={component} />,\n });\n\n return <NavigationContent>{descriptors[state.routes[0].key].render()}</NavigationContent>;\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDb,4BAqBC;AApED,qDAKkC;AAClC,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,oEAAgG;AAChG,yDAA4E;AAC5E,8DAAsE;AACtE,gFAAwF;AACxF,gFAA6E;AAC7E,6CAAsC;AAEtC,iDAAiE;AACjE,6DAA+C;AAgB/C,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,wCAA4B,IAAI,CAAC,aAAa,CAAC,AAAD,EAAG,CAClD;UAAA,C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,OAAO,EAAE,IAAI,EAAE,CAAC;oBAClB,OAAO,IAAI,kCAAkC,OAAO,CAAC,IAAI,IAAI,CAAC;gBAChE,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,gFAAgF,CAAC;gBAC9F,CAAC;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;QACV,CAAC;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,iBAAiB,GAAG,cAAa,CAAC,CAAC;AACrC,CAAC","sourcesContent":["'use client';\n\nimport {\n LinkingOptions,\n NavigationAction,\n StackRouter,\n useNavigationBuilder,\n} 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, INTERNAL_SLOT_NAME } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { useDomComponentNavigation } from './link/useDomComponentNavigation';\nimport { Screen } from './primitives';\nimport { RequireContext } from './types';\nimport { canOverrideStatusBarBehavior } from './utils/statusbar';\nimport * as 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 {canOverrideStatusBarBehavior && <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 useDomComponentNavigation(store);\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 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 <Content component={store.rootComponent} />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n );\n}\n\nfunction Content({ component }: { component: ComponentType<any> }) {\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children: <Screen name={INTERNAL_SLOT_NAME} component={component} />,\n });\n\n return <NavigationContent>{descriptors[state.routes[0].key].render()}</NavigationContent>;\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,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNormalizedStatePath = exports.getRouteInfoFromState = void 0;
3
+ exports.getRouteInfoFromState = getRouteInfoFromState;
4
+ exports.getNormalizedStatePath = getNormalizedStatePath;
4
5
  const getStateFromPath_forks_1 = require("./fork/getStateFromPath-forks");
5
6
  function getRouteInfoFromState(getPathFromState, state, baseUrl) {
6
7
  const { path } = getPathFromState(state, false);
@@ -13,7 +14,6 @@ function getRouteInfoFromState(getPathFromState, state, baseUrl) {
13
14
  ...getNormalizedStatePath(qualified, baseUrl),
14
15
  };
15
16
  }
16
- exports.getRouteInfoFromState = getRouteInfoFromState;
17
17
  function isIndexPath(state) {
18
18
  const route = state.routes[state.index ?? state.routes.length - 1];
19
19
  if (route.state) {
@@ -44,7 +44,6 @@ function getNormalizedStatePath({ path: statePath, params, }, baseUrl) {
44
44
  params: decodeParams(params),
45
45
  };
46
46
  }
47
- exports.getNormalizedStatePath = getNormalizedStatePath;
48
47
  function decodeParams(params) {
49
48
  const parsed = {};
50
49
  for (const [key, value] of Object.entries(params)) {
@@ -1 +1 @@
1
- {"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;;AACA,0EAA6D;AAY7D,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF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AAC,GAAG,CAAC,CAAC;IACxC,OAAO;QACL,gCAAgC;QAChC,QAAQ,EAAE,IAAA,qCAAY,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,YAAY,CAAC,MAAM,CAAC;KAC7B,CAAC;AACJ,CAAC;AAlBD,wDAkBC;AAED,SAAS,YAAY,CAAC,MAA8B;IAClD,MAAM,MAAM,GAAwB,EAAE,CAAC;IAEvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACjD,IAAI;YACF,IAAI,GAAG,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
+ {"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],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Url } 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"]}
@@ -0,0 +1,9 @@
1
+ import { Href } from './types';
2
+ export type PreloadProps = {
3
+ href: Href;
4
+ };
5
+ /**
6
+ * When rendered on a focused screen, this component will preload the specified route.
7
+ */
8
+ export declare function Prefetch(props: PreloadProps): null;
9
+ //# sourceMappingURL=Prefetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Prefetch.d.ts","sourceRoot":"","sources":["../src/Prefetch.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,QAU3C"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Prefetch = Prefetch;
4
+ const react_1 = require("react");
5
+ const imperative_api_1 = require("./imperative-api");
6
+ const useLoadedNavigation_1 = require("./link/useLoadedNavigation");
7
+ /**
8
+ * When rendered on a focused screen, this component will preload the specified route.
9
+ */
10
+ function Prefetch(props) {
11
+ const navigation = (0, useLoadedNavigation_1.useOptionalNavigation)();
12
+ (0, react_1.useLayoutEffect)(() => {
13
+ if (navigation?.isFocused()) {
14
+ imperative_api_1.router.prefetch(props.href);
15
+ }
16
+ }, [navigation, props.href]);
17
+ return null;
18
+ }
19
+ //# sourceMappingURL=Prefetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Prefetch.js","sourceRoot":"","sources":["../src/Prefetch.tsx"],"names":[],"mappings":";;AAaA,4BAUC;AAvBD,iCAAwC;AAExC,qDAA0C;AAC1C,oEAAmE;AAOnE;;GAEG;AACH,SAAgB,QAAQ,CAAC,KAAmB;IAC1C,MAAM,UAAU,GAAG,IAAA,2CAAqB,GAAE,CAAC;IAE3C,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,IAAI,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;YAC5B,uBAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAE7B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { useLayoutEffect } from 'react';\n\nimport { router } from './imperative-api';\nimport { useOptionalNavigation } from './link/useLoadedNavigation';\nimport { Href } from './types';\n\nexport type PreloadProps = {\n href: Href;\n};\n\n/**\n * When rendered on a focused screen, this component will preload the specified route.\n */\nexport function Prefetch(props: PreloadProps) {\n const navigation = useOptionalNavigation();\n\n useLayoutEffect(() => {\n if (navigation?.isFocused()) {\n router.prefetch(props.href);\n }\n }, [navigation, props.href]);\n\n return null;\n}\n"]}
package/build/Route.js CHANGED
@@ -1,7 +1,10 @@
1
1
  'use client';
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.sortRoutes = exports.sortRoutesWithInitial = exports.Route = exports.useContextKey = exports.useRouteNode = exports.LocalRouteParamsContext = void 0;
4
+ exports.sortRoutes = exports.sortRoutesWithInitial = exports.LocalRouteParamsContext = void 0;
5
+ exports.useRouteNode = useRouteNode;
6
+ exports.useContextKey = useContextKey;
7
+ exports.Route = Route;
5
8
  const react_1 = require("react");
6
9
  const matchers_1 = require("./matchers");
7
10
  const sortRoutes_1 = require("./sortRoutes");
@@ -16,7 +19,6 @@ if (process.env.NODE_ENV !== 'production') {
16
19
  function useRouteNode() {
17
20
  return (0, react_1.useContext)(CurrentRouteContext);
18
21
  }
19
- exports.useRouteNode = useRouteNode;
20
22
  function useContextKey() {
21
23
  const node = useRouteNode();
22
24
  if (node == null) {
@@ -24,12 +26,10 @@ function useContextKey() {
24
26
  }
25
27
  return (0, matchers_1.getContextKey)(node.contextKey);
26
28
  }
27
- exports.useContextKey = useContextKey;
28
29
  /** Provides the matching routes and filename to the children. */
29
30
  function Route({ children, node, route }) {
30
31
  return (<exports.LocalRouteParamsContext.Provider value={route?.params}>
31
32
  <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>
32
33
  </exports.LocalRouteParamsContext.Provider>);
33
34
  }
34
- exports.Route = Route;
35
35
  //# sourceMappingURL=Route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,iCAA8F;AAE9F,yCAA2C;AAC3C,6CAAiE;AAgFxD,sGAhFA,kCAAqB,OAgFA;AAAE,2FAhFA,uBAAU,OAgFA;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' | 'redirect' | 'rewrite';\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 /** Redirect Context Module ID, used for matching children. */\n destinationContextKey?: string;\n /** Is the redirect permanent. */\n permanent?: boolean;\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 /** HTTP methods for this route. If undefined, assumed to be ['GET'] */\n methods?: 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"]}
1
+ {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AA2Db,oCAEC;AAED,sCAMC;AAQD,sBAMC;AAjFD,iCAA8F;AAE9F,yCAA2C;AAC3C,6CAAiE;AAgFxD,sGAhFA,kCAAqB,OAgFA;AAAE,2FAhFA,uBAAU,OAgFA;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,CAAC;IAC1C,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;AAChD,CAAC;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;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","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' | 'redirect' | 'rewrite';\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 /** Redirect Context Module ID, used for matching children. */\n destinationContextKey?: string;\n /** Is the redirect permanent. */\n permanent?: boolean;\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 /** HTTP methods for this route. If undefined, assumed to be ['GET'] */\n methods?: 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"]}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.doctor = void 0;
6
+ exports.doctor = doctor;
7
7
  const debug_1 = __importDefault(require("debug"));
8
8
  const subset_1 = __importDefault(require("semver/ranges/subset"));
9
9
  const debug = (0, debug_1.default)('expo:router:doctor');
@@ -62,5 +62,4 @@ function doctor(pkg, appReactNavigationPath,
62
62
  }
63
63
  return incorrectDependencies;
64
64
  }
65
- exports.doctor = doctor;
66
65
  //# sourceMapp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ED,KAAK,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,kBAAkB,EAAE;QACpD,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACzB,KAAK,CAAC,YAAY,GAAG,uCAAuC,CAAC,CAAC;YAC9D,SAAS;SACV;QAED,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAE7C;;;;WAIG;QACH,IAAI,CAAC,UAAU,EAAE;YACf,SAAS;SACV;QAED,KAAK,CAAC,YAAY,GAAG,SAAS,YAAY,cAAc,UAAU,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,UAAU,IAAI,IAAA,gBAAiB,EAAC,YAAY,EAAE,UAAU,CAAC,EAAE;YAC9D,SAAS;SACV;QAED,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;QAE/C,qBAAqB,CAAC,IAAI,CAAC;YACzB,WAAW,EAAE,GAAG;YAChB,WAAW,EAAE,GAAG,CAAC,YAAY,IAAI,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB;YAC7F,sBAAsB,EAAE,YAAY;YACpC,aAAa,EAAE,UAAU;SAC1B,CAAC,CAAC;KACJ;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AArED,wBAqEC","sourcesContent":["import createDebug from 'debug';\nimport type { PackageJSONConfig } from 'expo/config';\nimport semverRangeSubset from 'semver/ranges/subset';\n\nconst debug = createDebug('expo:router:doctor');\n\n/**\n * Small hack to get the package.json.\n * We do no use import() as this would require changing the rootDir in `tsconfig.json`,\n * which in turn will change the structure of the outDir.\n */\nconst routerPkg: PackageJSONConfig = require('../../package.json');\n\nconst routerDependencies = Object.entries<string>(\n Object.assign({}, routerPkg.dependencies, routerPkg.peerDependencies)\n).filter((entry) => entry[0].startsWith('@react-navigation') && entry[1] !== '*');\n\ntype IncorrectDependency = {\n packageName: string;\n packageType: 'dependencies' | 'devDependencies';\n expectedVersionOrRange: string;\n actualVersion: string;\n};\n\nexport function doctor(\n pkg: PackageJSONConfig,\n appReactNavigationPath: string,\n // Reuse the formatting functions from expo-cli\n {\n bold,\n learnMore,\n }: {\n bold: (text: string) => string;\n learnMore: (url: string, options?: { learnMoreMessage?: string; dim?: boolean }) => string;\n }\n): IncorrectDependency[] {\n const resolvedDependencies = { ...pkg.dependencies, ...pkg.devDependencies };\n const libReactNavigationPath = require.resolve('@react-navigation/native');\n\n const userExcluded = new Set(pkg.expo?.install?.exclude);\n const incorrectDependencies: IncorrectDependency[] = [];\n\n /**\n * If the user has a dependency with a sub-dependency on @react-navigation/native, this may install a different\n * version of @react-navigation/native than the one required by expo-router.\n *\n * To detect this, we require the caller of this function to first resolve their path to @react-navigation/native, as\n * they will get the 'top' level package. When expo-router resolves the path to @react-navigation/native, if it is different\n * when the versions must not have matched and the package manager installed a nested node_module folder with a different\n * version of @react-navigation/native.\n */\n if (\n userExcluded.has('@react-navigation/native') &&\n appReactNavigationPath !== libReactNavigationPath\n ) {\n console.warn(\n `Detected multiple versions of ${bold('@react-navigation/native')} in your ${bold('node_modules')}. This may lead to unexpected navigation behavior and errors. ${learnMore('https://expo.fyi/router-navigation-deps')}.`\n );\n }\n\n for (const [dep, allowedRange] of routerDependencies) {\n if (userExcluded.has(dep)) {\n debug(`Skipping ${dep} because it is excluded in the config`);\n continue;\n }\n\n const usersRange = resolvedDependencies[dep];\n\n /**\n * routerDependencies contains all the dependencies that are required by expo-router,\n * both peerDependencies and dependencies. If the user has not manually installed\n * them, then we should skip them.\n */\n if (!usersRange) {\n continue;\n }\n\n debug(`Checking ${dep} with ${allowedRange} and found ${usersRange}`);\n if (!usersRange || semverRangeSubset(allowedRange, usersRange)) {\n continue;\n }\n\n debug(`Incorrect dependency found for ${dep}`);\n\n incorrectDependencies.push({\n packageName: dep,\n packageType: pkg.dependencies && dep in pkg.dependencies ? 'dependencies' : 'devDependencies',\n expectedVersionOrRange: allowedRange,\n actualVersion: usersRange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CAAC,GAAG,CAC1N,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,kBAAkB,EAAE,CAAC;QACrD,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,KAAK,CAAC,YAAY,GAAG,uCAAuC,CAAC,CAAC;YAC9D,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAE7C;;;;WAIG;QACH,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,SAAS;QACX,CAAC;QAED,KAAK,CAAC,YAAY,GAAG,SAAS,YAAY,cAAc,UAAU,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,UAAU,IAAI,IAAA,gBAAiB,EAAC,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC;YAC/D,SAAS;QACX,CAAC;QAED,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;QAE/C,qBAAqB,CAAC,IAAI,CAAC;YACzB,WAAW,EAAE,GAAG;YAChB,WAAW,EAAE,GAAG,CAAC,YAAY,IAAI,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB;YAC7F,sBAAsB,EAAE,YAAY;YACpC,aAAa,EAAE,UAAU;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["import createDebug from 'debug';\nimport type { PackageJSONConfig } from 'expo/config';\nimport semverRangeSubset from 'semver/ranges/subset';\n\nconst debug = createDebug('expo:router:doctor');\n\n/**\n * Small hack to get the package.json.\n * We do no use import() as this would require changing the rootDir in `tsconfig.json`,\n * which in turn will change the structure of the outDir.\n */\nconst routerPkg: PackageJSONConfig = require('../../package.json');\n\nconst routerDependencies = Object.entries<string>(\n Object.assign({}, routerPkg.dependencies, routerPkg.peerDependencies)\n).filter((entry) => entry[0].startsWith('@react-navigation') && entry[1] !== '*');\n\ntype IncorrectDependency = {\n packageName: string;\n packageType: 'dependencies' | 'devDependencies';\n expectedVersionOrRange: string;\n actualVersion: string;\n};\n\nexport function doctor(\n pkg: PackageJSONConfig,\n appReactNavigationPath: string,\n // Reuse the formatting functions from expo-cli\n {\n bold,\n learnMore,\n }: {\n bold: (text: string) => string;\n learnMore: (url: string, options?: { learnMoreMessage?: string; dim?: boolean }) => string;\n }\n): IncorrectDependency[] {\n const resolvedDependencies = { ...pkg.dependencies, ...pkg.devDependencies };\n const libReactNavigationPath = require.resolve('@react-navigation/native');\n\n const userExcluded = new Set(pkg.expo?.install?.exclude);\n const incorrectDependencies: IncorrectDependency[] = [];\n\n /**\n * If the user has a dependency with a sub-dependency on @react-navigation/native, this may install a different\n * version of @react-navigation/native than the one required by expo-router.\n *\n * To detect this, we require the caller of this function to first resolve their path to @react-navigation/native, as\n * they will get the 'top' level package. When expo-router resolves the path to @react-navigation/native, if it is different\n * when the versions must not have matched and the package manager installed a nested node_module folder with a different\n * version of @react-navigation/native.\n */\n if (\n userExcluded.has('@react-navigation/native') &&\n appReactNavigationPath !== libReactNavigationPath\n ) {\n console.warn(\n `Detected multiple versions of ${bold('@react-navigation/native')} in your ${bold('node_modules')}. This may lead to unexpected navigation behavior and errors. ${learnMore('https://expo.fyi/router-navigation-deps')}.`\n );\n }\n\n for (const [dep, allowedRange] of routerDependencies) {\n if (userExcluded.has(dep)) {\n debug(`Skipping ${dep} because it is excluded in the config`);\n continue;\n }\n\n const usersRange = resolvedDependencies[dep];\n\n /**\n * routerDependencies contains all the dependencies that are required by expo-router,\n * both peerDependencies and dependencies. If the user has not manually installed\n * them, then we should skip them.\n */\n if (!usersRange) {\n continue;\n }\n\n debug(`Checking ${dep} with ${allowedRange} and found ${usersRange}`);\n if (!usersRange || semverRangeSubset(allowedRange, usersRange)) {\n continue;\n }\n\n debug(`Incorrect dependency found for ${dep}`);\n\n incorrectDependencies.push({\n packageName: dep,\n packageType: pkg.dependencies && dep in pkg.dependencies ? 'dependencies' : 'devDependencies',\n expectedVersionOrRange: allowedRange,\n actualVersion: usersRange,\n });\n }\n\n return incorrectDependencies;\n}\n"]}
package/build/exports.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  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
37
  // Expo Router API
@@ -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;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 { RedirectConfig } from './getRoutesCore';\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 { RedirectConfig } from './getRoutesCore';\n\nexport type * from './types';\n"]}
@@ -1 +1 @@
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
+ {"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,CAAC;IAC3C;IACE,gCAAgC;IAChC,OAAO,uBAAuB,KAAK,WAAW;QAC9C,4CAA4C;QAC5C,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,EAClD,CAAC;QACD,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,CAAC;oBACH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,IAAI,mBAAmB,IAAI,KAAK,EAAE,CAAC;4BACjC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;wBACjD,CAAC;wBACD,IAAI,eAAe,IAAI,KAAK,EAAE,CAAC;4BAC7B,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;wBAC7C,CAAC;wBACD,IAAI,sBAAsB,IAAI,KAAK,EAAE,CAAC;4BACpC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;wBACpD,CAAC;oBACH,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,6EAA6E;oBAC7E,8EAA8E;oBAC9E,4EAA4E;oBAC5E,4CAA4C;gBAC9C,CAAC;gBACD,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","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"]}
@@ -11,13 +11,8 @@ type Props<ParamList extends object> = NavigationContainerProps & {
11
11
  fallback?: React.ReactNode;
12
12
  documentTitle?: DocumentTitleOptions;
13
13
  };
14
- export declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: NavigationContainerProps & {
15
- direction?: LocaleDirection | undefined;
16
- linking?: LinkingOptions<RootParamList> | undefined;
17
- fallback?: React.ReactNode;
18
- documentTitle?: DocumentTitleOptions | undefined;
19
- } & {
20
- ref?: React.Ref<NavigationContainerRef<RootParamList>> | undefined;
14
+ export declare const NavigationContainer: <RootParamList extends object = ReactNavigation.RootParamList>(props: Props<RootParamList> & {
15
+ ref?: React.Ref<NavigationContainerRef<RootParamList>>;
21
16
  }) => React.ReactElement;
22
17
  export {};
23
18
  //# sourceMappingURL=NavigationContainer.d.ts.map
@@ -1 +1 @@
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
+ {"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,C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,CAAC;IAEpF,IAAI,CAAC,cAAc,EAAE;QACnB,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,CAAC,sBAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,sBAAa,CAAC,CAAC;KAChE;IAED,OAAO,CACL,CAAC,yBAAgB,CAAC,QAAQ,CAAC,KAAK,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>(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"]}
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,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U,CAAC;IAEpF,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,CAAC,sBAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,sBAAa,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,CACL,CAAC,yBAAgB,CAAC,QAAQ,CAAC,KAAK,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>(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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAIA,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;;UAoCzD,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"}
1
+ {"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAIA,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;oBAmBlB,MAAM;eAcR,MAAM;wBAIG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;0BAad;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;6BAmBrC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;UAoC3D,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMemoryHistory = void 0;
3
+ exports.createMemoryHistory = createMemoryHistory;
4
4
  const non_secure_1 = require("nanoid/non-secure");
5
5
  function createMemoryHistory() {
6
6
  let index = 0;
@@ -177,5 +177,4 @@ function createMemoryHistory() {
177
177
  };
178
178
  return history;
179
179
  }
180
- exports.createMemoryHistory = createMemoryHistory;
181
180
  //# sourceMappingURL=createMemoryHistory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;;AAKA,kDAA2C;AAW3C,SAAgB,mBAAmB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAuF;QACvF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACjB,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,C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AAC,CAAC;gBAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;gBAChD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,gGAAgG;QAChG,iFAAiF;QACjF,4GAA4G;QAC5G,MAAM,CAAC,QAAoB;YACzB,MAAM,UAAU,GAAG,GAAG,EAAE;gBACtB,IAAI,OAAO,CAAC,MAAM,EAAE;oBAClB,wEAAwE;oBACxE,OAAO;iBACR;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AArND,kDAqNC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Currently no forked behaviour.\nimport type { NavigationState } from '@react-navigation/core';\nimport { nanoid } from 'nanoid/non-secure';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n let pathWithHash = path;\n const hash = pathWithHash.includes('#') ? '' : location.hash;\n\n if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // There are two scenarios for creating an array with only one history record:\n // - When loaded id not found in the items array, this function by default will replace\n // the first item. We need to keep only the new updated object, otherwise it will break\n // the page when navigating forward in history.\n // - This is the first time any state modifications are done\n // So we need to push the entry as there's nothing to replace\n\n pathWithHash = pathWithHash + hash;\n items = [{ path: pathWithHash, state, id }];\n index = 0;\n } else {\n if (items[index].path === path) {\n pathWithHash = pathWithHash + hash;\n }\n items[index] = { path, state, id };\n }\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]}
1
+ {"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;AAgBA,kDAqNC;AAhOD,kDAA2C;AAW3C,SAAgB,mBAAmB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAuF;QACvF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACjB,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,IAAI,KAAK;YACP,kDAAkD;YAClD,oEAAoE;YACpE,MAAM,EAAE,GA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IAAI,EAAE,EAAE,EAAE,CAAC;gBACb,CAAC,CAAC;gBAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;gBAChD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,gGAAgG;QAChG,iFAAiF;QACjF,4GAA4G;QAC5G,MAAM,CAAC,QAAoB;YACzB,MAAM,UAAU,GAAG,GAAG,EAAE;gBACtB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,wEAAwE;oBACxE,OAAO;gBACT,CAAC;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Currently no forked behaviour.\nimport type { NavigationState } from '@react-navigation/core';\nimport { nanoid } from 'nanoid/non-secure';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n let pathWithHash = path;\n const hash = pathWithHash.includes('#') ? '' : location.hash;\n\n if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // There are two scenarios for creating an array with only one history record:\n // - When loaded id not found in the items array, this function by default will replace\n // the first item. We need to keep only the new updated object, otherwise it will break\n // the page when navigating forward in history.\n // - This is the first time any state modifications are done\n // So we need to push the entry as there's nothing to replace\n\n pathWithHash = pathWithHash + hash;\n items = [{ path: pathWithHash, state, id }];\n index = 0;\n } else {\n if (items[index].path === path) {\n pathWithHash = pathWithHash + hash;\n }\n items[index] = { path, state, id };\n }\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractExpoPathFromURL = exports.parsePathFromExpoGoLink = exports.parsePathAndParamsFromExpoGoLink = void 0;
3
+ exports.parsePathAndParamsFromExpoGoLink = parsePathAndParamsFromExpoGoLink;
4
+ exports.parsePathFromExpoGoLink = parsePathFromExpoGoLink;
5
+ exports.extractExpoPathFromURL = extractExpoPathFromURL;
4
6
  function parsePathAndParamsFromExpoGoLink(url) {
5
7
  // If the URL is defined (default in Expo Go dev apps) and the URL has no path:
6
8
  // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
@@ -11,13 +13,11 @@ function parsePathAndParamsFromExpoGoLink(url) {
11
13
  queryString: results?.[2] ?? '',
12
14
  };
13
15
  }
14
- exports.parsePathAndParamsFromExpoGoLink = parsePathAndParamsFromExpoGoLink;
15
16
  function parsePathFromExpoGoLink(url) {
16
17
  // If the URL is defined (default in Expo Go dev apps) and the URL has no path:
17
18
  // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
18
19
  return url.match(/exps?:\/\/.*?\/--\/(.*)/)?.[1] ?? '';
19
20
  }
20
- exports.parsePathFromExpoGoLink = parsePathFromExpoGoLink;
21
21
  // This is only run on native.
22
22
  function extractExactPathFromURL(url) {
23
23
  if (
@@ -103,5 +103,4 @@ function extractExpoPathFromURL(_prefixes, url = '') {
103
103
  // TODO: We should get rid of this, dropping specificities is not good
104
104
  .replace(/^\//, ''));
105
105
  }
106
- exports.extractExpoPathFromURL = extractExpoPathFromURL;
107
106
  //# sourceMappingURL=extractPathFromURL.js.map