expo-router 6.0.0-beta.0 → 6.0.0-beta.10

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 (140) hide show
  1. package/assets/modal.module.css +15 -14
  2. package/assets/native-tabs.module.css +109 -0
  3. package/build/ExpoRoot.d.ts.map +1 -1
  4. package/build/ExpoRoot.js +0 -2
  5. package/build/ExpoRoot.js.map +1 -1
  6. package/build/fork/NavigationContainer.d.ts.map +1 -1
  7. package/build/fork/NavigationContainer.js +2 -0
  8. package/build/fork/NavigationContainer.js.map +1 -1
  9. package/build/fork/extractPathFromURL.d.ts.map +1 -1
  10. package/build/fork/extractPathFromURL.js +4 -0
  11. package/build/fork/extractPathFromURL.js.map +1 -1
  12. package/build/fork/getPathFromState.d.ts.map +1 -1
  13. package/build/fork/getPathFromState.js +2 -0
  14. package/build/fork/getPathFromState.js.map +1 -1
  15. package/build/global-state/routing.d.ts +6 -5
  16. package/build/global-state/routing.d.ts.map +1 -1
  17. package/build/global-state/routing.js +20 -14
  18. package/build/global-state/routing.js.map +1 -1
  19. package/build/head/ExpoHead.android.d.ts +1 -3
  20. package/build/imperative-api.d.ts +3 -1
  21. package/build/imperative-api.d.ts.map +1 -1
  22. package/build/imperative-api.js +4 -4
  23. package/build/imperative-api.js.map +1 -1
  24. package/build/layouts/DrawerClient.d.ts +2 -12
  25. package/build/layouts/DrawerClient.d.ts.map +1 -1
  26. package/build/layouts/StackClient.d.ts +14 -19
  27. package/build/layouts/StackClient.d.ts.map +1 -1
  28. package/build/layouts/StackClient.js +27 -25
  29. package/build/layouts/StackClient.js.map +1 -1
  30. package/build/layouts/TabsClient.d.ts +3 -18
  31. package/build/layouts/TabsClient.d.ts.map +1 -1
  32. package/build/layouts/withLayoutContext.d.ts +5 -1
  33. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  34. package/build/layouts/withLayoutContext.js +19 -6
  35. package/build/layouts/withLayoutContext.js.map +1 -1
  36. package/build/link/ExpoLink.d.ts.map +1 -1
  37. package/build/link/ExpoLink.js +4 -1
  38. package/build/link/ExpoLink.js.map +1 -1
  39. package/build/link/LinkWithPreview.d.ts.map +1 -1
  40. package/build/link/LinkWithPreview.js +19 -24
  41. package/build/link/LinkWithPreview.js.map +1 -1
  42. package/build/link/elements.d.ts +2 -10
  43. package/build/link/elements.d.ts.map +1 -1
  44. package/build/link/elements.js +1 -1
  45. package/build/link/elements.js.map +1 -1
  46. package/build/link/preview/native.d.ts +0 -2
  47. package/build/link/preview/native.d.ts.map +1 -1
  48. package/build/link/preview/native.js +1 -11
  49. package/build/link/preview/native.js.map +1 -1
  50. package/build/link/preview/utils.d.ts.map +1 -1
  51. package/build/link/preview/utils.js +5 -2
  52. package/build/link/preview/utils.js.map +1 -1
  53. package/build/modal/web/ModalStackRouteDrawer.js +9 -10
  54. package/build/modal/web/ModalStackRouteDrawer.js.map +1 -1
  55. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +1 -0
  56. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -1
  57. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +61 -9
  58. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -1
  59. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -1
  60. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +6 -27
  61. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -1
  62. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts +11 -3
  63. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
  64. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +154 -62
  65. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
  66. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +3 -2
  67. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -1
  68. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts +24 -0
  69. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
  70. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js +28 -0
  71. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +1 -0
  72. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +1 -1
  73. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
  74. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +114 -38
  75. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
  76. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts +4 -0
  77. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +1 -0
  78. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js +158 -0
  79. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +1 -0
  80. package/build/native-tabs/NativeBottomTabs/appearance.d.ts +20 -0
  81. package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +1 -0
  82. package/build/native-tabs/NativeBottomTabs/appearance.js +119 -0
  83. package/build/native-tabs/NativeBottomTabs/appearance.js.map +1 -0
  84. package/build/native-tabs/NativeBottomTabs/types.d.ts +312 -46
  85. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
  86. package/build/native-tabs/NativeBottomTabs/types.js +51 -0
  87. package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
  88. package/build/native-tabs/common/elements.d.ts +84 -21
  89. package/build/native-tabs/common/elements.d.ts.map +1 -1
  90. package/build/native-tabs/common/elements.js +23 -0
  91. package/build/native-tabs/common/elements.js.map +1 -1
  92. package/build/native-tabs/index.d.ts +2 -1
  93. package/build/native-tabs/index.d.ts.map +1 -1
  94. package/build/native-tabs/index.js +3 -1
  95. package/build/native-tabs/index.js.map +1 -1
  96. package/build/navigationParams.d.ts +9 -0
  97. package/build/navigationParams.d.ts.map +1 -0
  98. package/build/navigationParams.js +67 -0
  99. package/build/navigationParams.js.map +1 -0
  100. package/build/rsc/router/client.d.ts +1 -3
  101. package/build/rsc/router/client.d.ts.map +1 -1
  102. package/build/testing-library/index.d.ts +15 -4
  103. package/build/testing-library/index.d.ts.map +1 -1
  104. package/build/testing-library/index.js +31 -28
  105. package/build/testing-library/index.js.map +1 -1
  106. package/build/testing-library/mocks.js +0 -7
  107. package/build/testing-library/mocks.js.map +1 -1
  108. package/build/typed-routes/generate.d.ts +2 -1
  109. package/build/typed-routes/generate.d.ts.map +1 -1
  110. package/build/typed-routes/generate.js +3 -1
  111. package/build/typed-routes/generate.js.map +1 -1
  112. package/build/ui/Slot.d.ts +5 -1
  113. package/build/ui/Slot.d.ts.map +1 -1
  114. package/build/ui/Slot.js.map +1 -1
  115. package/build/ui/TabContext.d.ts +11 -21
  116. package/build/ui/TabContext.d.ts.map +1 -1
  117. package/build/ui/TabRouter.d.ts +7 -0
  118. package/build/ui/TabRouter.d.ts.map +1 -1
  119. package/build/ui/Tabs.d.ts +14 -23
  120. package/build/ui/Tabs.d.ts.map +1 -1
  121. package/build/ui/Tabs.js +1 -1
  122. package/build/ui/Tabs.js.map +1 -1
  123. package/build/ui/common.d.ts +2 -3
  124. package/build/ui/common.d.ts.map +1 -1
  125. package/build/ui/common.js +1 -3
  126. package/build/ui/common.js.map +1 -1
  127. package/build/useFocusEffect.js +1 -1
  128. package/build/useFocusEffect.js.map +1 -1
  129. package/build/useScreens.d.ts +1 -1
  130. package/build/useScreens.d.ts.map +1 -1
  131. package/build/useScreens.js +6 -4
  132. package/build/useScreens.js.map +1 -1
  133. package/ios/ExpoHead.podspec +2 -0
  134. package/ios/LinkPreview/LinkPreviewNativeModule.swift +7 -9
  135. package/ios/LinkPreview/LinkPreviewNativeView.swift +13 -28
  136. package/package.json +22 -24
  137. package/plugin/build/index.js +1 -1
  138. package/plugin/src/index.ts +1 -1
  139. package/ios/LinkPreview/LinkPreviewNativeTriggerView.swift +0 -9
  140. package/plugin/tsconfig.tsbuildinfo +0 -1
