expo-router 5.2.0-canary-20250729-d8899ae → 5.2.0-canary-20250811-5c940c0

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 (182) hide show
  1. package/_ctx.android.js +1 -1
  2. package/_ctx.ios.js +1 -1
  3. package/_ctx.web.js +1 -1
  4. package/assets/modal.module.css +12 -3
  5. package/build/ExpoRoot.d.ts.map +1 -1
  6. package/build/ExpoRoot.js +12 -2
  7. package/build/ExpoRoot.js.map +1 -1
  8. package/build/Route.d.ts +9 -0
  9. package/build/Route.d.ts.map +1 -1
  10. package/build/Route.js.map +1 -1
  11. package/build/constants.d.ts +2 -0
  12. package/build/constants.d.ts.map +1 -1
  13. package/build/constants.js +3 -1
  14. package/build/constants.js.map +1 -1
  15. package/build/doctor/index.d.ts +1 -1
  16. package/build/doctor/index.d.ts.map +1 -1
  17. package/build/doctor/index.js +4 -1
  18. package/build/doctor/index.js.map +1 -1
  19. package/build/exports.d.ts +2 -2
  20. package/build/exports.d.ts.map +1 -1
  21. package/build/exports.js +6 -6
  22. package/build/exports.js.map +1 -1
  23. package/build/fork/native-stack/createNativeStackNavigator.d.ts +2 -2
  24. package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
  25. package/build/fork/native-stack/createNativeStackNavigator.js +82 -2
  26. package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
  27. package/build/fork/useLinking.js +2 -2
  28. package/build/fork/useLinking.js.map +1 -1
  29. package/build/getLinkingConfig.d.ts +29 -2
  30. package/build/getLinkingConfig.d.ts.map +1 -1
  31. package/build/getLinkingConfig.js +35 -4
  32. package/build/getLinkingConfig.js.map +1 -1
  33. package/build/getRoutesCore.d.ts +1 -0
  34. package/build/getRoutesCore.d.ts.map +1 -1
  35. package/build/getRoutesCore.js +60 -0
  36. package/build/getRoutesCore.js.map +1 -1
  37. package/build/getServerManifest.d.ts +20 -1
  38. package/build/getServerManifest.d.ts.map +1 -1
  39. package/build/getServerManifest.js +8 -1
  40. package/build/getServerManifest.js.map +1 -1
  41. package/build/global-state/routeInfo.d.ts.map +1 -1
  42. package/build/global-state/routeInfo.js +12 -1
  43. package/build/global-state/routeInfo.js.map +1 -1
  44. package/build/global-state/router-store.d.ts.map +1 -1
  45. package/build/global-state/router-store.js +4 -0
  46. package/build/global-state/router-store.js.map +1 -1
  47. package/build/global-state/routing.d.ts +29 -1
  48. package/build/global-state/routing.d.ts.map +1 -1
  49. package/build/global-state/routing.js +78 -42
  50. package/build/global-state/routing.js.map +1 -1
  51. package/build/global-state/utils.d.ts +4 -0
  52. package/build/global-state/utils.d.ts.map +1 -0
  53. package/build/global-state/utils.js +29 -0
  54. package/build/global-state/utils.js.map +1 -0
  55. package/build/hooks.d.ts +1 -1
  56. package/build/hooks.d.ts.map +1 -1
  57. package/build/hooks.js +9 -4
  58. package/build/hooks.js.map +1 -1
  59. package/build/layouts/DrawerClient.d.ts +2 -2
  60. package/build/layouts/StackClient.d.ts +2 -2
  61. package/build/layouts/StackClient.d.ts.map +1 -1
  62. package/build/layouts/StackClient.js +11 -6
  63. package/build/layouts/StackClient.js.map +1 -1
  64. package/build/layouts/TabsClient.d.ts +3 -3
  65. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  66. package/build/layouts/withLayoutContext.js +13 -0
  67. package/build/layouts/withLayoutContext.js.map +1 -1
  68. package/build/link/ExpoLink.d.ts.map +1 -1
  69. package/build/link/ExpoLink.js +3 -2
  70. package/build/link/ExpoLink.js.map +1 -1
  71. package/build/link/InternalLinkPreviewContext.d.ts +6 -0
  72. package/build/link/InternalLinkPreviewContext.d.ts.map +1 -0
  73. package/build/link/InternalLinkPreviewContext.js +6 -0
  74. package/build/link/InternalLinkPreviewContext.js.map +1 -0
  75. package/build/link/Link.d.ts +2 -67
  76. package/build/link/Link.d.ts.map +1 -1
  77. package/build/link/Link.js +5 -70
  78. package/build/link/Link.js.map +1 -1
  79. package/build/link/LinkWithPreview.d.ts +1 -46
  80. package/build/link/LinkWithPreview.d.ts.map +1 -1
  81. package/build/link/LinkWithPreview.js +20 -113
  82. package/build/link/LinkWithPreview.js.map +1 -1
  83. package/build/link/elements.d.ts +166 -0
  84. package/build/link/elements.d.ts.map +1 -0
  85. package/build/link/elements.js +172 -0
  86. package/build/link/elements.js.map +1 -0
  87. package/build/link/preview/HrefPreview.d.ts +1 -1
  88. package/build/link/preview/HrefPreview.d.ts.map +1 -1
  89. package/build/link/preview/HrefPreview.js +43 -7
  90. package/build/link/preview/HrefPreview.js.map +1 -1
  91. package/build/link/preview/LinkPreviewContext.d.ts +3 -2
  92. package/build/link/preview/LinkPreviewContext.d.ts.map +1 -1
  93. package/build/link/preview/LinkPreviewContext.js +3 -2
  94. package/build/link/preview/LinkPreviewContext.js.map +1 -1
  95. package/build/link/preview/native.d.ts +14 -6
  96. package/build/link/preview/native.d.ts.map +1 -1
  97. package/build/link/preview/native.js.map +1 -1
  98. package/build/link/preview/useNextScreenId.d.ts +8 -1
  99. package/build/link/preview/useNextScreenId.d.ts.map +1 -1
  100. package/build/link/preview/useNextScreenId.js +37 -32
  101. package/build/link/preview/useNextScreenId.js.map +1 -1
  102. package/build/link/preview/utils.d.ts +12 -0
  103. package/build/link/preview/utils.d.ts.map +1 -0
  104. package/build/link/preview/utils.js +66 -0
  105. package/build/link/preview/utils.js.map +1 -0
  106. package/build/modal/Modal.js +1 -1
  107. package/build/modal/Modal.js.map +1 -1
  108. package/build/modal/ModalsRenderer.js +1 -1
  109. package/build/modal/ModalsRenderer.js.map +1 -1
  110. package/build/modal/web/ModalStackRouteDrawer.web.d.ts.map +1 -1
  111. package/build/modal/web/ModalStackRouteDrawer.web.js +0 -1
  112. package/build/modal/web/ModalStackRouteDrawer.web.js.map +1 -1
  113. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +25 -0
  114. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -0
  115. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +27 -0
  116. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -0
  117. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts +3 -0
  118. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -0
  119. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +65 -0
  120. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -0
  121. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +7 -0
  122. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -0
  123. package/build/native-tabs/NativeBottomTabs/NativeTabs.js +9 -0
  124. package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +1 -0
  125. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +103 -0
  126. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -0
  127. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +69 -0
  128. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -0
  129. package/build/native-tabs/NativeBottomTabs/TabOptions.d.ts +40 -0
  130. package/build/native-tabs/NativeBottomTabs/TabOptions.d.ts.map +1 -0
  131. package/build/native-tabs/NativeBottomTabs/TabOptions.js +103 -0
  132. package/build/native-tabs/NativeBottomTabs/TabOptions.js.map +1 -0
  133. package/build/native-tabs/NativeBottomTabs/utils.d.ts +7 -0
  134. package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +1 -0
  135. package/build/native-tabs/NativeBottomTabs/utils.js +21 -0
  136. package/build/native-tabs/NativeBottomTabs/utils.js.map +1 -0
  137. package/build/native-tabs/common/elements.d.ts +59 -0
  138. package/build/native-tabs/common/elements.d.ts.map +1 -0
  139. package/build/native-tabs/common/elements.js +15 -0
  140. package/build/native-tabs/common/elements.js.map +1 -0
  141. package/build/native-tabs/index.d.ts +3 -0
  142. package/build/native-tabs/index.d.ts.map +1 -0
  143. package/build/native-tabs/index.js +10 -0
  144. package/build/native-tabs/index.js.map +1 -0
  145. package/build/routes-manifest.d.ts +42 -0
  146. package/build/routes-manifest.d.ts.map +1 -1
  147. package/build/routes-manifest.js.map +1 -1
  148. package/build/testing-library/mock-config.d.ts +18 -0
  149. package/build/testing-library/mock-config.d.ts.map +1 -1
  150. package/build/testing-library/mock-config.js +4 -1
  151. package/build/testing-library/mock-config.js.map +1 -1
  152. package/build/ui/common.d.ts.map +1 -1
  153. package/build/ui/common.js +7 -6
  154. package/build/ui/common.js.map +1 -1
  155. package/build/useNavigation.d.ts.map +1 -1
  156. package/build/useNavigation.js +8 -5
  157. package/build/useNavigation.js.map +1 -1
  158. package/build/views/NoSSR.d.ts +5 -0
  159. package/build/views/NoSSR.d.ts.map +1 -0
  160. package/build/views/NoSSR.js +22 -0
  161. package/build/views/NoSSR.js.map +1 -0
  162. package/build/views/Screen.d.ts.map +1 -1
  163. package/build/views/Screen.js +4 -1
  164. package/build/views/Screen.js.map +1 -1
  165. package/build/views/Sitemap.d.ts.map +1 -1
  166. package/build/views/Sitemap.js +75 -2
  167. package/build/views/Sitemap.js.map +1 -1
  168. package/build/views/Unmatched.d.ts.map +1 -1
  169. package/build/views/Unmatched.js +14 -4
  170. package/build/views/Unmatched.js.map +1 -1
  171. package/ios/ExpoHead.podspec +10 -1
  172. package/ios/LinkPreview/LinkPreviewNativeActionView.swift +159 -21
  173. package/ios/LinkPreview/LinkPreviewNativeModule.swift +37 -5
  174. package/ios/LinkPreview/LinkPreviewNativeNavigation.h +37 -11
  175. package/ios/LinkPreview/LinkPreviewNativeNavigation.mm +110 -87
  176. package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +136 -0
  177. package/ios/LinkPreview/LinkPreviewNativeView.swift +70 -70
  178. package/package.json +38 -9
  179. package/plugin/build/index.d.ts +2 -0
  180. package/plugin/options.json +5 -0
  181. package/plugin/src/index.ts +2 -0
  182. package/server.d.ts +2 -1