@@ -57,6 +57,7 @@ const emitDomEvent_1 = require("../domComponents/emitDomEvent");
57
57
  const getRoutesRedirects_1 = require("../getRoutesRedirects");
58
58
  const href_1 = require("../link/href");
59
59
  const matchers_1 = require("../matchers");
60
+ const navigationParams_1 = require("../navigationParams");
60
61
  const url_1 = require("../utils/url");
61
62
  function assertIsReady() {
62
63
  if (!router_store_1.store.navigationRef.isReady()) {
@@ -76,23 +77,20 @@ exports.routingQueue = {
76
77
  return exports.routingQueue.queue;
77
78
  },
78
79
  add(action) {
79
- // Reset the identity of the queue.
80
- if (exports.routingQueue.queue.length === 0) {
81
- exports.routingQueue.queue = [];
82
- }
83
80
  exports.routingQueue.queue.push(action);
84
81
  for (const callback of exports.routingQueue.subscribers) {
85
82
  callback();
86
83
  }
87
84
  },
88
- run() {
89
- const queue = exports.routingQueue.queue;
90
- if (queue.length === 0 || !router_store_1.store.navigationRef) {
91
- return;
92
- }
85
+ run(ref) {
86
+ // Reset the identity of the queue.
87
+ const events = exports.routingQueue.queue;
93
88
  exports.routingQueue.queue = [];
94
- for (const action of queue) {
95
- router_store_1.store.navigationRef.dispatch(action);
89
+ let action;
90
+ while ((action = events.shift())) {
91
+ if (ref.current) {
92
+ ref.current.dispatch(action);
93
+ }
96
94
  }
97
95
  },
98
96
  };
@@ -257,10 +255,13 @@ function getNavigateAction(_actionState, _navigationState, type = 'NAVIGATE', wi
257
255
  */
258
256
  rootPayload.params.initial = !withAnchor;
259
257
  }
260
- const previewKeyParams = isPreviewNavigation
261
- ? { __internal__expoRouterIsPreviewNavigation: isPreviewNavigation }
258
+ const expoParams = isPreviewNavigation
259
+ ? {
260
+ __internal__expo_router_is_preview_navigation: true,
261
+ __internal_expo_router_no_animation: true,
262
+ }
262
263
  : {};
263
- const params = { ...rootPayload.params, ...previewKeyParams };
264
+ const params = (0, navigationParams_1.appendInternalExpoRouterParams)(rootPayload.params, expoParams);
264
265
  return {
265
266
  type,
266
267
  target: navigationState.key,
@@ -326,6 +327,11 @@ lookThroughAllTabs = false) {
326
327
  // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails
327
328
  actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]);
328
329
  if (didActionAndCurrentStateDiverge) {
330
+ // If we are looking through all tabs, we need to add new tab id if this is the last route
331
+ // Otherwise we wouldn't be able to change the tab
332
+ if (navigationState.type === 'tab' && lookThroughAllTabs) {
333
+ navigationRoutes.push(stateRoute);
334
+ }
329
335
  break;
330
336
  }
331
337
  navigationRoutes.push(stateRoute);
@@ -1 +1 @@
1
- {"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,4BAEC;AAED,wBAGC;AAED,4BAEC;AAED,oBAEC;AAED,0BAMC;AAED,8BAEC;AAED,0BAEC;AAED,gCAKC;AAED,wBAMC;AAED,8BAeC;AAED,gCAmBC;AAED,8BAQC;AA0BD,wBA8DC;AAoFD,4DAwBC;AAKD,gDAmDC;AA5ZD,kCAAkC;AAClC,sDAAwC;AACxC,+CAAwC;AAExC,iDAAuC;AACvC,gEAMuC;AAEvC,8DAAuD;AACvD,uCAA0E;AAC1E,0CAA+C;AAG/C,sCAAoD;AAEpD,SAAS,aAAa;IACpB,IAAI,CAAC,oBAAK,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,gKAAgK,CACjK,CAAC;IACJ,CAAC;AACH,CAAC;AAEY,QAAA,YAAY,GAAG;IAC1B,KAAK,EAAE,EAAwB;IAC/B,WAAW,EAAE,IAAI,GAAG,EAAc;IAClC,SAAS,CAAC,QAAoB;QAC5B,oBAAY,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,OAAO,G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AAC,KAAK,CAAC;QAE7C,MAAM,WAAW,GAAG,IAAA,2BAAgB,EAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE5D,MAAM,+BAA+B,GACnC,gBAAgB,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;YACzC,CAAC,UAAU;YACX,CAAC,mBAAmB;YACpB,CAAC,WAAW;gBACV,wFAAwF;gBACxF,gBAAgB,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3F,IAAI,+BAA+B,EAAE,CAAC;YACpC,MAAM;QACR,CAAC;QAED,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,WAAW,GAAG,UAAU,CAAC;QACzB,eAAe,GAAG,mBAAsC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n NavigationAction,\n type NavigationState,\n PartialRoute,\n type PartialState,\n} from '@react-navigation/native';\nimport { IS_DOM } from 'expo/dom';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'react-native';\n\nimport { store } from './router-store';\nimport {\n emitDomDismiss,\n emitDomDismissAll,\n emitDomGoBack,\n emitDomLinkEvent,\n emitDomSetParams,\n} from '../domComponents/emitDomEvent';\nimport { ResultState } from '../fork/getStateFromPath';\nimport { applyRedirects } from '../getRoutesRedirects';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { matchDynamicName } from '../matchers';\nimport { Href } from '../types';\nimport { SingularOptions } from '../useScreens';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction assertIsReady() {\n if (!store.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n}\n\nexport const routingQueue = {\n queue: [] as NavigationAction[],\n subscribers: new Set<() => void>(),\n subscribe(callback: () => void) {\n routingQueue.subscribers.add(callback);\n return () => {\n routingQueue.subscribers.delete(callback);\n };\n },\n snapshot() {\n return routingQueue.queue;\n },\n add(action: NavigationAction) {\n // Reset the identity of the queue.\n if (routingQueue.queue.length === 0) {\n routingQueue.queue = [];\n }\n\n routingQueue.queue.push(action);\n for (const callback of routingQueue.subscribers) {\n callback();\n }\n },\n run() {\n const queue = routingQueue.queue;\n if (queue.length === 0 || !store.navigationRef) {\n return;\n }\n\n routingQueue.queue = [];\n for (const action of queue) {\n store.navigationRef.dispatch(action);\n }\n },\n};\n\nexport type NavigationOptions = Omit<LinkToOptions, 'event'>;\n\nexport function navigate(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'NAVIGATE' });\n}\n\nexport function reload() {\n // TODO(EvanBacon): add `reload` support.\n throw new Error('The reload method is not implemented in the client-side router yet.');\n}\n\nexport function prefetch(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'PRELOAD' });\n}\n\nexport function push(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'PUSH' });\n}\n\nexport function dismiss(count: number = 1) {\n if (emitDomDismiss(count)) {\n return;\n }\n\n routingQueue.add({ type: 'POP', payload: { count } });\n}\n\nexport function dismissTo(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'POP_TO' });\n}\n\nexport function replace(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'REPLACE' });\n}\n\nexport function dismissAll() {\n if (emitDomDismissAll()) {\n return;\n }\n routingQueue.add({ type: 'POP_TO_TOP' });\n}\n\nexport function goBack() {\n if (emitDomGoBack()) {\n return;\n }\n assertIsReady();\n routingQueue.add({ type: 'GO_BACK' });\n}\n\nexport function canGoBack(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canGoBack imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n // Return a default value here if the navigation hasn't mounted yet.\n // This can happen if the user calls `canGoBack` from the Root Layout route\n // before mounting a navigator. This behavior exists due to React Navigation being dynamically\n // constructed at runtime. We can get rid of this in the future if we use\n // the static configuration internally.\n if (!store.navigationRef.isReady()) {\n return false;\n }\n return store.navigationRef?.current?.canGoBack() ?? false;\n}\n\nexport function canDismiss(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canDismiss imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n let state = store.state;\n\n // Keep traversing down the state tree until we find a stack navigator that we can pop\n while (state) {\n if (state.type === 'stack' && state.routes.length > 1) {\n return true;\n }\n if (state.index === undefined) return false;\n\n state = state.routes?.[state.index]?.state as any;\n }\n\n return false;\n}\n\nexport function setParams(\n params: Record<string, undefined | string | number | (string | number)[]> = {}\n) {\n if (emitDomSetParams(params)) {\n return;\n }\n assertIsReady();\n return (store.navigationRef?.current?.setParams as any)(params);\n}\n\nexport type LinkToOptions = {\n event?: string;\n\n /**\n * Relative URL references are either relative to the directory or the document. By default, relative paths are relative to the document.\n * @see: [MDN's documentation on Resolving relative references to a URL](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Include the anchor when navigating to a new navigator\n */\n withAnchor?: boolean;\n\n /**\n * When navigating in a Stack, remove all screen from the history that match the singular condition\n *\n * If used with `push`, the history will be filtered even if no navigation occurs.\n */\n dangerouslySingular?: SingularOptions;\n\n __internal__PreviewKey?: string;\n};\n\nexport function linkTo(originalHref: Href, options: LinkToOptions = {}) {\n originalHref = typeof originalHref == 'string' ? originalHref : resolveHref(originalHref);\n let href: string | undefined | null = originalHref;\n\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n\n if (shouldLinkExternally(href)) {\n if (href.startsWith('//') && Platform.OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return;\n }\n\n assertIsReady();\n const navigationRef = store.navigationRef.current;\n\n if (navigationRef == null) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n if (!store.linking) {\n throw new Error('Attempted to link to route when no routes are present');\n }\n\n if (href === '..' || href === '../') {\n navigationRef.goBack();\n return;\n }\n\n const rootState = navigationRef.getRootState();\n\n href = resolveHrefStringWithSegments(href, store.getRouteInfo(), options);\n href = applyRedirects(href, store.redirects);\n\n // If the href is undefined, it means that the redirect has already been handled the navigation\n if (!href) {\n return;\n }\n\n const state = store.linking.getStateFromPath!(href, store.linking.config);\n\n if (!state || state.routes.length === 0) {\n console.error('Could not generate a valid navigation state for the given path: ' + href);\n return;\n }\n\n routingQueue.add(\n getNavigateAction(\n state,\n rootState,\n options.event,\n options.withAnchor,\n options.dangerouslySingular,\n !!options.__internal__PreviewKey\n )\n );\n}\n\nfunction getNavigateAction(\n _actionState: ResultState,\n _navigationState: NavigationState,\n type = 'NAVIGATE',\n withAnchor?: boolean,\n singular?: SingularOptions,\n isPreviewNavigation?: boolean\n) {\n /**\n * We need to find the deepest navigator where the action and current state diverge, If they do not diverge, the\n * lowest navigator is the target.\n *\n * By default React Navigation will target the current navigator, but this doesn't work for all actions\n * For example:\n * - /deeply/nested/route -> /top-level-route the target needs to be the top-level navigator\n * - /stack/nestedStack/page -> /stack1/nestedStack/other-page needs to target the nestedStack navigator\n *\n * This matching needs to done by comparing the route names and the dynamic path, for example\n * - /1/page -> /2/anotherPage needs to target the /[id] navigator\n *\n * Other parameters such as search params and hash are not evaluated.\n */\n\n const { actionStateRoute, navigationState } = findDivergentState(\n _actionState,\n _navigationState,\n type === 'PRELOAD'\n );\n\n /*\n * We found the target navigator, but the payload is in the incorrect format\n * We need to convert the action state to a payload that can be dispatched\n */\n const rootPayload = getPayloadFromStateRoute(actionStateRoute || {});\n\n if (type === 'PUSH' && navigationState.type !== 'stack') {\n type = 'NAVIGATE';\n } else if (navigationState.type === 'expo-tab') {\n type = 'JUMP_TO';\n } else if (type === 'REPLACE' && navigationState.type === 'drawer') {\n type = 'JUMP_TO';\n }\n\n if (withAnchor !== undefined) {\n if (rootPayload.params.initial) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`The parameter 'initial' is a reserved parameter name in React Navigation`);\n }\n }\n /*\n * The logic for initial can seen backwards depending on your perspective\n * True: The initialRouteName is not loaded. The incoming screen is the initial screen (default)\n * False: The initialRouteName is loaded. THe incoming screen is placed after the initialRouteName\n *\n * withAnchor flips the perspective.\n * True: You want the initialRouteName to load.\n * False: You do not want the initialRouteName to load.\n */\n rootPayload.params.initial = !withAnchor;\n }\n\n const previewKeyParams = isPreviewNavigation\n ? { __internal__expoRouterIsPreviewNavigation: isPreviewNavigation }\n : {};\n const params = { ...rootPayload.params, ...previewKeyParams };\n\n return {\n type,\n target: navigationState.key,\n payload: {\n // key: rootPayload.key,\n name: rootPayload.screen,\n params,\n singular,\n },\n };\n}\n\n/**\n * React Navigation uses params to store information about the screens, rather then create new state for each level.\n * This function traverses the action state that will not be part of state and returns a payload that can be used in action.\n */\nexport function getPayloadFromStateRoute(_actionStateRoute: PartialRoute<any>) {\n const rootPayload: Record<string, any> = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n let actionStateRoute: PartialRoute<any> | undefined = _actionStateRoute;\n\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n return rootPayload;\n}\n\n/*\n * Traverse the state tree comparing the current state and the action state until we find where they diverge\n */\nexport function findDivergentState(\n _actionState: ResultState,\n _navigationState: NavigationState,\n // If true, look through all tabs to find the target state, rather then just the current tab\n lookThroughAllTabs: boolean = false\n) {\n let actionState: PartialState<NavigationState> | undefined = _actionState;\n let navigationState: NavigationState | undefined = _navigationState;\n let actionStateRoute: PartialRoute<any> | undefined;\n const navigationRoutes = [];\n while (actionState && navigationState) {\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n const stateRoute = (() => {\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n return (\n navigationState.routes.find((route) => route.name === actionStateRoute?.name) ||\n navigationState.routes[navigationState.index ?? 0]\n );\n }\n return navigationState.routes[navigationState.index ?? 0];\n })();\n\n const childState: PartialState<NavigationState> | undefined = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName &&\n // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails\n actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]);\n\n if (didActionAndCurrentStateDiverge) {\n break;\n }\n\n navigationRoutes.push(stateRoute);\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n return {\n actionState,\n navigationState,\n actionStateRoute,\n navigationRoutes,\n };\n}\n"]}
1
+ {"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,4BAEC;AAED,wBAGC;AAED,4BAEC;AAED,oBAEC;AAED,0BAMC;AAED,8BAEC;AAED,0BAEC;AAED,gCAKC;AAED,wBAMC;AAED,8BAeC;AAED,gCAmBC;AAED,8BAQC;AA0BD,wBA8DC;AAuFD,4DAwBC;AAKD,gDAwDC;AAjaD,kCAAkC;AAClC,sDAAwC;AAExC,+CAAwC;AAExC,iDAAuC;AACvC,gEAMuC;AAEvC,8DAAuD;AACvD,uCAA0E;AAC1E,0CAA+C;AAC/C,0DAAoG;AAGpG,sCAAoD;AAEpD,SAAS,aAAa;I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,IAAI,CAAC,CAAC,CACnD,CAAC;YACJ,CAAC;YACD,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,EAAE,CAAC;QAEL,MAAM,UAAU,GAA8C,gBAAgB,CAAC,KAAK,CAAC;QACrF,MAAM,mBAAmB,GAAG,UAAU,CAAC,KAAK,CAAC;QAE7C,MAAM,WAAW,GAAG,IAAA,2BAAgB,EAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE5D,MAAM,+BAA+B,GACnC,gBAAgB,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;YACzC,CAAC,UAAU;YACX,CAAC,mBAAmB;YACpB,CAAC,WAAW;gBACV,wFAAwF;gBACxF,gBAAgB,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3F,IAAI,+BAA+B,EAAE,CAAC;YACpC,0FAA0F;YAC1F,kDAAkD;YAClD,IAAI,eAAe,CAAC,IAAI,KAAK,KAAK,IAAI,kBAAkB,EAAE,CAAC;gBACzD,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACpC,CAAC;YACD,MAAM;QACR,CAAC;QAED,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,WAAW,GAAG,UAAU,CAAC;QACzB,eAAe,GAAG,mBAAsC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n NavigationAction,\n type NavigationState,\n PartialRoute,\n type PartialState,\n type NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/native';\nimport { IS_DOM } from 'expo/dom';\nimport * as Linking from 'expo-linking';\nimport { type RefObject } from 'react';\nimport { Platform } from 'react-native';\n\nimport { store } from './router-store';\nimport {\n emitDomDismiss,\n emitDomDismissAll,\n emitDomGoBack,\n emitDomLinkEvent,\n emitDomSetParams,\n} from '../domComponents/emitDomEvent';\nimport { ResultState } from '../fork/getStateFromPath';\nimport { applyRedirects } from '../getRoutesRedirects';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { matchDynamicName } from '../matchers';\nimport { appendInternalExpoRouterParams, type InternalExpoRouterParams } from '../navigationParams';\nimport { Href } from '../types';\nimport { SingularOptions } from '../useScreens';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction assertIsReady() {\n if (!store.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n}\n\nexport const routingQueue = {\n queue: [] as NavigationAction[],\n subscribers: new Set<() => void>(),\n subscribe(callback: () => void) {\n routingQueue.subscribers.add(callback);\n return () => {\n routingQueue.subscribers.delete(callback);\n };\n },\n snapshot() {\n return routingQueue.queue;\n },\n add(action: NavigationAction) {\n routingQueue.queue.push(action);\n for (const callback of routingQueue.subscribers) {\n callback();\n }\n },\n run(ref: RefObject<NavigationContainerRef<ParamListBase> | null>) {\n // Reset the identity of the queue.\n const events = routingQueue.queue;\n routingQueue.queue = [];\n let action: NavigationAction | undefined;\n while ((action = events.shift())) {\n if (ref.current) {\n ref.current.dispatch(action);\n }\n }\n },\n};\n\nexport type NavigationOptions = Omit<LinkToOptions, 'event'>;\n\nexport function navigate(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'NAVIGATE' });\n}\n\nexport function reload() {\n // TODO(EvanBacon): add `reload` support.\n throw new Error('The reload method is not implemented in the client-side router yet.');\n}\n\nexport function prefetch(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'PRELOAD' });\n}\n\nexport function push(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'PUSH' });\n}\n\nexport function dismiss(count: number = 1) {\n if (emitDomDismiss(count)) {\n return;\n }\n\n routingQueue.add({ type: 'POP', payload: { count } });\n}\n\nexport function dismissTo(href: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(href), { ...options, event: 'POP_TO' });\n}\n\nexport function replace(url: Href, options?: NavigationOptions) {\n return linkTo(resolveHref(url), { ...options, event: 'REPLACE' });\n}\n\nexport function dismissAll() {\n if (emitDomDismissAll()) {\n return;\n }\n routingQueue.add({ type: 'POP_TO_TOP' });\n}\n\nexport function goBack() {\n if (emitDomGoBack()) {\n return;\n }\n assertIsReady();\n routingQueue.add({ type: 'GO_BACK' });\n}\n\nexport function canGoBack(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canGoBack imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n // Return a default value here if the navigation hasn't mounted yet.\n // This can happen if the user calls `canGoBack` from the Root Layout route\n // before mounting a navigator. This behavior exists due to React Navigation being dynamically\n // constructed at runtime. We can get rid of this in the future if we use\n // the static configuration internally.\n if (!store.navigationRef.isReady()) {\n return false;\n }\n return store.navigationRef?.current?.canGoBack() ?? false;\n}\n\nexport function canDismiss(): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canDismiss imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n let state = store.state;\n\n // Keep traversing down the state tree until we find a stack navigator that we can pop\n while (state) {\n if (state.type === 'stack' && state.routes.length > 1) {\n return true;\n }\n if (state.index === undefined) return false;\n\n state = state.routes?.[state.index]?.state as any;\n }\n\n return false;\n}\n\nexport function setParams(\n params: Record<string, undefined | string | number | (string | number)[]> = {}\n) {\n if (emitDomSetParams(params)) {\n return;\n }\n assertIsReady();\n return (store.navigationRef?.current?.setParams as any)(params);\n}\n\nexport type LinkToOptions = {\n event?: string;\n\n /**\n * Relative URL references are either relative to the directory or the document. By default, relative paths are relative to the document.\n * @see: [MDN's documentation on Resolving relative references to a URL](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Include the anchor when navigating to a new navigator\n */\n withAnchor?: boolean;\n\n /**\n * When navigating in a Stack, remove all screen from the history that match the singular condition\n *\n * If used with `push`, the history will be filtered even if no navigation occurs.\n */\n dangerouslySingular?: SingularOptions;\n\n __internal__PreviewKey?: string;\n};\n\nexport function linkTo(originalHref: Href, options: LinkToOptions = {}) {\n originalHref = typeof originalHref == 'string' ? originalHref : resolveHref(originalHref);\n let href: string | undefined | null = originalHref;\n\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n\n if (shouldLinkExternally(href)) {\n if (href.startsWith('//') && Platform.OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return;\n }\n\n assertIsReady();\n const navigationRef = store.navigationRef.current;\n\n if (navigationRef == null) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n if (!store.linking) {\n throw new Error('Attempted to link to route when no routes are present');\n }\n\n if (href === '..' || href === '../') {\n navigationRef.goBack();\n return;\n }\n\n const rootState = navigationRef.getRootState();\n\n href = resolveHrefStringWithSegments(href, store.getRouteInfo(), options);\n href = applyRedirects(href, store.redirects);\n\n // If the href is undefined, it means that the redirect has already been handled the navigation\n if (!href) {\n return;\n }\n\n const state = store.linking.getStateFromPath!(href, store.linking.config);\n\n if (!state || state.routes.length === 0) {\n console.error('Could not generate a valid navigation state for the given path: ' + href);\n return;\n }\n\n routingQueue.add(\n getNavigateAction(\n state,\n rootState,\n options.event,\n options.withAnchor,\n options.dangerouslySingular,\n !!options.__internal__PreviewKey\n )\n );\n}\n\nfunction getNavigateAction(\n _actionState: ResultState,\n _navigationState: NavigationState,\n type = 'NAVIGATE',\n withAnchor?: boolean,\n singular?: SingularOptions,\n isPreviewNavigation?: boolean\n) {\n /**\n * We need to find the deepest navigator where the action and current state diverge, If they do not diverge, the\n * lowest navigator is the target.\n *\n * By default React Navigation will target the current navigator, but this doesn't work for all actions\n * For example:\n * - /deeply/nested/route -> /top-level-route the target needs to be the top-level navigator\n * - /stack/nestedStack/page -> /stack1/nestedStack/other-page needs to target the nestedStack navigator\n *\n * This matching needs to done by comparing the route names and the dynamic path, for example\n * - /1/page -> /2/anotherPage needs to target the /[id] navigator\n *\n * Other parameters such as search params and hash are not evaluated.\n */\n\n const { actionStateRoute, navigationState } = findDivergentState(\n _actionState,\n _navigationState,\n type === 'PRELOAD'\n );\n\n /*\n * We found the target navigator, but the payload is in the incorrect format\n * We need to convert the action state to a payload that can be dispatched\n */\n const rootPayload = getPayloadFromStateRoute(actionStateRoute || {});\n\n if (type === 'PUSH' && navigationState.type !== 'stack') {\n type = 'NAVIGATE';\n } else if (navigationState.type === 'expo-tab') {\n type = 'JUMP_TO';\n } else if (type === 'REPLACE' && navigationState.type === 'drawer') {\n type = 'JUMP_TO';\n }\n\n if (withAnchor !== undefined) {\n if (rootPayload.params.initial) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`The parameter 'initial' is a reserved parameter name in React Navigation`);\n }\n }\n /*\n * The logic for initial can seen backwards depending on your perspective\n * True: The initialRouteName is not loaded. The incoming screen is the initial screen (default)\n * False: The initialRouteName is loaded. THe incoming screen is placed after the initialRouteName\n *\n * withAnchor flips the perspective.\n * True: You want the initialRouteName to load.\n * False: You do not want the initialRouteName to load.\n */\n rootPayload.params.initial = !withAnchor;\n }\n\n const expoParams: InternalExpoRouterParams = isPreviewNavigation\n ? {\n __internal__expo_router_is_preview_navigation: true,\n __internal_expo_router_no_animation: true,\n }\n : {};\n const params = appendInternalExpoRouterParams(rootPayload.params, expoParams);\n\n return {\n type,\n target: navigationState.key,\n payload: {\n // key: rootPayload.key,\n name: rootPayload.screen,\n params,\n singular,\n },\n };\n}\n\n/**\n * React Navigation uses params to store information about the screens, rather then create new state for each level.\n * This function traverses the action state that will not be part of state and returns a payload that can be used in action.\n */\nexport function getPayloadFromStateRoute(_actionStateRoute: PartialRoute<any>) {\n const rootPayload: Record<string, any> = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n let actionStateRoute: PartialRoute<any> | undefined = _actionStateRoute;\n\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n return rootPayload;\n}\n\n/*\n * Traverse the state tree comparing the current state and the action state until we find where they diverge\n */\nexport function findDivergentState(\n _actionState: ResultState,\n _navigationState: NavigationState,\n // If true, look through all tabs to find the target state, rather then just the current tab\n lookThroughAllTabs: boolean = false\n) {\n let actionState: PartialState<NavigationState> | undefined = _actionState;\n let navigationState: NavigationState | undefined = _navigationState;\n let actionStateRoute: PartialRoute<any> | undefined;\n const navigationRoutes = [];\n while (actionState && navigationState) {\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n const stateRoute = (() => {\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n return (\n navigationState.routes.find((route) => route.name === actionStateRoute?.name) ||\n navigationState.routes[navigationState.index ?? 0]\n );\n }\n return navigationState.routes[navigationState.index ?? 0];\n })();\n\n const childState: PartialState<NavigationState> | undefined = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName &&\n // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails\n actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]);\n\n if (didActionAndCurrentStateDiverge) {\n // If we are looking through all tabs, we need to add new tab id if this is the last route\n // Otherwise we wouldn't be able to change the tab\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n navigationRoutes.push(stateRoute);\n }\n break;\n }\n\n navigationRoutes.push(stateRoute);\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n return {\n actionState,\n navigationState,\n actionStateRoute,\n navigationRoutes,\n };\n}\n"]}
@@ -1,8 +1,6 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
2
  export declare function Head(props: PropsWithChildren): null;