@@ -4,15 +4,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.HrefPreview = HrefPreview;
5
5
  const native_1 = require("@react-navigation/native");
6
6
  const react_1 = require("react");
7
+ const react_native_1 = require("react-native");
7
8
  const PreviewRouteContext_1 = require("./PreviewRouteContext");
8
9
  const constants_1 = require("../../constants");
9
10
  const router_store_1 = require("../../global-state/router-store");
11
+ const utils_1 = require("../../global-state/utils");
12
+ const hooks_1 = require("../../hooks");
10
13
  const useNavigation_1 = require("../../useNavigation");
11
14
  const useScreens_1 = require("../../useScreens");
12
15
  const linking_1 = require("../linking");
13
16
  function HrefPreview({ href }) {
17
+ const hrefState = (0, react_1.useMemo)(() => getHrefState(href), [href]);
18
+ const index = hrefState?.index ?? 0;
19
+ if (hrefState?.routes[index]?.name === constants_1.INTERNAL_SLOT_NAME) {
20
+ return <PreviewForRootHrefState hrefState={hrefState} href={href}/>;
21
+ }
22
+ const isInternalRoute = hrefState?.routes[index]?.name === constants_1.NOT_FOUND_ROUTE_NAME ||
23
+ hrefState?.routes[index]?.name === constants_1.SITEMAP_ROUTE_NAME;
24
+ const pathname = href.toString();
25
+ const segments = pathname.split('/').filter(Boolean);
26
+ return (<PreviewRouteContext_1.PreviewRouteContext.Provider value={{
27
+ params: {},
28
+ pathname,
29
+ segments,
30
+ }}>
31
+ {isInternalRoute ? <PreviewForInternalRoutes /> : null}
32
+ </PreviewRouteContext_1.PreviewRouteContext.Provider>);
33
+ }
34
+ function PreviewForRootHrefState({ hrefState, href }) {
14
35
  const navigation = (0, useNavigation_1.useNavigation)();
15
- const { routeNode, params, state } = getParamsAndNodeFromHref(href);
36
+ const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);
16
37
  const path = state ? (0, linking_1.getPathFromState)(state) : undefined;
17
38
  const value = (0, react_1.useMemo)(() => ({
18
39
  params,
@@ -20,7 +41,7 @@ function HrefPreview({ href }) {
20
41
  segments: path?.split('/').filter(Boolean) || [],
21
42
  }), [params, href]);
22
43
  // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.
23
- // It also check ensures TypeScript type safety.
44
+ // This check ensures TypeScript type safety as well.
24
45
  if (!routeNode) {
25
46
  return null;
26
47
  }
@@ -32,10 +53,26 @@ function HrefPreview({ href }) {
32
53
  </native_1.NavigationContext>
33
54
  </PreviewRouteContext_1.PreviewRouteContext>);
34
55
  }