3
3
  export declare namespace Head {
4
- var Provider: React.ExoticComponent<{
5
- children?: React.ReactNode | undefined;
6
- }>;
4
+ var Provider: React.ExoticComponent<React.FragmentProps>;
7
5
  }
8
6
  //# sourceMappingURL=ExpoHead.android.d.ts.map
@@ -1,3 +1,5 @@
1
+ import type { NavigationContainerRef, ParamListBase } from '@react-navigation/native';
2
+ import { type RefObject } from 'react';
1
3
  import { NavigationOptions } from './global-state/routing';
2
4
  import { Href, Route, RouteInputParams } from './types';
3
5
  /**
@@ -80,5 +82,5 @@ export type Router = {
80
82
  * @hidden
81
83
  */
82
84
  export declare const router: Router;
83
- export declare function ImperativeApiEmitter(): null;
85
+ export declare function useImperativeApiEmitter(ref: RefObject<NavigationContainerRef<ParamListBase> | null>): null;
84
86
  //# sourceMappingURL=imperative-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imperative-api.d.ts","sourceRoot":"","sources":["../src/imperative-api.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQL,iBAAiB,EAOlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB;;OAEG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACxD;;OAEG;IAC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ports.ImperativeApiEmitter = ImperativeApiEmitter;
4
+ exports.useImperativeApiEmitter = useImperativeApiEmitter;
5
5
  const react_1 = require("react");
6
6
  const routing_1 = require("./global-state/routing");
7
7
  /**
@@ -21,11 +21,11 @@ exports.router = {
21
21
  prefetch: routing_1.prefetch,
22
22
  setParams: routing_1.setParams,
23
23
  };
24
- function ImperativeApiEmitter() {
24
+ function useImperativeApiEmitter(ref) {
25
25
  const events = (0, react_1.useSyncExternalStore)(routing_1.routingQueue.subscribe, routing_1.routingQueue.snapshot, routing_1.routingQueue.snapshot);
26
26
  (0, react_1.useEffect)(() => {
27
- routing_1.routingQueue.run();
28
- }, [events]);
27
+ routing_1.routingQueue.run(ref);
28
+ }, [events, ref]);
29
29
  return null;
30
30
  }
31
31
  //# sourceMappingURL=imperative-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imperative-api.js","sourceRoot":"","sources":["../src/imperative-api.tsx"],"names":[],"mappings":";;;AAmHA,oDAUC;AA7HD,iCAAwD;AAExD,oDAegC;AAgFhC;;GAEG;AACU,QAAA,MAAM,GAAW;IAC5B,QAAQ,EAAR,kBAAQ;IACR,IAAI,EAAJ,cAAI;IACJ,OAAO,EAAP,iBAAO;IACP,UAAU,EAAV,oBAAU;IACV,SAAS,EAAT,mBAAS;IACT,UAAU,EAAV,oBAAU;IACV,OAAO,EAAP,iBAAO;IACP,IAAI,EAAE,GAAG,EAAE,CAAC,IAAA,gBAAM,GAAE;IACpB,SAAS,EAAT,mBAAS;IACT,MAAM,EAAN,gBAAM;IACN,QAAQ,EAAR,kBAAQ;IACR,SAAS,EAAE,mBAAgC;CAC5C,CAAC;AAEF,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,IAAA,4BAAoB,EACjC,sBAAY,CAAC,SAAS,EACtB,sBAAY,CAAC,QAAQ,EACrB,sBAAY,CAAC,QAAQ,CACtB,CAAC;IACF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,sBAAY,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { useEffect, useSyncExternalStore } from 'react';\n\nimport {\n canDismiss,\n canGoBack,\n dismiss,\n dismissAll,\n dismissTo,\n goBack,\n navigate,\n NavigationOptions,\n prefetch,\n push,\n reload,\n replace,\n routingQueue,\n setParams,\n} from './global-state/routing';\nimport { Href, Route, RouteInputParams } from './types';\n\n/**\n * Returns `router` object for imperative navigation API.\n *\n * @example\n *```tsx\n * import { router } from 'expo-router';\n * import { Text } from 'react-native';\n *\n * export default function Route() {\n *\n * return (\n * <Text onPress={() => router.push('/home')}>Go Home</Text>\n * );\n *}\n * ```\n */\nexport type Router = {\n /**\n * Goes back in the navigation history.\n */\n back: () => void;\n /**\n * Navigates to a route in the navigator's history if it supports invoking the `back` function.\n */\n canGoBack: () => boolean;\n /**\n * Navigates to the provided [`href`](#href) using a push operation if possible.\n */\n push: (href: Href, options?: NavigationOptions) => void;\n /**\n * Navigates to the provided [`href`](#href).\n */\n navigate: (href: Href, options?: NavigationOptions) => void;\n /**\n * Navigates to route without appending to the history. Can be used with\n * [`useFocusEffect`](#usefocuseffecteffect-do_not_pass_a_second_prop)\n * to redirect imperatively to a new screen.\n *\n * @see [Using `useRouter()` hook](/router/reference/redirects/) to redirect.\n * */\n replace: (href: Href, options?: NavigationOptions) => void;\n /**\n * Navigates to the a stack lower than the current screen using the provided count if possible, otherwise 1.\n *\n * If the current screen is the only route, it will dismiss the entire stack.\n */\n dismiss: (count?: number) => void;\n /**\n * Dismisses screens until the provided href is reached. If the href is not found, it will instead replace the current screen with the provided `href`.\n */\n dismissTo: (href: Href, options?: NavigationOptions) => void;\n /**\n * Returns to the first screen in the closest stack. This is similar to\n * [`popToTop`](https://reactnavigation.org/docs/stack-actions/#poptotop) stack action.\n */\n dismissAll: () => void;\n /**\n * Checks if it is possible to dismiss the current screen. Returns `true` if the\n * router is within the stack with more than one screen in stack's history.\n *\n */\n canDismiss: () => boolean;\n /**\n * Updates the current route's query params.\n */\n setParams: <T extends Route>(params: Partial<RouteInputParams<T>>) => void;\n /**\n * Reloads the currently mounted route in experimental server mode. This can be used to re-fetch data.\n * @hidden\n */\n reload: () => void;\n /**\n * Prefetch a screen in the background before navigating to it\n */\n prefetch: (name: Href) => void;\n};\n\n/**\n * @hidden\n */\nexport const router: Router = {\n navigate,\n push,\n dismiss,\n dismissAll,\n dismissTo,\n canDismiss,\n replace,\n back: () => goBack(),\n canGoBack,\n reload,\n prefetch,\n setParams: setParams as Router['setParams'],\n};\n\nexport function ImperativeApiEmitter() {\n const events = useSyncExternalStore(\n routingQueue.subscribe,\n routingQueue.snapshot,\n routingQueue.snapshot\n );\n useEffect(() => {\n routingQueue.run();\n }, [events]);\n return null;\n}\n"]}