35
- function getParamsAndNodeFromHref(href) {
56
+ function PreviewForInternalRoutes() {
57
+ const pathname = (0, hooks_1.usePathname)();
58
+ return (<react_native_1.View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', gap: 8 }}>
59
+ <react_native_1.Text style={{ fontWeight: '600', fontSize: 24 }}>Invalid preview</react_native_1.Text>
60
+ <react_native_1.Text style={{ fontWeight: '200', fontSize: 14 }}>{pathname}</react_native_1.Text>
61
+ </react_native_1.View>);
62
+ }
63
+ function getHrefState(href) {
36
64
  const hrefState = router_store_1.store.getStateForHref(href);
37
- if (hrefState?.routes[0] && hrefState.routes[0].name !== constants_1.INTERNAL_SLOT_NAME) {
38
- const error = `Expo Router Error: Expected navigation state to begin with a ${constants_1.INTERNAL_SLOT_NAME} route`;
65
+ return hrefState;
66
+ }
67
+ function getParamsAndNodeFromHref(hrefState) {
68
+ const index = hrefState?.index ?? 0;
69
+ if (hrefState?.routes[index] && hrefState.routes[index].name !== constants_1.INTERNAL_SLOT_NAME) {
70
+ const name = hrefState.routes[index].name;
71
+ if (name === constants_1.SITEMAP_ROUTE_NAME || name === constants_1.NOT_FOUND_ROUTE_NAME) {
72
+ console.log(router_store_1.store.routeNode);
73
+ console.log(hrefState);
74
+ }
75
+ const error = `Expo Router Error: Expected navigation state to begin with one of [${(0, utils_1.getRootStackRouteNames)().join(', ')}] routes`;
39
76
  if (process.env.NODE_ENV !== 'production') {
40
77
  throw new Error(error);
41
78
  }
@@ -43,8 +80,7 @@ function getParamsAndNodeFromHref(href) {
43
80
  console.warn(error);
44
81
  }
45
82
  }
46
- // Assuming that root of the state is __root
47
- const initialState = hrefState?.routes[0]?.state;
83
+ const initialState = hrefState?.routes[index]?.state;
48
84
  let state = initialState;
49
85
  let routeNode = router_store_1.store.routeNode;
50
86
  const params = {};
@@ -1 +1 @@
1
- {"version":3,"file":"HrefPreview.js","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAkBb,kCA+BC;AA/CD,qDAIkC;AAClC,iCAAgC;AAEhC,+DAA4D;AAE5D,+CAAqD;AACrD,kEAAwD;AAExD,uDAAoD;AACpD,iDAA8D;AAC9D,wCAA8C;AAE9C,SAAgB,WAAW,CAAC,EAAE,IAAI,EAAkB;IAClD,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAC;IACnC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAEpE,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,0BAAgB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEzD,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;QACzB,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE;KACjD,CAAC,EACF,CAAC,MAAM,EAAE,IAAI,CAAC,CACf,CAAC;IAEF,8GAA8G;IAC9G,gDAAgD;IAChD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,uCAA0B,EAAC,SAAS,CAAC,CAAC;IAExD,OAAO,CACL,CAAC,yCAAmB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAChC;MAAA,CAAC,uDAAuD,CACxD;MAAA,CAAC,0BAAiB,CAAC,KAAK,CAAC,CAAC,0BAA0B,CAAC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qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB;IACnB,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,GAAG,EAAE;QACb,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["'use client';\n\nimport {\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n} from '@react-navigation/native';\nimport { useMemo } from 'react';\n\nimport { PreviewRouteContext } from './PreviewRouteContext';\nimport { RouteNode } from '../../Route';\nimport { INTERNAL_SLOT_NAME } from '../../constants';\nimport { store } from '../../global-state/router-store';\nimport { Href, UnknownOutputParams } from '../../types';\nimport { useNavigation } from '../../useNavigation';\nimport { getQualifiedRouteComponent } from '../../useScreens';\nimport { getPathFromState } from '../linking';\n\nexport function HrefPreview({ href }: { href: Href }) {\n const navigation = useNavigation();\n const { routeNode, params, state } = getParamsAndNodeFromHref(href);\n\n const path = state ? getPathFromState(state) : undefined;\n\n const value = useMemo(\n () => ({\n params,\n pathname: href.toString(),\n segments: path?.split('/').filter(Boolean) || [],\n }),\n [params, href]\n );\n\n // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.\n // It also check ensures TypeScript type safety.\n if (!routeNode) {\n return null;\n }\n\n const Component = getQualifiedRouteComponent(routeNode);\n\n return (\n <PreviewRouteContext value={value}>\n {/* Using NavigationContext to override useNavigation */}\n <NavigationContext value={navigationPropWithWarnings}>\n <Component navigation={navigation} />\n </NavigationContext>\n </PreviewRouteContext>\n );\n}\n\nfunction getParamsAndNodeFromHref(href: Href) {\n const hrefState = store.getStateForHref(href as any);\n if (hrefState?.routes[0] && hrefState.routes[0].name !== INTERNAL_SLOT_NAME) {\n const error = `Expo Router Error: Expected navigation state to begin with a ${INTERNAL_SLOT_NAME} route`;\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(error);\n } else {\n console.warn(error);\n }\n }\n // Assuming that root of the state is __root\n const initialState = hrefState?.routes[0]?.state;\n let state = initialState;\n let routeNode: RouteNode | undefined | null = store.routeNode;\n\n const params: UnknownOutputParams = {};\n\n while (state && routeNode) {\n const route = state.routes[state.index || state.routes.length - 1];\n Object.assign(params, route.params);\n state = route.state;\n routeNode = routeNode.children.find((child) => child.route === route.name);\n }\n\n return { params, routeNode, state: initialState };\n}\n\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst navigationPropWithWarnings: NavigationProp<ParamListBase> = {\n setParams: createNOOPWithWarning('setParams'),\n setOptions: createNOOPWithWarning('setOptions'),\n addListener: (() => () => {}) as NavigationProp<ParamListBase>['addListener'],\n removeListener: () => {},\n isFocused: () => true,\n canGoBack: () => false,\n dispatch: createNOOPWithWarning('dispatch'),\n navigate: createNOOPWithWarning('navigate'),\n goBack: createNOOPWithWarning('goBack'),\n reset: createNOOPWithWarning('reset'),\n push: createNOOPWithWarning('push'),\n pop: createNOOPWithWarning('pop'),\n popToTop: createNOOPWithWarning('popToTop'),\n navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),\n preload: createNOOPWithWarning('preload'),\n getId: () => {\n displayWarningForProp('getId');\n return '';\n },\n // @ts-expect-error\n getParent: createNOOPWithWarning('getParent'),\n getState: () => {\n displayWarningForProp('getState');\n return {\n key: '',\n index: 0,\n routeNames: [],\n routes: [],\n type: '',\n stale: false,\n };\n },\n};\n"]}
1
+ {"version":3,"file":"HrefPreview.js","sourceRoot":"","sources":["../../../src/link/preview/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AqB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,qBAAqB,CAAC,YAAY,CAAC;IAC/C,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAiD;IAC7E,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI;IACrB,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK;IACtB,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;IAC3C,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;IAC3C,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IACvC,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC;IACrC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC;IACnC,GAAG,EAAE,qBAAqB,CAAC,KAAK,CAAC;IACjC,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;IAC3C,kBAAkB,EAAE,qBAAqB,CAAC,oBAAoB,CAAC;IAC/D,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC;IACzC,KAAK,EAAE,GAAG,EAAE;QACV,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB;IACnB,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,GAAG,EAAE;QACb,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["'use client';\n\nimport {\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n} from '@react-navigation/native';\nimport { useMemo } from 'react';\nimport { Text, View } from 'react-native';\n\nimport { PreviewRouteContext } from './PreviewRouteContext';\nimport { RouteNode } from '../../Route';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../../constants';\nimport { type ResultState } from '../../exports';\nimport { store } from '../../global-state/router-store';\nimport { getRootStackRouteNames } from '../../global-state/utils';\nimport { usePathname } from '../../hooks';\nimport { Href, UnknownOutputParams } from '../../types';\nimport { useNavigation } from '../../useNavigation';\nimport { getQualifiedRouteComponent } from '../../useScreens';\nimport { getPathFromState } from '../linking';\n\nexport function HrefPreview({ href }: { href: Href }) {\n const hrefState = useMemo(() => getHrefState(href), [href]);\n const index = hrefState?.index ?? 0;\n\n if (hrefState?.routes[index]?.name === INTERNAL_SLOT_NAME) {\n return <PreviewForRootHrefState hrefState={hrefState} href={href} />;\n }\n\n const isInternalRoute =\n hrefState?.routes[index]?.name === NOT_FOUND_ROUTE_NAME ||\n hrefState?.routes[index]?.name === SITEMAP_ROUTE_NAME;\n\n const pathname = href.toString();\n const segments = pathname.split('/').filter(Boolean);\n\n return (\n <PreviewRouteContext.Provider\n value={{\n params: {},\n pathname,\n segments,\n }}>\n {isInternalRoute ? <PreviewForInternalRoutes /> : null}\n </PreviewRouteContext.Provider>\n );\n}\n\nfunction PreviewForRootHrefState({ hrefState, href }: { hrefState: ResultState; href: Href }) {\n const navigation = useNavigation();\n const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);\n\n const path = state ? getPathFromState(state) : undefined;\n\n const value = useMemo(\n () => ({\n params,\n pathname: href.toString(),\n segments: path?.split('/').filter(Boolean) || [],\n }),\n [params, href]\n );\n\n // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.\n // This check ensures TypeScript type safety as well.\n if (!routeNode) {\n return null;\n }\n\n const Component = getQualifiedRouteComponent(routeNode);\n\n return (\n <PreviewRouteContext value={value}>\n {/* Using NavigationContext to override useNavigation */}\n <NavigationContext value={navigationPropWithWarnings}>\n <Component navigation={navigation} />\n </NavigationContext>\n </PreviewRouteContext>\n );\n}\n\nfunction PreviewForInternalRoutes() {\n const pathname = usePathname();\n return (\n <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', gap: 8 }}>\n <Text style={{ fontWeight: '600', fontSize: 24 }}>Invalid preview</Text>\n <Text style={{ fontWeight: '200', fontSize: 14 }}>{pathname}</Text>\n </View>\n );\n}\n\nfunction getHrefState(href: Href) {\n const hrefState = store.getStateForHref(href as any);\n return hrefState;\n}\n\nfunction getParamsAndNodeFromHref(hrefState: ResultState) {\n const index = hrefState?.index ?? 0;\n if (hrefState?.routes[index] && hrefState.routes[index].name !== INTERNAL_SLOT_NAME) {\n const name = hrefState.routes[index].name;\n if (name === SITEMAP_ROUTE_NAME || name === NOT_FOUND_ROUTE_NAME) {\n console.log(store.routeNode);\n console.log(hrefState);\n }\n const error = `Expo Router Error: Expected navigation state to begin with one of [${getRootStackRouteNames().join(', ')}] routes`;\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(error);\n } else {\n console.warn(error);\n }\n }\n const initialState = hrefState?.routes[index]?.state;\n let state = initialState;\n let routeNode: RouteNode | undefined | null = store.routeNode;\n\n const params: UnknownOutputParams = {};\n\n while (state && routeNode) {\n const route = state.routes[state.index || state.routes.length - 1];\n Object.assign(params, route.params);\n state = route.state;\n routeNode = routeNode.children.find((child) => child.route === route.name);\n }\n\n return { params, routeNode, state: initialState };\n}\n\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst navigationPropWithWarnings: NavigationProp<ParamListBase> = {\n setParams: createNOOPWithWarning('setParams'),\n setOptions: createNOOPWithWarning('setOptions'),\n addListener: (() => () => {}) as NavigationProp<ParamListBase>['addListener'],\n removeListener: () => {},\n isFocused: () => true,\n canGoBack: () => false,\n dispatch: createNOOPWithWarning('dispatch'),\n navigate: createNOOPWithWarning('navigate'),\n goBack: createNOOPWithWarning('goBack'),\n reset: createNOOPWithWarning('reset'),\n push: createNOOPWithWarning('push'),\n pop: createNOOPWithWarning('pop'),\n popToTop: createNOOPWithWarning('popToTop'),\n navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),\n preload: createNOOPWithWarning('preload'),\n getId: () => {\n displayWarningForProp('getId');\n return '';\n },\n // @ts-expect-error\n getParent: createNOOPWithWarning('getParent'),\n getState: () => {\n displayWarningForProp('getState');\n return {\n key: '',\n index: 0,\n routeNames: [],\n routes: [],\n type: '',\n stale: false,\n };\n },\n};\n"]}
@@ -1,7 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  export declare function LinkPreviewContextProvider({ children }: PropsWithChildren): import("react").JSX.Element;
3
3
  export declare const useLinkPreviewContext: () => {
4
- isPreviewOpen: boolean;
5
- setIsPreviewOpen: (isOpen: boolean) => void;
4
+ isStackAnimationDisabled: boolean;
5
+ openPreviewKey: string | undefined;
6
+ setOpenPreviewKey: (openPreviewKey: string | undefined) => void;
6
7
  };
7
8
  //# sourceMappingURL=LinkPreviewContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkPreviewContext.d.ts","sourceRoot":"","sources":["../../../src/link/preview/LinkPreviewContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAUxE,wBAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAOzE;AAED,eAAO,MAAM,qBAAqB;mBAfb,OAAO;sBACJ,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI;CAsBhD,CAAC"}
1
+ {"version":3,"file":"LinkPreviewContext.d.ts","sourceRoot":"","sources":["../../../src/link/preview/LinkPreviewContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAWxE,wBAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BASzE;AAED,eAAO,MAAM,qBAAqB;8BAlBF,OAAO;oBACjB,MAAM,GAAG,SAAS;uBACf,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;CAwBpE,CAAC"}
@@ -5,8 +5,9 @@ exports.LinkPreviewContextProvider = LinkPreviewContextProvider;
5
5
  const react_1 = require("react");
6
6
  const LinkPreviewContext = (0, react_1.createContext)(undefined);
7
7
  function LinkPreviewContextProvider({ children }) {
8
- const [isPreviewOpen, setIsPreviewOpen] = (0, react_1.useState)(false);
9
- return (<LinkPreviewContext.Provider value={{ isPreviewOpen, setIsPreviewOpen }}>
8
+ const [openPreviewKey, setOpenPreviewKey] = (0, react_1.useState)(undefined);
9
+ const isStackAnimationDisabled = openPreviewKey !== undefined;
10
+ return (<LinkPreviewContext.Provider value={{ isStackAnimationDisabled, openPreviewKey, setOpenPreviewKey }}>
10
11
  {children}
11
12
  </LinkPreviewContext.Provider>);
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LinkPreviewContext.js","sourceRoot":"","sources":["../../../src/link/preview/LinkPreviewContext.tsx"],"names":[],"mappings":";;;AAUA,gEAOC;AAjBD,iCAAwE;AAExE,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAMtC,SAAS,CAAC,CAAC;AAEb,SAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAqB;IACxE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC1D,OAAO,CACL,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,CACtE;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAC/B,CAAC;AACJ,CAAC;AAEM,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,kBAAkB,CAAC,CAAC;IACxC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC","sourcesContent":["import { createContext, PropsWithChildren, use, useState } from 'react';\n\nconst LinkPreviewContext = createContext<\n | {\n isPreviewOpen: boolean;\n setIsPreviewOpen: (isOpen: boolean) => void;\n }\n | undefined\n>(undefined);\n\nexport function LinkPreviewContextProvider({ children }: PropsWithChildren) {\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n return (\n <LinkPreviewContext.Provider value={{ isPreviewOpen, setIsPreviewOpen }}>\n {children}\n </LinkPreviewContext.Provider>\n );\n}\n\nexport const useLinkPreviewContext = () => {\n const context = use(LinkPreviewContext);\n if (context == null) {\n throw new Error(\n 'useLinkPreviewContext must be used within a LinkPreviewContextProvider. This is likely a bug in Expo Router.'\n );\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"LinkPreviewContext.js","sourceRoot":"","sources":["../../../src/link/preview/LinkPreviewContext.tsx"],"names":[],"mappings":";;;AAWA,gEASC;AApBD,iCAAwE;AAExE,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAOtC,SAAS,CAAC,CAAC;AAEb,SAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAqB;IACxE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAqB,SAAS,CAAC,CAAC;IACpF,MAAM,wBAAwB,GAAG,cAAc,KAAK,SAAS,CAAC;IAC9D,OAAO,CACL,CAAC,kBAAkB,CAAC,QAAQ,CAC1B,KAAK,CAAC,CAAC,EAAE,wBAAwB,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,CACvE;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAC/B,CAAC;AACJ,CAAC;AAEM,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,kBAAkB,CAAC,CAAC;IACxC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC","sourcesContent":["import { createContext, PropsWithChildren, use, useState } from 'react';\n\nconst LinkPreviewContext = createContext<\n | {\n isStackAnimationDisabled: boolean;\n openPreviewKey: string | undefined;\n setOpenPreviewKey: (openPreviewKey: string | undefined) => void;\n }\n | undefined\n>(undefined);\n\nexport function LinkPreviewContextProvider({ children }: PropsWithChildren) {\n const [openPreviewKey, setOpenPreviewKey] = useState<string | undefined>(undefined);\n const isStackAnimationDisabled = openPreviewKey !== undefined;\n return (\n <LinkPreviewContext.Provider\n value={{ isStackAnimationDisabled, openPreviewKey, setOpenPreviewKey }}>\n {children}\n </LinkPreviewContext.Provider>\n );\n}\n\nexport const useLinkPreviewContext = () => {\n const context = use(LinkPreviewContext);\n if (context == null) {\n throw new Error(\n 'useLinkPreviewContext must be used within a LinkPreviewContextProvider. This is likely a bug in Expo Router.'\n );\n }\n return context;\n};\n"]}
@@ -2,19 +2,27 @@ import { type ViewProps } from 'react-native';
2
2
  export interface NativeLinkPreviewActionProps {
3
3
  title: string;
4
4
  icon?: string;
5
- id: string;
6
5
  children?: React.ReactNode;
6
+ disabled?: boolean;
7
+ destructive?: boolean;
8
+ displayAsPalette?: boolean;
9
+ displayInline?: boolean;
10
+ isOn?: boolean;
11
+ keepPresented?: boolean;
12
+ onSelected: () => void;
7
13
  }
8
14
  export declare function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps): import("react").JSX.Element | null;
9
15
  export type NativeLinkPreviewTriggerProps = ViewProps;
10
16
  export declare function NativeLinkPreviewTrigger(props: NativeLinkPreviewTriggerProps): import("react").JSX.Element | null;
17
+ export interface TabPath {
18
+ oldTabKey: string;
19
+ newTabKey: string;
20
+ }
11
21
  export interface NativeLinkPreviewProps extends ViewProps {
12
22
  nextScreenId: string | undefined;
13
- onActionSelected?: (event: {
14
- nativeEvent: {
15
- id: string;
16
- };
17
- }) => void;
23
+ tabPath: {
24
+ path: TabPath[];
25
+ } | undefined;
18
26
  onWillPreviewOpen?: () => void;
19
27
  onDidPreviewOpen?: () => void;
20
28
  onPreviewWillClose?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAK1D,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,sCAK1E;AAID,MAAM,MAAM,6BAA6B,GAAG,SAAS,CAAC;AAKtD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,sCAK5E;AAID,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACpE,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,IAAI,C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AI,KAAK,CAAC,EAAG,CAAC;AACpD,CAAC;AAKD,MAAM,4BAA4B,GAChC,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,0BAA0B,CAAC;IAC9E,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,4BAA4B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACrD,CAAC;AAeD,MAAM,qBAAqB,GACzB,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,uBAAuB,CAAC;IAC3E,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC9C,CAAC;AAOD,MAAM,4BAA4B,GAChC,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,8BAA8B,CAAC;IAClF,CAAC,CAAC,IAAI,CAAC;AAEX,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,yBAAU,CAAC,OAAO,CAAC;QAC/B,KAAK,CAAC,KAAK;QACX;YACE,QAAQ,EAAE,UAAU;SACZ;KACX,CAAC,CAAC;IACH,OAAO,CAAC,4BAA4B,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;AACnE,CAAC;AACD,aAAa","sourcesContent":["'use client';\n\nimport { requireNativeView } from 'expo';\nimport { StyleSheet, type ViewProps } from 'react-native';\n\nconst areNativeViewsAvailable = process.env.EXPO_OS === 'ios' && global.RN$Bridgeless === true;\n\n// #region Action View\nexport interface NativeLinkPreviewActionProps {\n title: string;\n icon?: string;\n id: string;\n children?: React.ReactNode;\n}\nconst LinkPreviewNativeActionView: React.ComponentType<NativeLinkPreviewActionProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')\n : null;\nexport function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps) {\n if (!LinkPreviewNativeActionView) {\n return null;\n }\n return <LinkPreviewNativeActionView {...props} />;\n}\n// #endregion\n\n// #region Trigger View\nexport type NativeLinkPreviewTriggerProps = ViewProps;\nconst NativeLinkPreviewTriggerView: React.ComponentType<NativeLinkPreviewTriggerProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewTrigger')\n : null;\nexport function NativeLinkPreviewTrigger(props: NativeLinkPreviewTriggerProps) {\n if (!NativeLinkPreviewTriggerView) {\n return null;\n }\n return <NativeLinkPreviewTriggerView {...props} />;\n}\n// #endregion\n\n// #region Preview View\nexport interface NativeLinkPreviewProps extends ViewProps {\n nextScreenId: string | undefined;\n onActionSelected?: (event: { nativeEvent: { id: string } }) => void;\n onWillPreviewOpen?: () => void;\n onDidPreviewOpen?: () => void;\n onPreviewWillClose?: () => void;\n onPreviewDidClose?: () => void;\n onPreviewTapped?: () => void;\n onPreviewTappedAnimationCompleted?: () => void;\n children: React.ReactNode;\n}\nconst NativeLinkPreviewView: React.ComponentType<NativeLinkPreviewProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')\n : null;\nexport function NativeLinkPreview(props: NativeLinkPreviewProps) {\n if (!NativeLinkPreviewView) {\n return null;\n }\n return <NativeLinkPreviewView {...props} />;\n}\n// #endregion\n\n// #region Preview Content View\nexport interface NativeLinkPreviewContentProps extends ViewProps {\n preferredContentSize?: { width: number; height: number };\n}\nconst NativeLinkPreviewContentView: React.ComponentType<NativeLinkPreviewContentProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')\n : null;\n\nexport function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps) {\n if (!NativeLinkPreviewContentView) {\n return null;\n }\n const style = StyleSheet.flatten([\n props.style,\n {\n position: 'absolute',\n } as const,\n ]);\n return <NativeLinkPreviewContentView {...props} style={style} />;\n}\n// #endregion\n"]}
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA+Bb,0DAKC;AASD,4DAKC;AA2BD,8CAKC;AAYD,4DAWC;AAvGD,+BAAyC;AACzC,+CAA0D;AAE1D,MAAM,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC;AAsB/F,MAAM,2BAA2B,GAC/B,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,6BAA6B,CAAC;IACjF,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,uBAAuB,CAAC,KAAmC;IACzE,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,2BAA2B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACpD,CAAC;AAKD,MAAM,4BAA4B,GAChC,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,0BAA0B,CAAC;IAC9E,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,4BAA4B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACrD,CAAC;AAuBD,MAAM,qBAAqB,GACzB,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,uBAAuB,CAAC;IAC3E,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC9C,CAAC;AAOD,MAAM,4BAA4B,GAChC,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,8BAA8B,CAAC;IAClF,CAAC,CAAC,IAAI,CAAC;AAEX,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,yBAAU,CAAC,OAAO,CAAC;QAC/B,KAAK,CAAC,KAAK;QACX;YACE,QAAQ,EAAE,UAAU;SACZ;KACX,CAAC,CAAC;IACH,OAAO,CAAC,4BAA4B,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;AACnE,CAAC;AACD,aAAa","sourcesContent":["'use client';\n\nimport { requireNativeView } from 'expo';\nimport { StyleSheet, type ViewProps } from 'react-native';\n\nconst areNativeViewsAvailable = process.env.EXPO_OS === 'ios' && global.RN$Bridgeless === true;\n\n// #region Action View\nexport interface NativeLinkPreviewActionProps {\n title: string;\n icon?: string;\n children?: React.ReactNode;\n disabled?: boolean;\n destructive?: boolean;\n // This may lead to race conditions, when two menu actions are on at the same time.\n // The logic should be enforced in the JS code, rather than in the native code.\n // singleSelection?: boolean;\n displayAsPalette?: boolean;\n displayInline?: boolean;\n isOn?: boolean;\n // There are issues with menu state updates when keep presented is set to true.\n // When updating the context menu state, it will either not update or it will recreate the menu. The latter is a problem,\n // because it will close all opened submenus and reset the scroll position.\n // TODO: (@ubax) find a way to fix this.\n keepPresented?: boolean;\n onSelected: () => void;\n}\nconst LinkPreviewNativeActionView: React.ComponentType<NativeLinkPreviewActionProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')\n : null;\nexport function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps) {\n if (!LinkPreviewNativeActionView) {\n return null;\n }\n return <LinkPreviewNativeActionView {...props} />;\n}\n// #endregion\n\n// #region Trigger View\nexport type NativeLinkPreviewTriggerProps = ViewProps;\nconst NativeLinkPreviewTriggerView: React.ComponentType<NativeLinkPreviewTriggerProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewTrigger')\n : null;\nexport function NativeLinkPreviewTrigger(props: NativeLinkPreviewTriggerProps) {\n if (!NativeLinkPreviewTriggerView) {\n return null;\n }\n return <NativeLinkPreviewTriggerView {...props} />;\n}\n// #endregion\n\n// #region Preview View\nexport interface TabPath {\n oldTabKey: string;\n newTabKey: string;\n}\nexport interface NativeLinkPreviewProps extends ViewProps {\n nextScreenId: string | undefined;\n tabPath:\n | {\n path: TabPath[];\n }\n | undefined;\n onWillPreviewOpen?: () => void;\n onDidPreviewOpen?: () => void;\n onPreviewWillClose?: () => void;\n onPreviewDidClose?: () => void;\n onPreviewTapped?: () => void;\n onPreviewTappedAnimationCompleted?: () => void;\n children: React.ReactNode;\n}\nconst NativeLinkPreviewView: React.ComponentType<NativeLinkPreviewProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')\n : null;\nexport function NativeLinkPreview(props: NativeLinkPreviewProps) {\n if (!NativeLinkPreviewView) {\n return null;\n }\n return <NativeLinkPreviewView {...props} />;\n}\n// #endregion\n\n// #region Preview Content View\nexport interface NativeLinkPreviewContentProps extends ViewProps {\n preferredContentSize?: { width: number; height: number };\n}\nconst NativeLinkPreviewContentView: React.ComponentType<NativeLinkPreviewContentProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')\n : null;\n\nexport function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps) {\n if (!NativeLinkPreviewContentView) {\n return null;\n }\n const style = StyleSheet.flatten([\n props.style,\n {\n position: 'absolute',\n } as const,\n ]);\n return <NativeLinkPreviewContentView {...props} style={style} />;\n}\n// #endregion\n"]}
@@ -1,3 +1,10 @@
1
+ import { TabPath } from './native';
1
2
  import { Href } from '../../types';
2
- export declare function useNextScreenId(): [string | undefined, (href: Href) => void];
3
+ export declare function useNextScreenId(): [
4
+ {
5
+ nextScreenId: string | undefined;
6
+ tabPath: TabPath[];
7
+ },
8
+ (href: Href) => void
9
+ ];
3
10
  //# sourceMappingURL=useNextScreenId.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNextScreenId.d.ts","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGnC,wBAAgB,eAAe,IAAI,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,CAQ5E"}
1
+ {"version":3,"file":"useNextScreenId.d.ts","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,wBAAgB,eAAe,IAAI;IACjC;QAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;IACxD,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;CACrB,CA0CA"}
@@ -2,41 +2,46 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useNextScreenId = useNextScreenId;
4
4
  const react_1 = require("react");
5
+ const LinkPreviewContext_1 = require("./LinkPreviewContext");
6
+ const utils_1 = require("./utils");
5
7
  const router_store_1 = require("../../global-state/router-store");
6
- const href_1 = require("../href");
8
+ const hooks_1 = require("../../hooks");
7
9
  function useNextScreenId() {
10
+ const router = (0, hooks_1.useRouter)();
11
+ const { setOpenPreviewKey } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
8
12
  const [internalNextScreenId, internalSetNextScreenId] = (0, react_1.useState)();
9
- const setNextScreenId = (0, react_1.useCallback)((href) => {
10
- const preloadedRoute = getPreloadedRouteFromRootStateByHref(href);
11
- const routeKey = preloadedRoute?.key;
12
- internalSetNextScreenId(routeKey);
13
- }, []);
14
- return [internalNextScreenId, setNextScreenId];
15
- }
16
- function getPreloadedRouteFromRootStateByHref(href) {
17
- const rootState = router_store_1.store.state;
18
- let hrefState = router_store_1.store.getStateForHref((0, href_1.resolveHref)(href));
19
- let state = rootState;
20
- while (hrefState && state) {
21
- const currentHrefRoute = hrefState.routes[0];
22
- const currentStateRoute = currentHrefRoute
23
- ? state.routes.find((r) => r.name === currentHrefRoute.name)
24
- : undefined;
25
- if (!currentStateRoute) {
26
- // Only checking stack, because it is the only native navigator.
27
- if (state.type === 'stack') {
28
- const stackState = state;
29
- // Sometimes the route is stored inside params
30
- const innerRoute = currentHrefRoute.state ? currentHrefRoute.state.routes[0] : undefined;
31
- const preloadedRoute = stackState.preloadedRoutes.find((route) => route.name === currentHrefRoute.name &&
32
- (!innerRoute ||
33
- (route.params && 'screen' in route.params && route.params.screen === innerRoute.name)));
34
- return preloadedRoute;
13
+ const currentHref = (0, react_1.useRef)(undefined);
14
+ const [tabPath, setTabPath] = (0, react_1.useState)([]);
15
+ (0, react_1.useEffect)(() => {
16
+ // When screen is prefetched, then the root state is updated with the preloaded route.
17
+ return router_store_1.store.navigationRef.addListener('state', ({ data: { state } }) => {
18
+ // If we have the current href, it means that we prefetched the route
19
+ if (currentHref.current && state) {
20
+ const preloadedRoute = (0, utils_1.getPreloadedRouteFromRootStateByHref)(currentHref.current, state);
21
+ const routeKey = preloadedRoute?.key;
22
+ console.log('routeKey', routeKey);
23
+ const tabPathFromRootState = (0, utils_1.getTabPathFromRootStateByHref)(currentHref.current, state);
24
+ // Without this timeout react-native does not have enough time to mount the new screen
25
+ // and thus it will not be found on the native side
26
+ if (routeKey || tabPathFromRootState.length) {
27
+ setTimeout(() => {
28
+ internalSetNextScreenId(routeKey);
29
+ setOpenPreviewKey(routeKey);
30
+ setTabPath(tabPathFromRootState);
31
+ });
32
+ }
33
+ // We got the preloaded state, so we can reset the currentHref
34
+ // to prevent unnecessary processing
35
+ currentHref.current = undefined;
35
36
  }
36
- }
37
- hrefState = currentHrefRoute?.state;
38
- state = currentStateRoute?.state;
39
- }
40
- return undefined;
37
+ });
38
+ }, []);
39
+ const prefetch = (0, react_1.useCallback)((href) => {
40
+ // Resetting the nextScreenId to undefined
41
+ internalSetNextScreenId(undefined);
42
+ router.prefetch(href);
43
+ currentHref.current = href;
44
+ }, [router.prefetch]);
45
+ return [{ nextScreenId: internalNextScreenId, tabPath }, prefetch];
41
46
  }
42
47
  //# sourceMappingURL=useNextScreenId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNextScreenId.js","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":";;AAWA,0CAQC;AAdD,iCAA8C;AAE9C,kEAAmF;AAEnF,kCAAsC;AAEtC,SAAgB,eAAe;IAC7B,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,IAAA,gBAAQ,GAAsB,CAAC;IACvF,MAAM,eAAe,GAAG,IAAA,mBAAW,EAAC,CAAC,IAAU,EAAQ,EAAE;QACvD,MAAM,cAAc,GAAG,oCAAoC,CAAC,IAAI,CAAC,CAAC;QAClE,MAAM,QAAQ,GAAG,cAAc,EAAE,GAAG,CAAC;QACrC,uBAAuB,CAAC,QAAQ,CAA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C,CAAC,CAC3F,CAAC;gBACF,OAAO,cAAc,CAAC;YACxB,CAAC;QACH,CAAC;QACD,SAAS,GAAG,gBAAgB,EAAE,KAAK,CAAC;QACpC,KAAK,GAAG,iBAAiB,EAAE,KAAK,CAAC;IACnC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {\n ParamListBase,\n StackNavigationState,\n type NavigationRoute,\n} from '@react-navigation/native';\nimport { useCallback, useState } from 'react';\n\nimport { store, type ReactNavigationState } from '../../global-state/router-store';\nimport { Href } from '../../types';\nimport { resolveHref } from '../href';\n\nexport function useNextScreenId(): [string | undefined, (href: Href) => void] {\n const [internalNextScreenId, internalSetNextScreenId] = useState<string | undefined>();\n const setNextScreenId = useCallback((href: Href): void => {\n const preloadedRoute = getPreloadedRouteFromRootStateByHref(href);\n const routeKey = preloadedRoute?.key;\n internalSetNextScreenId(routeKey);\n }, []);\n return [internalNextScreenId, setNextScreenId];\n}\n\nfunction getPreloadedRouteFromRootStateByHref(\n href: Href\n): NavigationRoute<ParamListBase, string> | undefined {\n const rootState = store.state;\n let hrefState = store.getStateForHref(resolveHref(href));\n let state: ReactNavigationState | undefined = rootState;\n while (hrefState && state) {\n const currentHrefRoute = hrefState.routes[0];\n const currentStateRoute = currentHrefRoute\n ? state.routes.find((r) => r.name === currentHrefRoute.name)\n : undefined;\n\n if (!currentStateRoute) {\n // Only checking stack, because it is the only native navigator.\n if (state.type === 'stack') {\n const stackState = state as StackNavigationState<ParamListBase>;\n // Sometimes the route is stored inside params\n const innerRoute = currentHrefRoute.state ? currentHrefRoute.state.routes[0] : undefined;\n const preloadedRoute = stackState.preloadedRoutes.find(\n (route) =>\n route.name === currentHrefRoute.name &&\n (!innerRoute ||\n (route.params && 'screen' in route.params && route.params.screen === innerRoute.name))\n );\n return preloadedRoute;\n }\n }\n hrefState = currentHrefRoute?.state;\n state = currentStateRoute?.state;\n }\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"useNextScreenId.js","source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,CAAC,CAAC;wBAC5B,UAAU,CAAC,oBAAoB,CAAC,CAAC;oBACnC,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,8DAA8D;gBAC9D,oCAAoC;gBACpC,WAAW,CAAC,OAAO,GAAG,SAAS,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAC1B,CAAC,IAAU,EAAQ,EAAE;QACnB,0CAA0C;QAC1C,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7B,CAAC,EACD,CAAC,MAAM,CAAC,QAAQ,CAAC,CAClB,CAAC;IACF,OAAO,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useLinkPreviewContext } from './LinkPreviewContext';\nimport { TabPath } from './native';\nimport { getPreloadedRouteFromRootStateByHref, getTabPathFromRootStateByHref } from './utils';\nimport { store } from '../../global-state/router-store';\nimport { useRouter } from '../../hooks';\nimport { Href } from '../../types';\n\nexport function useNextScreenId(): [\n { nextScreenId: string | undefined; tabPath: TabPath[] },\n (href: Href) => void,\n] {\n const router = useRouter();\n const { setOpenPreviewKey } = useLinkPreviewContext();\n const [internalNextScreenId, internalSetNextScreenId] = useState<string | undefined>();\n const currentHref = useRef<Href | undefined>(undefined);\n const [tabPath, setTabPath] = useState<TabPath[]>([]);\n\n useEffect(() => {\n // When screen is prefetched, then the root state is updated with the preloaded route.\n return store.navigationRef.addListener('state', ({ data: { state } }) => {\n // If we have the current href, it means that we prefetched the route\n if (currentHref.current && state) {\n const preloadedRoute = getPreloadedRouteFromRootStateByHref(currentHref.current, state);\n const routeKey = preloadedRoute?.key;\n console.log('routeKey', routeKey);\n const tabPathFromRootState = getTabPathFromRootStateByHref(currentHref.current, state);\n // Without this timeout react-native does not have enough time to mount the new screen\n // and thus it will not be found on the native side\n if (routeKey || tabPathFromRootState.length) {\n setTimeout(() => {\n internalSetNextScreenId(routeKey);\n setOpenPreviewKey(routeKey);\n setTabPath(tabPathFromRootState);\n });\n }\n // We got the preloaded state, so we can reset the currentHref\n // to prevent unnecessary processing\n currentHref.current = undefined;\n }\n });\n }, []);\n\n const prefetch = useCallback(\n (href: Href): void => {\n // Resetting the nextScreenId to undefined\n internalSetNextScreenId(undefined);\n router.prefetch(href);\n currentHref.current = href;\n },\n [router.prefetch]\n );\n return [{ nextScreenId: internalNextScreenId, tabPath }, prefetch];\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { ParamListBase, type NavigationRoute } from '@react-navigation/native';
2
+ import { type ReactNavigationState } from '../../global-state/router-store';
3
+ import { Href } from '../../types';
4
+ import { TabPath } from './native';
5
+ export declare function getTabPathFromRootStateByHref(href: Href, rootState: ReactNavigationState): TabPath[];
6
+ export declare function getPreloadedRouteFromRootStateByHref(href: Href, rootState: ReactNavigationState): NavigationRoute<ParamListBase, string> | undefined;
7
+ export declare function deepEqual(a: {
8
+ [key: string]: any;
9
+ } | undefined, b: {
10
+ [key: string]: any;
11
+ } | undefined): boolean;
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAS,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEnF,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,OAAO,EAAE,CA4BX;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,SAAS,CA4BpD;AAED,wBAAgB,SAAS,CACvB,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,EACrC,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,GACpC,OAAO,CAYT"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTabPathFromRootStateByHref = getTabPathFromRootStateByHref;
4
+ exports.getPreloadedRouteFromRootStateByHref = getPreloadedRouteFromRootStateByHref;
5
+ exports.deepEqual = deepEqual;
6
+ const router_store_1 = require("../../global-state/router-store");
7
+ const routing_1 = require("../../global-state/routing");
8
+ const href_1 = require("../href");
9
+ function getTabPathFromRootStateByHref(href, rootState) {
10
+ const hrefState = router_store_1.store.getStateForHref((0, href_1.resolveHref)(href));
11
+ const state = rootState;
12
+ if (!hrefState || !state) {
13
+ return [];
14
+ }
15
+ // Replicating the logic from `linkTo`
16
+ const { navigationRoutes } = (0, routing_1.findDivergentState)(hrefState, state, true);
17
+ if (!navigationRoutes.length) {
18
+ return [];
19
+ }
20
+ const tabPath = [];
21
+ navigationRoutes.forEach((route, i, arr) => {
22
+ if (route.state?.type === 'tab') {
23
+ const tabState = route.state;
24
+ const oldTabKey = tabState.routes[tabState.index].key;
25
+ if (!arr[i + 1]) {
26
+ throw new Error(`New tab route is missing for ${route.key}. This is likely an internal Expo Router bug.`);
27
+ }
28
+ const newTabKey = arr[i + 1].key;
29
+ tabPath.push({ oldTabKey, newTabKey });
30
+ }
31
+ });
32
+ return tabPath;
33
+ }
34
+ function getPreloadedRouteFromRootStateByHref(href, rootState) {
35
+ const hrefState = router_store_1.store.getStateForHref((0, href_1.resolveHref)(href));
36
+ const state = rootState;
37
+ if (!hrefState || !state) {
38
+ return undefined;
39
+ }
40
+ // Replicating the logic from `linkTo`
41
+ const { navigationState, actionStateRoute } = (0, routing_1.findDivergentState)(hrefState, state, true);
42
+ if (!navigationState || !actionStateRoute) {
43
+ return undefined;
44
+ }
45
+ if (navigationState.type === 'stack') {
46
+ const stackState = navigationState;
47
+ const payload = (0, routing_1.getPayloadFromStateRoute)(actionStateRoute);
48
+ const preloadedRoute = stackState.preloadedRoutes.find((route) => route.name === actionStateRoute.name && deepEqual(route.params, payload.params));
49
+ return preloadedRoute;
50
+ }
51
+ return undefined;
52
+ }
53
+ function deepEqual(a, b) {
54
+ if (a === b) {
55
+ return true;
56
+ }
57
+ if (a == null || b == null) {
58
+ return false;
59
+ }
60
+ if (typeof a !== 'object' || typeof b !== 'object') {
61
+ return false;
62
+ }
63
+ const keys = Object.keys(a).filter((key) => key !== '__internal__expoRouterIsPreviewNavigation');
64
+ return keys.length === Object.keys(b).length && keys.every((key) => deepEqual(a[key], b[key]));
65
+ }
66
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":";;AAcA,sEA+BC;AAED,oFA+BC;AAED,8BAeC;AAvFD,kEAAmF;AACnF,wDAA0F;AAE1F,kCAAsC;AAGtC,SAAgB,6BAA6B,CAC3C,IAAU,EACV,SAA+B;IAE/B,MAAM,SAAS,GAAG,oBAAK,CAAC,eAAe,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAqC,SAAS,CAAC;IAC1D,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,sCAAsC;IACtC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,4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AAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import {\n ParamListBase,\n StackNavigationState,\n type NavigationRoute,\n type NavigationState,\n type TabNavigationState,\n} from '@react-navigation/native';\n\nimport { store, type ReactNavigationState } from '../../global-state/router-store';\nimport { findDivergentState, getPayloadFromStateRoute } from '../../global-state/routing';\nimport { Href } from '../../types';\nimport { resolveHref } from '../href';\nimport { TabPath } from './native';\n\nexport function getTabPathFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): TabPath[] {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return [];\n }\n // Replicating the logic from `linkTo`\n const { navigationRoutes } = findDivergentState(hrefState, state as NavigationState, true);\n\n if (!navigationRoutes.length) {\n return [];\n }\n\n const tabPath: TabPath[] = [];\n navigationRoutes.forEach((route, i, arr) => {\n if (route.state?.type === 'tab') {\n const tabState = route.state as TabNavigationState<ParamListBase>;\n const oldTabKey = tabState.routes[tabState.index].key;\n if (!arr[i + 1]) {\n throw new Error(\n `New tab route is missing for ${route.key}. This is likely an internal Expo Router bug.`\n );\n }\n const newTabKey = arr[i + 1].key;\n tabPath.push({ oldTabKey, newTabKey });\n }\n });\n return tabPath;\n}\n\nexport function getPreloadedRouteFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): NavigationRoute<ParamListBase, string> | undefined {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return undefined;\n }\n // Replicating the logic from `linkTo`\n const { navigationState, actionStateRoute } = findDivergentState(\n hrefState,\n state as NavigationState,\n true\n );\n\n if (!navigationState || !actionStateRoute) {\n return undefined;\n }\n\n if (navigationState.type === 'stack') {\n const stackState = navigationState as StackNavigationState<ParamListBase>;\n const payload = getPayloadFromStateRoute(actionStateRoute);\n\n const preloadedRoute = stackState.preloadedRoutes.find(\n (route) => route.name === actionStateRoute.name && deepEqual(route.params, payload.params)\n );\n return preloadedRoute;\n }\n\n return undefined;\n}\n\nexport function deepEqual(\n a: { [key: string]: any } | undefined,\n b: { [key: string]: any } | undefined\n): boolean {\n if (a === b) {\n return true;\n }\n if (a == null || b == null) {\n return false;\n }\n if (typeof a !== 'object' || typeof b !== 'object') {\n return false;\n }\n const keys = Object.keys(a).filter((key) => key !== '__internal__expoRouterIsPreviewNavigation');\n return keys.length === Object.keys(b).length && keys.every((key) => deepEqual(a[key], b[key]));\n}\n"]}
@@ -65,7 +65,7 @@ function Modal(props) {
65
65
  component: children,
66
66
  uniqueId: newId,
67
67
  parentNavigationProp: navigation,
68
- detents: detents ?? 'fitToContents',
68
+ detents: detents ?? (presentationStyle === 'formSheet' ? 'fitToContents' : undefined),
69
69
  });
70
70
  setCurrentModalId(newId);
71
71
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/modal/Modal.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAwGb,sBAgGC;AArMD,kDAA2C;AAC3C,iCAA4C;AAC5C,+CAAqD;AAGrD,iDAAmE;AACnE,oDAAiD;AACjD,mCAA0C;AAqE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,KAAK,CAAC,KAAiB;IACrC,MAAM,EACJ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,iBAAiB,EACjB,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,IAAA,8BAAe,GAAE,CAAC;IACnF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,GAAsB,CAAC;IAC3E,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAiC,CAAC;IAClE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAA,uBA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CAAC;AACd,CAAC","sourcesContent":["'use client';\n\nimport { type NavigationProp, type ParamListBase } from '@react-navigation/native';\nimport { nanoid } from 'nanoid/non-secure';\nimport { useEffect, useState } from 'react';\nimport { StyleSheet, ViewProps } from 'react-native';\nimport { type ScreenProps } from 'react-native-screens';\n\nimport { useModalContext, type ModalConfig } from './ModalContext';\nimport { useNavigation } from '../useNavigation';\nimport { areDetentsValid } from './utils';\n\nexport interface ModalProps extends ViewProps {\n /**\n * The content of the modal.\n */\n children?: React.ReactNode;\n /**\n * Whether the modal is visible or not.\n * When set to `true`, the modal will be opened.\n * When set to `false`, the modal will be closed.\n */\n visible: boolean;\n /**\n * Callback that is called after modal is closed.\n * This is called when the modal is closed programmatically or when the user dismisses it.\n */\n onClose?: () => void;\n /**\n * Callback that is called after modal is shown.\n */\n onShow?: () => void;\n /**\n * The animation type for the modal.\n * This can be one of 'none', 'slide', or 'fade'.\n */\n animationType?: ModalConfig['animationType'];\n /**\n * The presentation style for the modal.\n * This can be one of 'fullScreen', 'pageSheet', 'formSheet', or 'overFullScreen'.\n * - `fullScreen`: The modal covers the entire screen. When `transparent` is set to `true`, it will fallback to `overFullScreen`.\n * - `pageSheet`: The modal is presented as a page sheet on iOS. Defaults to `fullScreen` on Android.\n * - `formSheet`: The modal is presented as a form sheet.\n * - `overFullScreen`: The modal is presented over the full screen, allowing interaction with the underlying content.\n *\n * @default 'fullScreen'\n */\n presentationStyle?: ModalConfig['presentationStyle'];\n /**\n * Whether the modal should be rendered as a transparent overlay.\n * This will render the modal without a background, allowing the content behind it to be visible.\n *\n * On Android, this will fallback to `overFullScreen` presentation style.\n */\n transparent?: boolean;\n /**\n * See {@link ScreenProps[\"sheetAllowedDetents\"]}.\n *\n * Describes heights where a sheet can rest.\n * Works only when `presentation` is set to `formSheet`.\n *\n * Heights should be described as fraction (a number from `[0, 1]` interval) of screen height / maximum detent height.\n * You can pass an array of ascending values each defining allowed sheet detent. iOS accepts any number of detents,\n * while **Android is limited to three**.\n *\n * @default 'fitToContents'\n */\n detents?: ModalConfig['detents'];\n /**\n * Determines whether the modal should close when navigating away from the screen that opened it.\n *\n * If set to `true`, the modal will close when the user navigates to a different screen.\n *\n * If set to `false`, the modal will remain open when pushing a new screen.\n * However, it will still close when navigating back or replacing the current screen.\n */\n closeOnNavigation?: boolean;\n}\n\n/**\n * A standalone modal component that can be used in Expo Router apps.\n * It always renders on top of the application's content.\n * Internally, the modal is rendered as a `Stack.Screen`, with the presentation style determined by the `presentationStyle` prop.\n *\n * **Props should be set before the modal is opened. Changes to the props will take effect after the modal is reopened.**\n *\n * This component is not linkable. If you need to link to a modal, use `<Stack.Screen options={{ presentationStyle: \"modal\" }} />` instead.\n *\n * @example\n * ```tsx\n * import { Modal } from 'expo-router';\n *\n * function Page() {\n * const [modalVisible, setModalVisible] = useState(false);\n * return (\n * <Modal\n * visible={modalVisible}\n * onClose={() => setModalVisible(false)}\n * >\n * <Text>Hello World</Text>\n * </Modal>\n * );\n * }\n */\nexport function Modal(props: ModalProps) {\n const {\n children,\n visible,\n onClose,\n onShow,\n animationType,\n presentationStyle,\n transparent,\n detents,\n closeOnNavigation,\n ...viewProps\n } = props;\n const { openModal, updateModal, closeModal, addEventListener } = useModalContext();\n const [currentModalId, setCurrentModalId] = useState<string | undefined>();\n const navigation = useNavigation<NavigationProp<ParamListBase>>();\n useEffect(() => {\n if (!areDetentsValid(detents)) {\n throw new Error(`Invalid detents provided to Modal: ${JSON.stringify(detents)}`);\n }\n }, [detents]);\n useEffect(() => {\n if (\n __DEV__ &&\n presentationStyle === 'formSheet' &&\n detents !== 'fitToContents' &&\n process.env.EXPO_OS === 'ios' &&\n StyleSheet.flatten(props.style)?.flex\n ) {\n console.warn(\n // TODO: ENG-16230: Add warning link to documentation\n 'The `formSheet` presentation style does not support flex styles on iOS. Consider using a fixed height view or scroll view with `fitToContents` detent instead. See '\n );\n }\n }, [props.style, presentationStyle, detents]);\n useEffect(() => {\n if (visible) {\n const newId = nanoid();\n openModal({\n animationType,\n presentationStyle,\n transparent,\n viewProps,\n component: children,\n uniqueId: newId,\n parentNavigationProp: navigation,\n detents: detents ?? 'fitToContents',\n });\n setCurrentModalId(newId);\n return () => {\n closeModal(newId);\n };\n }\n return () => {};\n }, [visible]);\n\n useEffect(() => {\n if (navigation.isFocused()) {\n return navigation.addListener('blur', () => {\n if (currentModalId && closeOnNavigation) {\n closeModal(currentModalId);\n }\n });\n }\n return () => {};\n }, [navigation, closeModal, currentModalId, closeOnNavigation]);\n\n useEffect(() => {\n if (currentModalId && visible) {\n updateModal(currentModalId, {\n component: children,\n });\n }\n }, [children]);\n\n useEffect(() => {\n if (currentModalId) {\n const unsubscribeShow = addEventListener('show', (id) => {\n if (id === currentModalId) {\n onShow?.();\n }\n });\n const unsubscribeClose = addEventListener('close', (id) => {\n if (id === currentModalId) {\n onClose?.();\n setCurrentModalId(undefined);\n }\n });\n return () => {\n unsubscribeShow();\n unsubscribeClose();\n };\n }\n return () => {};\n }, [currentModalId, addEventListener, onClose, onShow]);\n return null;\n}\n"]}
1
+ {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/modal/Modal.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAwGb,sBAgGC;AArMD,kDAA2C;AAC3C,iCAA4C;AAC5C,+CAAqD;AAGrD,iDAAmE;AACnE,oDAAiD;AACjD,mCAA0C;AAqE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,KAAK,CAAC,KAAiB;IACrC,MAAM,EACJ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,iBAAiB,EACjB,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,IAAA,8BAAe,GAAE,CAAC;IACnF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gB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CAAC;gBAClB,gBAAgB,EAAE,CAAC;YACrB,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,cAAc,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["'use client';\n\nimport { type NavigationProp, type ParamListBase } from '@react-navigation/native';\nimport { nanoid } from 'nanoid/non-secure';\nimport { useEffect, useState } from 'react';\nimport { StyleSheet, ViewProps } from 'react-native';\nimport { type ScreenProps } from 'react-native-screens';\n\nimport { useModalContext, type ModalConfig } from './ModalContext';\nimport { useNavigation } from '../useNavigation';\nimport { areDetentsValid } from './utils';\n\nexport interface ModalProps extends ViewProps {\n /**\n * The content of the modal.\n */\n children?: React.ReactNode;\n /**\n * Whether the modal is visible or not.\n * When set to `true`, the modal will be opened.\n * When set to `false`, the modal will be closed.\n */\n visible: boolean;\n /**\n * Callback that is called after modal is closed.\n * This is called when the modal is closed programmatically or when the user dismisses it.\n */\n onClose?: () => void;\n /**\n * Callback that is called after modal is shown.\n */\n onShow?: () => void;\n /**\n * The animation type for the modal.\n * This can be one of 'none', 'slide', or 'fade'.\n */\n animationType?: ModalConfig['animationType'];\n /**\n * The presentation style for the modal.\n * This can be one of 'fullScreen', 'pageSheet', 'formSheet', or 'overFullScreen'.\n * - `fullScreen`: The modal covers the entire screen. When `transparent` is set to `true`, it will fallback to `overFullScreen`.\n * - `pageSheet`: The modal is presented as a page sheet on iOS. Defaults to `fullScreen` on Android.\n * - `formSheet`: The modal is presented as a form sheet.\n * - `overFullScreen`: The modal is presented over the full screen, allowing interaction with the underlying content.\n *\n * @default 'fullScreen'\n */\n presentationStyle?: ModalConfig['presentationStyle'];\n /**\n * Whether the modal should be rendered as a transparent overlay.\n * This will render the modal without a background, allowing the content behind it to be visible.\n *\n * On Android, this will fallback to `overFullScreen` presentation style.\n */\n transparent?: boolean;\n /**\n * See {@link ScreenProps[\"sheetAllowedDetents\"]}.\n *\n * Describes heights where a sheet can rest.\n * Works only when `presentation` is set to `formSheet`.\n *\n * Heights should be described as fraction (a number from `[0, 1]` interval) of screen height / maximum detent height.\n * You can pass an array of ascending values each defining allowed sheet detent. iOS accepts any number of detents,\n * while **Android is limited to three**.\n *\n * @default 'fitToContents'\n */\n detents?: ModalConfig['detents'];\n /**\n * Determines whether the modal should close when navigating away from the screen that opened it.\n *\n * If set to `true`, the modal will close when the user navigates to a different screen.\n *\n * If set to `false`, the modal will remain open when pushing a new screen.\n * However, it will still close when navigating back or replacing the current screen.\n */\n closeOnNavigation?: boolean;\n}\n\n/**\n * A standalone modal component that can be used in Expo Router apps.\n * It always renders on top of the application's content.\n * Internally, the modal is rendered as a `Stack.Screen`, with the presentation style determined by the `presentationStyle` prop.\n *\n * **Props should be set before the modal is opened. Changes to the props will take effect after the modal is reopened.**\n *\n * This component is not linkable. If you need to link to a modal, use `<Stack.Screen options={{ presentationStyle: \"modal\" }} />` instead.\n *\n * @example\n * ```tsx\n * import { Modal } from 'expo-router';\n *\n * function Page() {\n * const [modalVisible, setModalVisible] = useState(false);\n * return (\n * <Modal\n * visible={modalVisible}\n * onClose={() => setModalVisible(false)}\n * >\n * <Text>Hello World</Text>\n * </Modal>\n * );\n * }\n */\nexport function Modal(props: ModalProps) {\n const {\n children,\n visible,\n onClose,\n onShow,\n animationType,\n presentationStyle,\n transparent,\n detents,\n closeOnNavigation,\n ...viewProps\n } = props;\n const { openModal, updateModal, closeModal, addEventListener } = useModalContext();\n const [currentModalId, setCurrentModalId] = useState<string | undefined>();\n const navigation = useNavigation<NavigationProp<ParamListBase>>();\n useEffect(() => {\n if (!areDetentsValid(detents)) {\n throw new Error(`Invalid detents provided to Modal: ${JSON.stringify(detents)}`);\n }\n }, [detents]);\n useEffect(() => {\n if (\n __DEV__ &&\n presentationStyle === 'formSheet' &&\n detents !== 'fitToContents' &&\n process.env.EXPO_OS === 'ios' &&\n StyleSheet.flatten(props.style)?.flex\n ) {\n console.warn(\n // TODO: ENG-16230: Add warning link to documentation\n 'The `formSheet` presentation style does not support flex styles on iOS. Consider using a fixed height view or scroll view with `fitToContents` detent instead. See '\n );\n }\n }, [props.style, presentationStyle, detents]);\n useEffect(() => {\n if (visible) {\n const newId = nanoid();\n openModal({\n animationType,\n presentationStyle,\n transparent,\n viewProps,\n component: children,\n uniqueId: newId,\n parentNavigationProp: navigation,\n detents: detents ?? (presentationStyle === 'formSheet' ? 'fitToContents' : undefined),\n });\n setCurrentModalId(newId);\n return () => {\n closeModal(newId);\n };\n }\n return () => {};\n }, [visible]);\n\n useEffect(() => {\n if (navigation.isFocused()) {\n return navigation.addListener('blur', () => {\n if (currentModalId && closeOnNavigation) {\n closeModal(currentModalId);\n }\n });\n }\n return () => {};\n }, [navigation, closeModal, currentModalId, closeOnNavigation]);\n\n useEffect(() => {\n if (currentModalId && visible) {\n updateModal(currentModalId, {\n component: children,\n });\n }\n }, [children]);\n\n useEffect(() => {\n if (currentModalId) {\n const unsubscribeShow = addEventListener('show', (id) => {\n if (id === currentModalId) {\n onShow?.();\n }\n });\n const unsubscribeClose = addEventListener('close', (id) => {\n if (id === currentModalId) {\n onClose?.();\n setCurrentModalId(undefined);\n }\n });\n return () => {\n unsubscribeShow();\n unsubscribeClose();\n };\n }\n return () => {};\n }, [currentModalId, addEventListener, onClose, onShow]);\n return null;\n}\n"]}
@@ -20,7 +20,7 @@ const ModalsRenderer = ({ children, modalConfigs, onDismissed, onShow, }) => {
20
20
  hidden: true,
21
21
  }} contentStyle={[
22
22
  {
23
- flex: 1,
23
+ flex: config.presentationStyle !== 'formSheet' ? 1 : undefined,
24
24
  backgroundColor: config.transparent ? 'transparent' : 'white',
25
25
  },
26
26
  config.viewProps?.style,
@@ -1 +1 @@
1
- {"version":3,"file":"ModalsRenderer.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,kDAA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OAAO;iBAC9D;gBACD,MAAM,CAAC,SAAS,EAAE,KAAK;aACxB,CAAC,CACF,mBAAmB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CACpC,KAAK,CAAC,CAAC;gBACL,yBAAU,CAAC,YAAY;gBACvB;oBACE,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO;iBAC9D;aACF,CAAC,CACF,WAAW,CAAC,CAAC,GAAG,EAAE;gBAChB,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACjC,CAAC,CAAC,CACF,QAAQ,CAAC,CAAC,GAAG,EAAE;gBACb,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC,CAAC,CACF;UAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;QAAA,EAAE,sCAAe,CAAC,CACnB,CAAC,CACJ;IAAA,EAAE,kCAAW,CAAC,CACf,CAAC;AACJ,CAAC,CAAC;AAxDW,QAAA,cAAc,kBAwDzB;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport { useRef } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { ScreenStack, ScreenStackItem } from 'react-native-screens';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n const rootId = useRef(nanoid());\n\n return (\n <ScreenStack style={styles.stackContainer}>\n <ScreenStackItem\n screenId={rootId.current}\n activityState={2}\n style={StyleSheet.absoluteFill}\n headerConfig={{\n hidden: true,\n }}>\n {children}\n </ScreenStackItem>\n {modalConfigs.map((config) => (\n <ScreenStackItem\n key={config.uniqueId}\n {...config.viewProps}\n screenId={`${rootId.current}${config.uniqueId}`}\n activityState={2}\n stackPresentation={getStackPresentationType(config)}\n stackAnimation={getStackAnimationType(config)}\n nativeBackButtonDismissalEnabled\n headerConfig={{\n hidden: true,\n }}\n contentStyle={[\n {\n flex: 1,\n backgroundColor: config.transparent ? 'transparent' : 'white',\n },\n config.viewProps?.style,\n ]}\n sheetAllowedDetents={config.detents}\n style={[\n StyleSheet.absoluteFill,\n {\n backgroundColor: config.transparent ? 'transparent' : 'white',\n },\n ]}\n onDismissed={() => {\n onDismissed?.(config.uniqueId);\n }}\n onAppear={() => {\n onShow?.(config.uniqueId);\n }}>\n <ModalComponent modalConfig={config} />\n </ScreenStackItem>\n ))}\n </ScreenStack>\n );\n};\n\nconst styles = StyleSheet.create({\n stackContainer: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"file":"ModalsRenderer.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,kDAA2C;AAC3C,iCAA+B;AAC/B,+CAA0C;AAC1C,+DAAoE;AAEpE,qDAAkD;AAElD,mCAA0E;AAEnE,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,MAAM,GACc,EAAE,EAAE;IACxB,MAAM,MAAM,GAAG,IAAA,cAAM,EAAC,IAAA,mBAAM,GAAE,CAAC,CAAC;IAEhC,OAAO,CACL,CAAC,kCAAW,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CACxC;MAAA,CAAC,sCAAe,CACd,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CACzB,aAAa,CAAC,CAAC,CAAC,CAAC,CACjB,KAAK,CAAC,CAAC,yBAAU,CAAC,YAAY,CAAC,CAC/B,YAAY,CAAC,CAAC;YACZ,MAAM,EAAE,IAAI;SACb,CAAC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C;YAC5B,CAAC,CAAC,CACF;UAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;QAAA,EAAE,sCAAe,CAAC,CACnB,CAAC,CACJ;IAAA,EAAE,kCAAW,CAAC,CACf,CAAC;AACJ,CAAC,CAAC;AAxDW,QAAA,cAAc,kBAwDzB;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport { useRef } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { ScreenStack, ScreenStackItem } from 'react-native-screens';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n const rootId = useRef(nanoid());\n\n return (\n <ScreenStack style={styles.stackContainer}>\n <ScreenStackItem\n screenId={rootId.current}\n activityState={2}\n style={StyleSheet.absoluteFill}\n headerConfig={{\n hidden: true,\n }}>\n {children}\n </ScreenStackItem>\n {modalConfigs.map((config) => (\n <ScreenStackItem\n key={config.uniqueId}\n {...config.viewProps}\n screenId={`${rootId.current}${config.uniqueId}`}\n activityState={2}\n stackPresentation={getStackPresentationType(config)}\n stackAnimation={getStackAnimationType(config)}\n nativeBackButtonDismissalEnabled\n headerConfig={{\n hidden: true,\n }}\n contentStyle={[\n {\n flex: config.presentationStyle !== 'formSheet' ? 1 : undefined,\n backgroundColor: config.transparent ? 'transparent' : 'white',\n },\n config.viewProps?.style,\n ]}\n sheetAllowedDetents={config.detents}\n style={[\n StyleSheet.absoluteFill,\n {\n backgroundColor: config.transparent ? 'transparent' : 'white',\n },\n ]}\n onDismissed={() => {\n onDismissed?.(config.uniqueId);\n }}\n onAppear={() => {\n onShow?.(config.uniqueId);\n }}>\n <ModalComponent modalConfig={config} />\n </ScreenStackItem>\n ))}\n </ScreenStack>\n );\n};\n\nconst styles = StyleSheet.create({\n stackContainer: {\n flex: 1,\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ModalStackRouteDrawer.web.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,iBAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,8BAA8B,CAAC;IACxC,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,qBAuMA;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"ModalStackRouteDrawer.web.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,iBAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,8BAA8B,CAAC;IACxC,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,qBAsMA;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -120,7 +120,6 @@ function ModalStackRouteDrawer({ routeKey, options, renderScreen, onDismiss, the
120
120
  else {
121
121
  // All corners for desktop modal
122
122
  if (options.sheetCornerRadius) {
123
- modalStyleVars.borderRadius = radiusCss;
124
123
  modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;
125
124
  }
126
125
  }