1
+ {"version":3,"file":"imperative-api.js","sourceRoot":"","sources":["../src/imperative-api.tsx"],"names":[],"mappings":";;;AAoHA,0DAYC;AA/HD,iCAAwE;AAExE,oDAegC;AAgFhC;;GAEG;AACU,QAAA,MAAM,GAAW;IAC5B,QAAQ,EAAR,kBAAQ;IACR,IAAI,EAAJ,cAAI;IACJ,OAAO,EAAP,iBAAO;IACP,UAAU,EAAV,oBAAU;IACV,SAAS,EAAT,mBAAS;IACT,UAAU,EAAV,oBAAU;IACV,OAAO,EAAP,iBAAO;IACP,IAAI,EAAE,GAAG,EAAE,CAAC,IAAA,gBAAM,GAAE;IACpB,SAAS,EAAT,mBAAS;IACT,MAAM,EAAN,gBAAM;IACN,QAAQ,EAAR,kBAAQ;IACR,SAAS,EAAE,mBAAgC;CAC5C,CAAC;AAEF,SAAgB,uBAAuB,CACrC,GAA4D;IAE5D,MAAM,MAAM,GAAG,IAAA,4BAAoB,EACjC,sBAAY,CAAC,SAAS,EACtB,sBAAY,CAAC,QAAQ,EACrB,sBAAY,CAAC,QAAQ,CACtB,CAAC;IACF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,sBAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAClB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { NavigationContainerRef, ParamListBase } from '@react-navigation/native';\nimport { type RefObject, useEffect, useSyncExternalStore } from 'react';\n\nimport {\n canDismiss,\n canGoBack,\n dismiss,\n dismissAll,\n dismissTo,\n goBack,\n navigate,\n NavigationOptions,\n prefetch,\n push,\n reload,\n replace,\n routingQueue,\n setParams,\n} from './global-state/routing';\nimport { Href, Route, RouteInputParams } from './types';\n\n/**\n * Returns `router` object for imperative navigation API.\n *\n * @example\n *```tsx\n * import { router } from 'expo-router';\n * import { Text } from 'react-native';\n *\n * export default function Route() {\n *\n * return (\n * <Text onPress={() => router.push('/home')}>Go Home</Text>\n * );\n *}\n * ```\n */\nexport type Router = {\n /**\n * Goes back in the navigation history.\n */\n back: () => void;\n /**\n * Navigates to a route in the navigator's history if it supports invoking the `back` function.\n */\n canGoBack: () => boolean;\n /**\n * Navigates to the provided [`href`](#href) using a push operation if possible.\n */\n push: (href: Href, options?: NavigationOptions) => void;\n /**\n * Navigates to the provided [`href`](#href).\n */\n navigate: (href: Href, options?: NavigationOptions) => void;\n /**\n * Navigates to route without appending to the history. Can be used with\n * [`useFocusEffect`](#usefocuseffecteffect-do_not_pass_a_second_prop)\n * to redirect imperatively to a new screen.\n *\n * @see [Using `useRouter()` hook](/router/reference/redirects/) to redirect.\n * */\n replace: (href: Href, options?: NavigationOptions) => void;\n /**\n * Navigates to the a stack lower than the current screen using the provided count if possible, otherwise 1.\n *\n * If the current screen is the only route, it will dismiss the entire stack.\n */\n dismiss: (count?: number) => void;\n /**\n * Dismisses screens until the provided href is reached. If the href is not found, it will instead replace the current screen with the provided `href`.\n */\n dismissTo: (href: Href, options?: NavigationOptions) => void;\n /**\n * Returns to the first screen in the closest stack. This is similar to\n * [`popToTop`](https://reactnavigation.org/docs/stack-actions/#poptotop) stack action.\n */\n dismissAll: () => void;\n /**\n * Checks if it is possible to dismiss the current screen. Returns `true` if the\n * router is within the stack with more than one screen in stack's history.\n *\n */\n canDismiss: () => boolean;\n /**\n * Updates the current route's query params.\n */\n setParams: <T extends Route>(params: Partial<RouteInputParams<T>>) => void;\n /**\n * Reloads the currently mounted route in experimental server mode. This can be used to re-fetch data.\n * @hidden\n */\n reload: () => void;\n /**\n * Prefetch a screen in the background before navigating to it\n */\n prefetch: (name: Href) => void;\n};\n\n/**\n * @hidden\n */\nexport const router: Router = {\n navigate,\n push,\n dismiss,\n dismissAll,\n dismissTo,\n canDismiss,\n replace,\n back: () => goBack(),\n canGoBack,\n reload,\n prefetch,\n setParams: setParams as Router['setParams'],\n};\n\nexport function useImperativeApiEmitter(\n ref: RefObject<NavigationContainerRef<ParamListBase> | null>\n) {\n const events = useSyncExternalStore(\n routingQueue.subscribe,\n routingQueue.snapshot,\n routingQueue.snapshot\n );\n useEffect(() => {\n routingQueue.run(ref);\n }, [events, ref]);\n return null;\n}\n"]}
@@ -39,12 +39,7 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
39
39
  navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, undefined>;
40
40
  theme: ReactNavigation.Theme;
41
41
  }) => DrawerNavigationOptions) | undefined;
42
- screenLayout?: ((props: {
43
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
44
- navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, undefined>;
45
- theme: ReactNavigation.Theme;
46
- children: React.ReactElement;
47
- }) => React.ReactElement) | undefined;
42
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, DrawerNavigationOptions, import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
48
43
  UNSTABLE_router?: (<Action extends Readonly<{
49
44
  type: string;
50
45
  payload?: object;
@@ -92,12 +87,7 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
92
87
  navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, undefined>;
93
88
  theme: ReactNavigation.Theme;
94
89
  }) => DrawerNavigationOptions) | undefined;
95
- screenLayout?: ((props: {
96
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
97
- navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, undefined>;
98
- theme: ReactNavigation.Theme;
99
- children: React.ReactElement;
100
- }) => React.ReactElement) | undefined;
90
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, DrawerNavigationOptions, import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
101
91
  UNSTABLE_router?: (<Action extends Readonly<{
102
92
  type: string;
103
93
  payload?: object;
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerClient.d.ts","sourceRoot":"","sources":["../../src/layouts/DrawerClient.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMhF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKD,CAAC;AAEnB,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"DrawerClient.d.ts","sourceRoot":"","sources":["../../src/layouts/DrawerClient.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMhF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKD,CAAC;AAEnB,eAAe,MAAM,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ParamListBase, StackRouter as RNStackRouter, StackNavigationState } from '@react-navigation/native';
1
+ import { ParamListBase, StackRouter as RNStackRouter, StackNavigationState, type RouteProp } from '@react-navigation/native';
2
2
  import { NativeStackNavigationEventMap, NativeStackNavigationOptions } from '@react-navigation/native-stack';
3
3
  import { ComponentProps } from 'react';
4
4
  import { Protected } from '../views/Protected';
@@ -38,6 +38,11 @@ export type ExtendedStackNavigationOptions = NativeStackNavigationOptions & {
38
38
  * @platform web
39
39
  */
40
40
  overlayBackground?: string;
41
+ /**
42
+ * Override the modal shadow filter (any valid CSS filter value, e.g. 'drop-shadow(0 4px 8px rgba(0,0,0,0.1))' or 'none').
43
+ * @platform web
44
+ */
45
+ shadow?: string;
41
46
  };
42
47
  };
43
48
  declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenListeners" | "screenOptions" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/native").DefaultRouterOptions<string> & {
@@ -45,7 +50,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
45
50
  layout?: ((props: {
46
51
  state: StackNavigationState<ParamListBase>;
47
52
  navigation: import("@react-navigation/native").NavigationHelpers<ParamListBase, {}>;
48
- descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>, import("@react-navigation/native").RouteProp<ParamListBase, string>>>;
53
+ descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>, RouteProp<ParamListBase, string>>>;
49
54
  children: React.ReactNode;
50
55
  }) => React.ReactElement) | undefined;
51
56
  screenListeners?: Partial<{
@@ -58,7 +63,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
58
63
  state: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "state", unknown>;
59
64
  beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
60
65
  }> | ((props: {
61
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
66
+ route: RouteProp<ParamListBase, string>;
62
67
  navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
63
68
  }) => Partial<{
64
69
  transitionStart: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "transitionStart", unknown>;
@@ -71,16 +76,11 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
71
76
  beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
72
77
  }>) | undefined;
73
78
  screenOptions?: NativeStackNavigationOptions | ((props: {
74
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
79
+ route: RouteProp<ParamListBase, string>;
75
80
  navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
76
81
  theme: ReactNavigation.Theme;
77
82
  }) => NativeStackNavigationOptions) | undefined;
78
- screenLayout?: ((props: {
79
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
80
- navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
81
- theme: ReactNavigation.Theme;
82
- children: React.ReactElement;
83
- }) => React.ReactElement) | undefined;
83
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, NativeStackNavigationOptions, import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
84
84
  UNSTABLE_router?: (<Action extends Readonly<{
85
85
  type: string;
86
86
  payload?: object;
@@ -94,7 +94,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
94
94
  layout?: ((props: {
95
95
  state: StackNavigationState<ParamListBase>;
96
96
  navigation: import("@react-navigation/native").NavigationHelpers<ParamListBase, {}>;
97
- descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>, import("@react-navigation/native").RouteProp<ParamListBase, string>>>;
97
+ descriptors: Record<string, import("@react-navigation/native").Descriptor<NativeStackNavigationOptions, import("@react-navigation/native").NavigationProp<ParamListBase, string, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap>, RouteProp<ParamListBase, string>>>;
98
98
  children: React.ReactNode;
99
99
  }) => React.ReactElement) | undefined;
100
100
  screenListeners?: Partial<{
@@ -107,7 +107,7 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
107
107
  state: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "state", unknown>;
108
108
  beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
109
109
  }> | ((props: {
110
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
110
+ route: RouteProp<ParamListBase, string>;
111
111
  navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
112
112
  }) => Partial<{
113
113
  transitionStart: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "transitionStart", unknown>;
@@ -120,16 +120,11 @@ declare const RNStack: import("react").ForwardRefExoticComponent<Omit<Omit<impor
120
120
  beforeRemove: import("@react-navigation/native").EventListenerCallback<NativeStackNavigationEventMap & import("@react-navigation/native").EventMapCore<StackNavigationState<ParamListBase>>, "beforeRemove", true>;
121
121
  }>) | undefined;
122
122
  screenOptions?: NativeStackNavigationOptions | ((props: {
123
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
123
+ route: RouteProp<ParamListBase, string>;
124
124
  navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
125
125
  theme: ReactNavigation.Theme;
126
126
  }) => NativeStackNavigationOptions) | undefined;
127
- screenLayout?: ((props: {
128
- route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
129
- navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>;
130
- theme: ReactNavigation.Theme;
131
- children: React.ReactElement;
132
- }) => React.ReactElement) | undefined;
127
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, NativeStackNavigationOptions, import("@react-navigation/native-stack").NativeStackNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
133
128
  UNSTABLE_router?: (<Action extends Readonly<{
134
129
  type: string;
135
130
  payload?: object;
@@ -1 +1 @@
1
- {"version":3,"file":"StackClient.d.ts","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAKb,WAAW,IAAI,aAAa,EAE5B,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,cAAc,EAAW,MAAM,OAAO,CAAC;AAOhD,OAAO,EAAE,SAAS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AAC"}
@@ -8,6 +8,7 @@ const react_1 = require("react");
8
8
  const withLayoutContext_1 = require("./withLayoutContext");
9
9
  const createNativeStackNavigator_1 = require("../fork/native-stack/createNativeStackNavigator");
10
10
  const LinkPreviewContext_1 = require("../link/preview/LinkPreviewContext");
11
+ const navigationParams_1 = require("../navigationParams");
11
12
  const useScreens_1 = require("../useScreens");
12
13
  const Protected_1 = require("../views/Protected");
13
14
  const NativeStackNavigator = (0, createNativeStackNavigator_1.createNativeStackNavigator)().Navigator;
@@ -22,10 +23,8 @@ function isStackAction(action) {
22
23
  }
23
24
  const isPreviewAction = (action) => !!action.payload &&
24
25
  'params' in action.payload &&
25
- !!action.payload.params &&
26
- typeof action.payload === 'object' &&
27
- '__internal__expoRouterIsPreviewNavigation' in action.payload.params &&
28
- !!action.payload.params.__internal__expoRouterIsPreviewNavigation;
26
+ typeof action.payload.params === 'object' &&
27
+ !!(0, navigationParams_1.getInternalExpoRouterParams)(action.payload?.params ?? undefined)['__internal__expo_router_is_preview_navigation'];
29
28
  /**
30
29
  * React Navigation matches a screen by its name or a 'getID' function that uniquely identifies a screen.
31
30
  * When a screen has been uniquely identified, the Stack can only have one instance of that screen.
@@ -91,7 +90,7 @@ const stackRouterOverride = (original) => {
91
90
  }
92
91
  }
93
92
  // START FORK
94
- if (isPreviewAction(action)) {
93
+ if (isPreviewAction(action) && !route) {
95
94
  route = state.preloadedRoutes.find((route) => route.name === action.payload.name && id === route.key);
96
95
  }
97
96
  // END FORK
@@ -344,38 +343,41 @@ function filterSingular(state, getId) {
344
343
  const Stack = Object.assign((props) => {
345
344
  const { isStackAnimationDisabled } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
346
345
  const screenOptions = (0, react_1.useMemo)(() => {
347
- if (isStackAnimationDisabled) {
348
- return disableAnimationInScreenOptions(props.screenOptions);
349
- }
350
- return props.screenOptions;
346
+ const condition = isStackAnimationDisabled ? () => true : shouldDisableAnimationBasedOnParams;
347
+ return disableAnimationInScreenOptions(props.screenOptions, condition);
351
348
  }, [props.screenOptions, isStackAnimationDisabled]);
352
349
  return (<RNStack {...props} screenOptions={screenOptions} UNSTABLE_router={exports.stackRouterOverride}/>);
353
350
  }, {
354
351
  Screen: RNStack.Screen,
355
352
  Protected: Protected_1.Protected,
356
353
  });
357
- function disableAnimationInScreenOptions(options) {
358
- const animationNone = 'none';
359
- if (options) {
360
- if (typeof options === 'function') {
361
- const newOptions = (...args) => {
362
- const oldResult = options(...args);
354
+ function disableAnimationInScreenOptions(options, condition) {
355
+ if (options && typeof options === 'function') {
356
+ return (props) => {
357
+ const oldOptions = options(props);
358
+ if (condition(props.route)) {
363
359
  return {
364
- ...oldResult,
365
- animation: animationNone,
360
+ ...oldOptions,
361
+ animation: 'none',
366
362
  };
367
- };
368
- return newOptions;
369
- }
370
- return {
371
- ...options,
372
- animation: animationNone,
363
+ }
364
+ return oldOptions ?? {};
373
365
  };
374
366
  }
375
- return {
376
- animation: animationNone,
367
+ return (props) => {
368
+ if (condition(props.route)) {
369
+ return {
370
+ ...(options ?? {}),
371
+ animation: 'none',
372
+ };
373
+ }
374
+ return options ?? {};
377
375
  };
378
376
  }
377
+ function shouldDisableAnimationBasedOnParams(route) {
378
+ const expoParams = (0, navigationParams_1.getInternalExpoRouterParams)(route.params);
379
+ return !!expoParams.__internal_expo_router_no_animation;
380
+ }
379
381
  exports.default = Stack;
380
382
  const StackRouter = (options) => {
381
383
  const router = (0, native_1.StackRouter)(options);