expo-router 5.2.0-canary-20250729-d8899ae → 6.0.0-beta.0

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 (215) 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/Stack.web.d.ts +1 -1
  61. package/build/layouts/Stack.web.d.ts.map +1 -1
  62. package/build/layouts/Stack.web.js +3 -3
  63. package/build/layouts/Stack.web.js.map +1 -1
  64. package/build/layouts/StackClient.d.ts +2 -2
  65. package/build/layouts/StackClient.d.ts.map +1 -1
  66. package/build/layouts/StackClient.js +18 -14
  67. package/build/layouts/StackClient.js.map +1 -1
  68. package/build/layouts/TabsClient.d.ts +3 -3
  69. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  70. package/build/layouts/withLayoutContext.js +13 -0
  71. package/build/layouts/withLayoutContext.js.map +1 -1
  72. package/build/link/ExpoLink.d.ts.map +1 -1
  73. package/build/link/ExpoLink.js +3 -2
  74. package/build/link/ExpoLink.js.map +1 -1
  75. package/build/link/InternalLinkPreviewContext.d.ts +6 -0
  76. package/build/link/InternalLinkPreviewContext.d.ts.map +1 -0
  77. package/build/link/InternalLinkPreviewContext.js +6 -0
  78. package/build/link/InternalLinkPreviewContext.js.map +1 -0
  79. package/build/link/Link.d.ts +2 -67
  80. package/build/link/Link.d.ts.map +1 -1
  81. package/build/link/Link.js +5 -70
  82. package/build/link/Link.js.map +1 -1
  83. package/build/link/LinkWithPreview.d.ts +1 -46
  84. package/build/link/LinkWithPreview.d.ts.map +1 -1
  85. package/build/link/LinkWithPreview.js +30 -114
  86. package/build/link/LinkWithPreview.js.map +1 -1
  87. package/build/link/elements.d.ts +174 -0
  88. package/build/link/elements.d.ts.map +1 -0
  89. package/build/link/elements.js +172 -0
  90. package/build/link/elements.js.map +1 -0
  91. package/build/link/preview/HrefPreview.d.ts +1 -1
  92. package/build/link/preview/HrefPreview.d.ts.map +1 -1
  93. package/build/link/preview/HrefPreview.js +61 -7
  94. package/build/link/preview/HrefPreview.js.map +1 -1
  95. package/build/link/preview/LinkPreviewContext.d.ts +3 -2
  96. package/build/link/preview/LinkPreviewContext.d.ts.map +1 -1
  97. package/build/link/preview/LinkPreviewContext.js +3 -2
  98. package/build/link/preview/LinkPreviewContext.js.map +1 -1
  99. package/build/link/preview/native.d.ts +14 -6
  100. package/build/link/preview/native.d.ts.map +1 -1
  101. package/build/link/preview/native.js.map +1 -1
  102. package/build/link/preview/useNextScreenId.d.ts +8 -1
  103. package/build/link/preview/useNextScreenId.d.ts.map +1 -1
  104. package/build/link/preview/useNextScreenId.js +36 -32
  105. package/build/link/preview/useNextScreenId.js.map +1 -1
  106. package/build/link/preview/utils.d.ts +12 -0
  107. package/build/link/preview/utils.d.ts.map +1 -0
  108. package/build/link/preview/utils.js +66 -0
  109. package/build/link/preview/utils.js.map +1 -0
  110. package/build/modal/Modal.js +1 -1
  111. package/build/modal/Modal.js.map +1 -1
  112. package/build/modal/ModalsRenderer.js +1 -1
  113. package/build/modal/ModalsRenderer.js.map +1 -1
  114. package/build/modal/ModalsRenderer.web.js +4 -4
  115. package/build/modal/ModalsRenderer.web.js.map +1 -1
  116. package/build/modal/web/{ModalStack.web.d.ts → ModalStack.d.ts} +1 -1
  117. package/build/modal/web/ModalStack.d.ts.map +1 -0
  118. package/build/modal/web/{ModalStack.web.js → ModalStack.js} +5 -5
  119. package/build/modal/web/ModalStack.js.map +1 -0
  120. package/build/modal/web/{ModalStackRouteDrawer.web.d.ts → ModalStackRouteDrawer.d.ts} +1 -1
  121. package/build/modal/web/ModalStackRouteDrawer.d.ts.map +1 -0
  122. package/build/modal/web/{ModalStackRouteDrawer.web.js → ModalStackRouteDrawer.js} +1 -2
  123. package/build/modal/web/ModalStackRouteDrawer.js.map +1 -0
  124. package/build/modal/web/{TransparentModalStackRouteDrawer.web.d.ts → TransparentModalStackRouteDrawer.d.ts} +1 -1
  125. package/build/modal/web/TransparentModalStackRouteDrawer.d.ts.map +1 -0
  126. package/build/modal/web/{TransparentModalStackRouteDrawer.web.js → TransparentModalStackRouteDrawer.js} +1 -1
  127. package/build/modal/web/TransparentModalStackRouteDrawer.js.map +1 -0
  128. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +17 -0
  129. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -0
  130. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +27 -0
  131. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -0
  132. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts +3 -0
  133. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -0
  134. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +65 -0
  135. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -0
  136. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts +47 -0
  137. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -0
  138. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +153 -0
  139. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -0
  140. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +24 -0
  141. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -0
  142. package/build/native-tabs/NativeBottomTabs/NativeTabs.js +27 -0
  143. package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +1 -0
  144. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +4 -0
  145. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -0
  146. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +116 -0
  147. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -0
  148. package/build/native-tabs/NativeBottomTabs/types.d.ts +166 -0
  149. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -0
  150. package/build/native-tabs/NativeBottomTabs/types.js +3 -0
  151. package/build/native-tabs/NativeBottomTabs/types.js.map +1 -0
  152. package/build/native-tabs/NativeBottomTabs/utils.d.ts +7 -0
  153. package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +1 -0
  154. package/build/native-tabs/NativeBottomTabs/utils.js +21 -0
  155. package/build/native-tabs/NativeBottomTabs/utils.js.map +1 -0
  156. package/build/native-tabs/common/elements.d.ts +74 -0
  157. package/build/native-tabs/common/elements.d.ts.map +1 -0
  158. package/build/native-tabs/common/elements.js +21 -0
  159. package/build/native-tabs/common/elements.js.map +1 -0
  160. package/build/native-tabs/index.d.ts +5 -0
  161. package/build/native-tabs/index.d.ts.map +1 -0
  162. package/build/native-tabs/index.js +23 -0
  163. package/build/native-tabs/index.js.map +1 -0
  164. package/build/routes-manifest.d.ts +42 -0
  165. package/build/routes-manifest.d.ts.map +1 -1
  166. package/build/routes-manifest.js.map +1 -1
  167. package/build/rsc/middleware.d.ts +1 -1
  168. package/build/rsc/middleware.d.ts.map +1 -1
  169. package/build/rsc/middleware.js.map +1 -1
  170. package/build/testing-library/mock-config.d.ts +18 -0
  171. package/build/testing-library/mock-config.d.ts.map +1 -1
  172. package/build/testing-library/mock-config.js +4 -1
  173. package/build/testing-library/mock-config.js.map +1 -1
  174. package/build/ui/common.d.ts.map +1 -1
  175. package/build/ui/common.js +7 -6
  176. package/build/ui/common.js.map +1 -1
  177. package/build/useNavigation.d.ts.map +1 -1
  178. package/build/useNavigation.js +8 -5
  179. package/build/useNavigation.js.map +1 -1
  180. package/build/views/NoSSR.d.ts +5 -0
  181. package/build/views/NoSSR.d.ts.map +1 -0
  182. package/build/views/NoSSR.js +22 -0
  183. package/build/views/NoSSR.js.map +1 -0
  184. package/build/views/Screen.d.ts.map +1 -1
  185. package/build/views/Screen.js +4 -1
  186. package/build/views/Screen.js.map +1 -1
  187. package/build/views/Sitemap.d.ts.map +1 -1
  188. package/build/views/Sitemap.js +113 -10
  189. package/build/views/Sitemap.js.map +1 -1
  190. package/build/views/Unmatched.d.ts.map +1 -1
  191. package/build/views/Unmatched.js +14 -4
  192. package/build/views/Unmatched.js.map +1 -1
  193. package/ios/ExpoHead.podspec +10 -1
  194. package/ios/LinkPreview/LinkPreviewNativeActionView.swift +159 -21
  195. package/ios/LinkPreview/LinkPreviewNativeModule.swift +44 -6
  196. package/ios/LinkPreview/LinkPreviewNativeNavigation.h +37 -11
  197. package/ios/LinkPreview/LinkPreviewNativeNavigation.mm +110 -87
  198. package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +136 -0
  199. package/ios/LinkPreview/LinkPreviewNativePreviewView.swift +0 -1
  200. package/ios/LinkPreview/LinkPreviewNativeTriggerView.swift +1 -1
  201. package/ios/LinkPreview/LinkPreviewNativeView.swift +72 -71
  202. package/package.json +42 -10
  203. package/plugin/build/index.d.ts +2 -0
  204. package/plugin/options.json +5 -0
  205. package/plugin/src/index.ts +2 -0
  206. package/plugin/tsconfig.tsbuildinfo +1 -0
  207. package/server.d.ts +2 -1
  208. package/unstable-native-tabs.d.ts +1 -0
  209. package/unstable-native-tabs.js +1 -0
  210. package/build/modal/web/ModalStack.web.d.ts.map +0 -1
  211. package/build/modal/web/ModalStack.web.js.map +0 -1
  212. package/build/modal/web/ModalStackRouteDrawer.web.d.ts.map +0 -1
  213. package/build/modal/web/ModalStackRouteDrawer.web.js.map +0 -1
  214. package/build/modal/web/TransparentModalStackRouteDrawer.web.d.ts.map +0 -1
  215. package/build/modal/web/TransparentModalStackRouteDrawer.web.js.map +0 -1
@@ -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,4BAAkB,EAAC,SAAS,EAAE,KAAwB,EAAE,IAAI,CAAC,CAAC;IAE3F,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAc,EAAE,CAAC;IAC9B,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QACzC,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;Y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K,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC,IAAI,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAC3F,CAAC;QACF,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,SAAS,CACvB,CAAqC,EACrC,CAAqC;IAErC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,2CAA2C,CAAC,CAAC;IACjG,OAAO,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,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,uBAAe,EAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IACE,OAAO;YACP,iBAAiB,KAAK,WAAW;YACjC,OAAO,KAAK,eAAe;YAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK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IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;YAC9B,WAAW,CAAC,cAAc,EAAE;gBAC1B,SAAS,EAAE,QAAQ;aACpB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE;gBACtD,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;oBAC1B,MAAM,EAAE,EAAE,CAAC;gBACb,CAAC;YACH,CAAC,CAAC,CAAC;YACH,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;gBACxD,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;oBAC1B,OAAO,EAAE,EAAE,CAAC;oBACZ,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,EAAE;gBACV,eAAe,EAAE,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 ?? '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,gBAAQ,GAAsB,CAAC;IAC3E,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAiC,CAAC;IAClE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAA,uBAAe,EAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,IAA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AAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEhE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;YAC9B,WAAW,CAAC,cAAc,EAAE;gBAC1B,SAAS,EAAE,QAAQ;aACpB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE;gBACtD,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;oBAC1B,MAAM,EAAE,EAAE,CAAC;gBACb,CAAC;YACH,CAAC,CAAC,CAAC;YACH,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;gBACxD,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;oBAC1B,OAAO,EAAE,EAAE,CAAC;oBACZ,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,EAAE;gBACV,eAAe,EAAE,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,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,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C,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,CACF;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,sCAAe,CACjB;MAAA,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,CAAC,sCAAe,CACd,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CACrB,IAAI,MAAM,CAAC,SAAS,CAAC,CACrB,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,CAChD,aAAa,CAAC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cesContent":["'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"]}
@@ -6,8 +6,8 @@ const native_1 = require("@react-navigation/native");
6
6
  const react_native_1 = require("react-native");
7
7
  const ModalComponent_1 = require("./ModalComponent");
8
8
  const utils_1 = require("./utils");
9
- const ModalStackRouteDrawer_web_1 = require("./web/ModalStackRouteDrawer.web");
10
- const TransparentModalStackRouteDrawer_web_1 = require("./web/TransparentModalStackRouteDrawer.web");
9
+ const ModalStackRouteDrawer_1 = require("./web/ModalStackRouteDrawer");
10
+ const TransparentModalStackRouteDrawer_1 = require("./web/TransparentModalStackRouteDrawer");
11
11
  const utils_2 = require("./web/utils");
12
12
  const ModalsRenderer = ({ children, modalConfigs, onDismissed, onShow, }) => {
13
13
  return (<div style={{ flex: 1, display: 'flex' }}>
@@ -21,8 +21,8 @@ function Modal({ config, onDismissed }) {
21
21
  const presentation = (0, utils_1.getStackPresentationType)(config);
22
22
  const isTransparentModal = (0, utils_2.isTransparentModalPresentation)({ presentation });
23
23
  const SelectedModalComponent = isTransparentModal
24
- ? TransparentModalStackRouteDrawer_web_1.TransparentModalStackRouteDrawer
25
- : ModalStackRouteDrawer_web_1.ModalStackRouteDrawer;
24
+ ? TransparentModalStackRouteDrawer_1.TransparentModalStackRouteDrawer
25
+ : ModalStackRouteDrawer_1.ModalStackRouteDrawer;
26
26
  return (<SelectedModalComponent routeKey={config.uniqueId} onDismiss={onDismissed} themeColors={colors} key={config.uniqueId} options={{
27
27
  presentation,
28
28
  animation: (0, utils_1.getStackAnimationType)(config),
@@ -1 +1 @@
1
- {"version":3,"file":"ModalsRenderer.web.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.web.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,qDAAoD;AACpD,+CAAoC;AAEpC,qDAAkD;AAElD,mCAA0E;AAC1E,+EAAwE;AACxE,qGAA8F;AAC9F,uCAA6D;AAEtD,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,MAAM,GACc,EAAE,EAAE;IACxB,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CACvC;MAAA,CAAC,QAAQ,CACT;MAAA,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,C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AC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACxE;YAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;UAAA,EAAE,mBAAI,CACR;QAAA,EAAE,mBAAI,CAAC,CACR,CAAC,EACF,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useTheme } from '@react-navigation/native';\nimport { View } from 'react-native';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalConfig, ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\nimport { ModalStackRouteDrawer } from './web/ModalStackRouteDrawer.web';\nimport { TransparentModalStackRouteDrawer } from './web/TransparentModalStackRouteDrawer.web';\nimport { isTransparentModalPresentation } from './web/utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n {children}\n {modalConfigs.map((config) => (\n <Modal\n key={config.uniqueId}\n config={config}\n onDismissed={() => onDismissed?.(config.uniqueId)}\n />\n ))}\n </div>\n );\n};\n\ninterface ModalProps {\n config: ModalConfig;\n onDismissed: () => void;\n}\n\nfunction Modal({ config, onDismissed }: ModalProps) {\n const { colors } = useTheme();\n\n const presentation = getStackPresentationType(config);\n const isTransparentModal = isTransparentModalPresentation({ presentation });\n\n const SelectedModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <SelectedModalComponent\n routeKey={config.uniqueId}\n onDismiss={onDismissed}\n themeColors={colors}\n key={config.uniqueId}\n options={{\n presentation,\n animation: getStackAnimationType(config),\n headerShown: false,\n sheetAllowedDetents: config.detents,\n }}\n renderScreen={() => (\n <View style={{ flex: 1 }}>\n <View {...config.viewProps} style={[{ flex: 1 }, config.viewProps?.style]}>\n <ModalComponent modalConfig={config} />\n </View>\n </View>\n )}\n />\n );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AC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAC1B,SAAS,CAAC,CAAC,WAAW,CAAC,CACvB,WAAW,CAAC,CAAC,MAAM,CAAC,CACpB,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CACrB,OAAO,CAAC,CAAC;YACP,YAAY;YACZ,SAAS,EAAE,IAAA,6BAAqB,EAAC,MAAM,CAAC;YACxC,WAAW,EAAE,KAAK;YAClB,mBAAmB,EAAE,MAAM,CAAC,OAAO;SACpC,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,CAClB,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACvB;UAAA,CAAC,mBAAI,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACxE;YAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;UAAA,EAAE,mBAAI,CACR;QAAA,EAAE,mBAAI,CAAC,CACR,CAAC,EACF,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useTheme } from '@react-navigation/native';\nimport { View } from 'react-native';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalConfig, ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\nimport { ModalStackRouteDrawer } from './web/ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './web/TransparentModalStackRouteDrawer';\nimport { isTransparentModalPresentation } from './web/utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n {children}\n {modalConfigs.map((config) => (\n <Modal\n key={config.uniqueId}\n config={config}\n onDismissed={() => onDismissed?.(config.uniqueId)}\n />\n ))}\n </div>\n );\n};\n\ninterface ModalProps {\n config: ModalConfig;\n onDismissed: () => void;\n}\n\nfunction Modal({ config, onDismissed }: ModalProps) {\n const { colors } = useTheme();\n\n const presentation = getStackPresentationType(config);\n const isTransparentModal = isTransparentModalPresentation({ presentation });\n\n const SelectedModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <SelectedModalComponent\n routeKey={config.uniqueId}\n onDismiss={onDismissed}\n themeColors={colors}\n key={config.uniqueId}\n options={{\n presentation,\n animation: getStackAnimationType(config),\n headerShown: false,\n sheetAllowedDetents: config.detents,\n }}\n renderScreen={() => (\n <View style={{ flex: 1 }}>\n <View {...config.viewProps} style={[{ flex: 1 }, config.viewProps?.style]}>\n <ModalComponent modalConfig={config} />\n </View>\n </View>\n )}\n />\n );\n}\n"]}
@@ -22,4 +22,4 @@ declare const RouterModalScreen: (props: import("../..").ScreenProps<object, Rea
22
22
  stale: false;
23
23
  }>, import("@react-navigation/native").EventMapBase>) => null;
24
24
  export { RouterModal, RouterModalScreen };
25
- //# sourceMappingURL=ModalStack.web.d.ts.map
25
+ //# sourceMappingURL=ModalStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStack.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EAOd,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAsB,MAAM,OAAO,CAAC;AAgG3C,QAAA,MAAM,WAAW;;;;;;;;;;;CAAkD,CAAC;AACpE,QAAA,MAAM,iBAAiB;;;;;;;;6DAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
@@ -38,8 +38,8 @@ exports.RouterModalScreen = exports.RouterModal = void 0;
38
38
  const native_1 = require("@react-navigation/native");
39
39
  const native_stack_1 = require("@react-navigation/native-stack");
40
40
  const react_1 = __importStar(require("react"));
41
- const ModalStackRouteDrawer_web_1 = require("./ModalStackRouteDrawer.web");
42
- const TransparentModalStackRouteDrawer_web_1 = require("./TransparentModalStackRouteDrawer.web");
41
+ const ModalStackRouteDrawer_1 = require("./ModalStackRouteDrawer");
42
+ const TransparentModalStackRouteDrawer_1 = require("./TransparentModalStackRouteDrawer");
43
43
  const utils_1 = require("./utils");
44
44
  const withLayoutContext_1 = require("../../layouts/withLayoutContext");
45
45
  function ModalStackNavigator({ initialRouteName, children, screenOptions, }) {
@@ -72,8 +72,8 @@ const ModalStackView = ({ state, navigation, descriptors, describe }) => {
72
72
  overlayRoutes.map((route) => {
73
73
  const isTransparentModal = (0, utils_1.isTransparentModalPresentation)(descriptors[route.key].options);
74
74
  const ModalComponent = isTransparentModal
75
- ? TransparentModalStackRouteDrawer_web_1.TransparentModalStackRouteDrawer
76
- : ModalStackRouteDrawer_web_1.ModalStackRouteDrawer;
75
+ ? TransparentModalStackRouteDrawer_1.TransparentModalStackRouteDrawer
76
+ : ModalStackRouteDrawer_1.ModalStackRouteDrawer;
77
77
  return (<ModalComponent key={route.key} routeKey={route.key} options={descriptors[route.key].options} renderScreen={descriptors[route.key].render} onDismiss={dismiss} themeColors={colors}/>);
78
78
  })}
79
79
  </div>);
@@ -83,4 +83,4 @@ const RouterModal = (0, withLayoutContext_1.withLayoutContext)(createModalStack(
83
83
  exports.RouterModal = RouterModal;
84
84
  const RouterModalScreen = RouterModal.Screen;
85
85
  exports.RouterModalScreen = RouterModalScreen;
86
- //# sourceMappingURL=ModalStack.web.js.map
86
+ //# sourceMappingURL=ModalStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStack.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,qDASkC;AAClC,iEAIwC;AACxC,+CAA2C;AAE3C,mEAAgE;AAChE,yFAAsF;AAEtF,mCAIiB;AAEjB,uEAAo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AAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AACrE,MAAM,WAAW,GAAG,IAAA,qCAAiB,EAAC,gBAAgB,EAAE,CAAC,SAAS,CAAC,CAAC;AAG3D,kCAAW;AAFpB,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAC;AAEvB,8CAAiB","sourcesContent":["'use client';\nimport {\n createNavigatorFactory,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouter,\n StackRouterOptions,\n useNavigationBuilder,\n useTheme,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n NativeStackView,\n} from '@react-navigation/native-stack';\nimport React, { useCallback } from 'react';\n\nimport { ModalStackRouteDrawer } from './ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './TransparentModalStackRouteDrawer';\nimport { ModalStackNavigatorProps, ModalStackViewProps } from './types';\nimport {\n convertStackStateToNonModalState,\n findLastNonModalIndex,\n isTransparentModalPresentation,\n} from './utils';\nimport { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\nimport { withLayoutContext } from '../../layouts/withLayoutContext';\n\nfunction ModalStackNavigator({\n initialRouteName,\n children,\n screenOptions,\n}: ModalStackNavigatorProps) {\n const { state, navigation, descriptors, NavigationContent, describe } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n children,\n screenOptions,\n initialRouteName,\n });\n\n return (\n <NavigationContent>\n <ModalStackView\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\nconst ModalStackView = ({ state, navigation, descriptors, describe }: ModalStackViewProps) => {\n const isWeb = process.env.EXPO_OS === 'web';\n const { colors } = useTheme();\n\n const { routes: filteredRoutes, index: nonModalIndex } = convertStackStateToNonModalState(\n state,\n descriptors,\n isWeb\n );\n\n const newStackState = { ...state, routes: filteredRoutes, index: nonModalIndex };\n\n const dismiss = useCallback(() => {\n navigation.goBack();\n }, [navigation]);\n\n const overlayRoutes = React.useMemo(() => {\n if (!isWeb) return [];\n const idx = findLastNonModalIndex(state, descriptors);\n return state.routes.slice(idx + 1);\n }, [isWeb, state, descriptors]);\n\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n <NativeStackView\n state={newStackState}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n {isWeb &&\n overlayRoutes.map((route) => {\n const isTransparentModal = isTransparentModalPresentation(descriptors[route.key].options);\n\n const ModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <ModalComponent\n key={route.key}\n routeKey={route.key}\n options={descriptors[route.key].options as ExtendedStackNavigationOptions}\n renderScreen={descriptors[route.key].render}\n onDismiss={dismiss}\n themeColors={colors}\n />\n );\n })}\n </div>\n );\n};\n\nconst createModalStack = createNavigatorFactory(ModalStackNavigator);\nconst RouterModal = withLayoutContext(createModalStack().Navigator);\nconst RouterModalScreen = RouterModal.Screen;\n\nexport { RouterModal, RouterModalScreen };\n"]}
@@ -11,4 +11,4 @@ declare function ModalStackRouteDrawer({ routeKey, options, renderScreen, onDism
11
11
  };
12
12
  }): React.JSX.Element;
13
13
  export { ModalStackRouteDrawer };
14
- //# sourceMappingURL=ModalStackRouteDrawer.web.d.ts.map
14
+ //# sourceMappingURL=ModalStackRouteDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStackRouteDrawer.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.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
  }
@@ -161,4 +160,4 @@ function ModalStackRouteDrawer({ routeKey, options, renderScreen, onDismiss, the
161
160
  </vaul_1.Drawer.Portal>
162
161
  </vaul_1.Drawer.Root>);
163
162
  }
164
- //# sourceMappingURL=ModalStackRouteDrawer.web.js.map
163
+ //# sourceMappingURL=ModalStackRouteDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStackRouteDrawer.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AA6NJ,sDAAqB;AA5N9B,kDAA0B;AAC1B,+BAA8B;AAE9B,gEAAwC;AAExC,mCAAuC;AAGvC,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GAOZ;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,4EAA4E;IAC5E,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,SAAS,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,OAAO,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YAAA,CAAC,+BAA+B,CAChC;YAAA,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,CAC9D;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,aAAM,CAAC,OAAO,CAClB;MAAA,EAAE,aAAM,CAAC,MAAM,CACjB;IAAA,EAAE,aAAM,CAAC,IAAI,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\nimport { Drawer } from 'vaul';\n\nimport modalStyles from './modalStyles';\nimport { CSSWithVars } from './types';\nimport { useIsDesktop } from './utils';\nimport { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\n\nfunction ModalStackRouteDrawer({\n routeKey,\n options,\n renderScreen,\n onDismiss,\n themeColors,\n}: {\n routeKey: string;\n options: ExtendedStackNavigationOptions;\n renderScreen: () => React.ReactNode;\n onDismiss: () => void;\n themeColors: { card: string; background: string };\n}) {\n const [open, setOpen] = React.useState(true);\n // Determine sheet vs. modal with an SSR-safe hook. The first render (during\n // hydration) always assumes mobile/sheet to match the server markup; an\n // effect then updates the state after mount if the viewport is desktop.\n const isDesktop = useIsDesktop();\n const isSheet = !isDesktop;\n\n // Resolve snap points logic.\n const allowed = options.sheetAllowedDetents;\n\n const isArrayDetents = Array.isArray(allowed);\n const useCustomSnapPoints = isArrayDetents && !(allowed.length === 1 && allowed[0] === 1);\n\n let snapPoints: (number | string)[] | undefined = useCustomSnapPoints\n ? (allowed as (number | string)[])\n : undefined;\n\n if (!isSheet) {\n snapPoints = [1];\n }\n\n const [snap, setSnap] = React.useState<number | string | null>(\n useCustomSnapPoints && isArrayDetents ? allowed[0] : 1\n );\n\n // Update the snap value when custom snap points change.\n React.useEffect(() => {\n if (isSheet) {\n const next = useCustomSnapPoints && isArrayDetents ? allowed[0] : 1;\n setSnap(next);\n } else {\n // Desktop modal always fixed snap at 1\n setSnap(1);\n }\n }, [isSheet, useCustomSnapPoints, isArrayDetents, allowed]);\n\n // Map react-native-screens ios sheet undimmed logic to Vaul's fadeFromIndex\n const fadeFromIndex = isSheet\n ? options.sheetLargestUndimmedDetentIndex === 'last'\n ? (snapPoints?.length ?? 0)\n : typeof options.sheetLargestUndimmedDetentIndex === 'number'\n ? options.sheetLargestUndimmedDetentIndex + 1\n : 0\n : 0;\n\n // --- Styling -----------------------------------------------------------\n\n // Using CSS variables so defaults live in CSS and can be overridden via props.\n const modalStyleVars: CSSWithVars = {\n backgroundColor: themeColors.background,\n };\n\n if (!isSheet) {\n if (options.webModalStyle?.width) {\n modalStyleVars['--expo-router-modal-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n modalStyleVars['--expo-router-modal-max-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n // Also set explicit width so browsers that ignore CSS vars in `width` prop still work.\n modalStyleVars.width =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n }\n\n // Min width override\n if (options.webModalStyle?.minWidth) {\n const mw =\n typeof options.webModalStyle.minWidth === 'number'\n ? `${options.webModalStyle.minWidth}px`\n : options.webModalStyle.minWidth;\n modalStyleVars['--expo-router-modal-min-width'] = mw;\n modalStyleVars.minWidth = mw;\n }\n\n if (options.webModalStyle?.height) {\n const h =\n typeof options.webModalStyle.height === 'number'\n ? `${options.webModalStyle.height}px`\n : options.webModalStyle.height;\n modalStyleVars['--expo-router-modal-height'] = h;\n modalStyleVars.maxHeight = h;\n modalStyleVars.height = h;\n modalStyleVars.minHeight = h;\n }\n\n // Separate min-height override (takes precedence over modalHeight)\n if (options.webModalStyle?.minHeight) {\n const mh =\n typeof options.webModalStyle.minHeight === 'number'\n ? `${options.webModalStyle.minHeight}px`\n : options.webModalStyle.minHeight;\n modalStyleVars['--expo-router-modal-min-height'] = mh;\n modalStyleVars.minHeight = mh;\n }\n }\n\n const fitToContents = options.sheetAllowedDetents === 'fitToContents';\n\n if (fitToContents) {\n modalStyleVars.height = 'auto';\n modalStyleVars.minHeight = 'auto';\n\n // TODO:(@Hirbod) Clarify if we should limit maxHeight to sheets only\n // Allow sheet to grow with content but never exceed viewport height\n // dvh is important, otherwise it will scale over the visible viewport height\n modalStyleVars.maxHeight = '100dvh';\n }\n\n // Apply corner radius (default 10px)\n const radiusValue = options.sheetCornerRadius ?? 10;\n const radiusCss = typeof radiusValue === 'number' ? `${radiusValue}px` : radiusValue;\n\n if (options.webModalStyle?.border) {\n modalStyleVars['--expo-router-modal-border'] = options.webModalStyle.border;\n }\n\n if (isSheet) {\n // Only top corners for mobile sheet\n modalStyleVars.borderTopLeftRadius = radiusCss;\n modalStyleVars.borderTopRightRadius = radiusCss;\n\n // Only apply CSS var override if a custom corner radius was provided\n if (options.sheetCornerRadius) {\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n }\n } else {\n // All corners for desktop modal\n if (options.sheetCornerRadius) {\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n }\n }\n // --- End Styling -----------------------------------------------------------\n\n const handleOpenChange = (open: boolean) => {\n if (!open) onDismiss();\n };\n\n // Props that only make sense for sheets\n const sheetProps = isSheet\n ? {\n snapPoints: snapPoints as (number | string)[],\n activeSnapPoint: snap,\n setActiveSnapPoint: setSnap,\n fadeFromIndex,\n }\n : {};\n\n return (\n <Drawer.Root\n key={`${routeKey}-${isSheet ? 'sheet' : 'modal'}`}\n open={open}\n dismissible={options.gestureEnabled ?? true}\n onAnimationEnd={handleOpenChange}\n shouldScaleBackground\n autoFocus\n onOpenChange={setOpen}\n {...sheetProps}>\n <Drawer.Portal>\n <Drawer.Overlay\n className={modalStyles.overlay}\n style={\n options.webModalStyle?.overlayBackground\n ? ({\n '--expo-router-modal-overlay-background': options.webModalStyle.overlayBackground,\n } as React.CSSProperties)\n : undefined\n }\n />\n <Drawer.Content\n aria-describedby=\"modal-description\"\n className={modalStyles.drawerContent}\n style={{\n pointerEvents: 'none',\n // This needs to be limited to sheets, otherwise it will position the modal at the bottom of the screen\n ...(isSheet && fitToContents ? { height: 'auto' } : null),\n }}>\n <div\n className={modalStyles.modal}\n data-presentation={isSheet ? 'formSheet' : 'modal'}\n style={modalStyleVars}>\n {/* TODO:(@Hirbod) Figure out how to add title and description to the modal for screen readers in a meaningful way */}\n <Drawer.Title about=\"\" aria-describedby=\"\" className={modalStyles.srOnly} />\n <Drawer.Description about=\"\" className={modalStyles.srOnly} />\n {/* Render the screen content */}\n <div className={modalStyles.modalBody}>{renderScreen()}</div>\n </div>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n );\n}\n\nexport { ModalStackRouteDrawer };\n"]}
@@ -7,4 +7,4 @@ declare function TransparentModalStackRouteDrawer({ routeKey, options, renderScr
7
7
  onDismiss: () => void;
8
8
  }): React.JSX.Element;
9
9
  export { TransparentModalStackRouteDrawer };
10
- //# sourceMappingURL=TransparentModalStackRouteDrawer.web.d.ts.map
10
+ //# sourceMappingURL=TransparentModalStackRouteDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransparentModalStackRouteDrawer.d.ts","sourceRoot":"","sources":["../../../src/modal/web/TransparentModalStackRouteDrawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,iBAAS,gCAAgC,CAAC,EACxC,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,GACV,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;CACvB,qBAuBA;AAED,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
@@ -25,4 +25,4 @@ function TransparentModalStackRouteDrawer({ routeKey, options, renderScreen, onD
25
25
  </vaul_1.Drawer.Portal>
26
26
  </vaul_1.Drawer.Root>);
27
27
  }
28
- //# sourceMappingURL=TransparentModalStackRouteDrawer.web.js.map
28
+ //# sourceMappingURL=TransparentModalStackRouteDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransparentModalStackRouteDrawer.js","sourceRoot":"","sources":["../../../src/modal/web/TransparentModalStackRouteDrawer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AA0CJ,4EAAgC;AAzCzC,kDAA0B;AAC1B,+BAA8B;AAE9B,gEAAwC;AAGxC,SAAS,gCAAgC,CAAC,EACxC,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,GAMV;IACC,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAE,EAAE;QACzC,IAAI,CAAC,IAAI;YAAE,SAAS,EAAE,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,aAAM,CAAC,IAAI,CACV,WAAW,CACX,SAAS,CACT,GAAG,CAAC,CAAC,GAAG,QAAQ,cAAc,CAAC,CAC/B,WAAW,CAAC,CAAC,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC,CAC7C,cAAc,CAAC,CAAC,gBAAgB,CAAC,CACjC;MAAA,CAAC,aAAM,CAAC,MAAM,CACZ;QAAA,CAAC,aAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,wBAAwB,CAAC,CAC9D;UAAA,CAAC,oHAAoH,CACrH;UAAA,CAAC,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,MAAM,CAAC,EACzE;UAAA,CAAC,aAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,MAAM,CAAC,EAC3D;UAAA,CAAC,+BAA+B,CAChC;UAAA,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,CAC9D;QAAA,EAAE,aAAM,CAAC,OAAO,CAClB;MAAA,EAAE,aAAM,CAAC,MAAM,CACjB;IAAA,EAAE,aAAM,CAAC,IAAI,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\nimport { Drawer } from 'vaul';\n\nimport modalStyles from './modalStyles';\nimport { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\n\nfunction TransparentModalStackRouteDrawer({\n routeKey,\n options,\n renderScreen,\n onDismiss,\n}: {\n routeKey: string;\n options: ExtendedStackNavigationOptions;\n renderScreen: () => React.ReactNode;\n onDismiss: () => void;\n}) {\n const handleOpenChange = (open: boolean) => {\n if (!open) onDismiss();\n };\n\n return (\n <Drawer.Root\n defaultOpen\n autoFocus\n key={`${routeKey}-transparent`}\n dismissible={options.gestureEnabled ?? false}\n onAnimationEnd={handleOpenChange}>\n <Drawer.Portal>\n <Drawer.Content className={modalStyles.transparentDrawerContent}>\n {/* TODO:(@Hirbod) Figure out how to add title and description to the modal for screen readers in a meaningful way */}\n <Drawer.Title about=\"\" aria-describedby=\"\" className={modalStyles.srOnly} />\n <Drawer.Description about=\"\" className={modalStyles.srOnly} />\n {/* Render the screen content */}\n <div className={modalStyles.modalBody}>{renderScreen()}</div>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n );\n}\n\nexport { TransparentModalStackRouteDrawer };\n"]}
@@ -0,0 +1,17 @@
1
+ import { ParamListBase, type EventMapBase } from '@react-navigation/native';
2
+ import React from 'react';
3
+ import type { NativeTabOptions, NativeTabsProps } from './types';
4
+ export declare function NativeTabsNavigator({ children, backBehavior, ...rest }: NativeTabsProps): React.JSX.Element;
5
+ export declare const NativeTabsNavigatorWithContext: React.ForwardRefExoticComponent<Omit<NativeTabsProps, "children"> & Partial<Pick<NativeTabsProps, "children">> & React.RefAttributes<unknown>> & {
6
+ Screen: (props: import("../..").ScreenProps<NativeTabOptions, Readonly<{
7
+ key: string;
8
+ index: number;
9
+ routeNames: string[];
10
+ history?: unknown[];
11
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
12
+ type: string;
13
+ stale: false;
14
+ }>, EventMapBase>) => null;
15
+ Protected: typeof import("../../views/Protected").Protected;
16
+ };
17
+ //# sourceMappingURL=NativeBottomTabsNavigator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,aAAa,EAIb,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKjE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,GAAG,IAAI,EACR,EAAE,eAAe,qBAajB;AAID,eAAO,MAAM,8BAA8B;;;;;;;;;;;CAOzC,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.NativeTabsNavigatorWithContext = void 0;
8
+ exports.NativeTabsNavigator = NativeTabsNavigator;
9
+ const native_1 = require("@react-navigation/native");
10
+ const react_1 = __importDefault(require("react"));
11
+ const NativeBottomTabsRouter_1 = require("./NativeBottomTabsRouter");
12
+ const NativeTabsView_1 = require("./NativeTabsView");
13
+ const __1 = require("../..");
14
+ // In Jetpack Compose, the default back behavior is to go back to the initial route.
15
+ const defaultBackBehavior = 'initialRoute';
16
+ function NativeTabsNavigator({ children, backBehavior = defaultBackBehavior, ...rest }) {
17
+ const builder = (0, native_1.useNavigationBuilder)(NativeBottomTabsRouter_1.NativeBottomTabsRouter, {
18
+ children,
19
+ backBehavior,
20
+ });
21
+ return <NativeTabsView_1.NativeTabsView builder={builder} {...rest}/>;
22
+ }
23
+ const createNativeTabNavigator = (0, native_1.createNavigatorFactory)(NativeTabsNavigator);
24
+ exports.NativeTabsNavigatorWithContext = (0, __1.withLayoutContext)(createNativeTabNavigator().Navigator, (screens) => {
25
+ return screens;
26
+ });
27
+ //# sourceMappingURL=NativeBottomTabsNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;AAqBb,kDAiBC;AApCD,qDAQkC;AAClC,kDAA0B;AAE1B,qEAAkE;AAClE,qDAAkD;AAClD,6BAA0C;AAG1C,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,GAAG,mBAAmB,EAClC,GAAG,IAAI,EACS;IAChB,MAAM,OAAO,GAAG,IAAA,6BAAoB,EAMlC,+CAAsB,EAAE;QACxB,QAAQ;QACR,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,CAAC,+BAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,EAAG,CAAC;AACxD,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAEhE,QAAA,8BAA8B,GAAG,IAAA,qBAAiB,EAK7D,wBAAwB,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;IAClD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC,CAAC","sourcesContent":["'use client';\n\nimport {\n createNavigatorFactory,\n NavigationState,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n type EventMapBase,\n} from '@react-navigation/native';\nimport React from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabsView } from './NativeTabsView';\nimport { withLayoutContext } from '../..';\nimport type { NativeTabOptions, NativeTabsProps } from './types';\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n ...rest\n}: NativeTabsProps) {\n const builder = useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >(NativeBottomTabsRouter, {\n children,\n backBehavior,\n });\n\n return <NativeTabsView builder={builder} {...rest} />;\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nexport const NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n NavigationState,\n EventMapBase\n>(createNativeTabNavigator().Navigator, (screens) => {\n return screens;\n});\n"]}
@@ -0,0 +1,3 @@
1
+ import { ParamListBase, Router, TabActionType, TabNavigationState, type TabRouterOptions } from '@react-navigation/native';
2
+ export declare function NativeBottomTabsRouter(options: TabRouterOptions): Router<TabNavigationState<ParamListBase>, import("@react-navigation/routers/lib/typescript/src/CommonActions").Action | TabActionType>;
3
+ //# sourceMappingURL=NativeBottomTabsRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeBottomTabsRouter.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,MAAM,EACN,aAAa,EACb,kBAAkB,EAElB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,0IAuE/D"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeBottomTabsRouter = NativeBottomTabsRouter;
4
+ const native_1 = require("@react-navigation/native");
5
+ function NativeBottomTabsRouter(options) {
6
+ const tabRouter = (0, native_1.TabRouter)({ ...options });
7
+ const nativeTabRouter = {
8
+ ...tabRouter,
9
+ // @ts-expect-error TODO: For some reason this is not typed correctly
10
+ getStateForAction: (state, action, options) => {
11
+ switch (action.type) {
12
+ case 'NAVIGATE': {
13
+ const newStateFromNavigation = tabRouter.getStateForAction(state, action, options);
14
+ const index = state.routes.findIndex((route) => route.name === action.payload.name);
15
+ if (index === -1 || !newStateFromNavigation) {
16
+ return newStateFromNavigation;
17
+ }
18
+ const newState = {
19
+ ...newStateFromNavigation,
20
+ routes: newStateFromNavigation.routes.map((route) => {
21
+ if (route.name !== action.payload.name) {
22
+ return route;
23
+ }
24
+ const nestedParams = route.params &&
25
+ 'params' in route.params &&
26
+ typeof route.params.params === 'object' &&
27
+ route.params.params
28
+ ? route.params.params
29
+ : {};
30
+ const isPreviewNavigation = action.payload.params &&
31
+ '__internal__expoRouterIsPreviewNavigation' in action.payload.params
32
+ ? action.payload.params.__internal__expoRouterIsPreviewNavigation
33
+ : undefined;
34
+ const previewKeyParams = isPreviewNavigation
35
+ ? {
36
+ __internal__expoRouterIsPreviewNavigation: isPreviewNavigation,
37
+ }
38
+ : {};
39
+ const params = {
40
+ ...(route.params || {}),
41
+ ...previewKeyParams,
42
+ // This is a workaround for the issue with the preview key not being passed to the params
43
+ // https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573
44
+ // Another solution would be to propagate the preview key in the useNavigationBuilder,
45
+ // but that would require us to fork the @react-navigation/core package.
46
+ params: {
47
+ ...nestedParams,
48
+ ...previewKeyParams,
49
+ },
50
+ };
51
+ return {
52
+ ...route,
53
+ params,
54
+ };
55
+ }),
56
+ };
57
+ return newState;
58
+ }
59
+ }
60
+ return tabRouter.getStateForAction(state, action, options);
61
+ },
62
+ };
63
+ return nativeTabRouter;
64
+ }
65
+ //# sourceMappingURL=NativeBottomTabsRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeBottomTabsRouter.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.tsx"],"names":[],"mappings":";;AAUA,wDAuEC;AAjFD,qDAQkC;AAElC,SAAgB,sBAAsB,CAAC,OAAyB;IAC9D,MAAM,SAAS,GAAG,IAAA,kBAAS,EAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAE5C,MAAM,eAAe,GAGjB;QACF,GAAG,SAAS;QACZ,qEAAqE;QACrE,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAA8C,EAAE,OAAO,EAAE,EAAE;YACpF,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpB,KAAK,UAAU,CAAC,CAAC,CAAC;oBAChB,MAAM,sBAAsB,GAAG,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;oBACnF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAEpF,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;wBAC5C,OAAO,sBAAsB,CAAC;oBAChC,CAAC;oBAED,MAAM,QAAQ,GAAG;wBACf,GAAG,sBAAsB;wBACzB,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;4BAClD,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gCACvC,OAAO,KAAK,CAAC;4BACf,CAAC;4BAED,MAAM,YAAY,GAChB,KAAK,CAAC,MAAM;gCACZ,QAAQ,IAAI,KAAK,CAAC,MAAM;gCACxB,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ;gCACvC,KAAK,CAAC,MAAM,CAAC,MAAM;gCACjB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;gCACrB,CAAC,CAAC,EAAE,CAAC;4BAET,MAAM,mBAAmB,GACvB,MAAM,CAAC,OAAO,CAAC,MAAM;gCACrB,2CAA2C,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM;gCAClE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,yCAAyC;gCACjE,CAAC,CAAC,SAAS,CAAC;4BAChB,MAAM,gBAAgB,GAAG,mBAAmB;gCAC1C,CAAC,CAAC;oCACE,yCAAyC,EAAE,mBAAmB;iCAC/D;gCACH,CAAC,CAAC,EAAE,CAAC;4BAEP,MAAM,MAAM,GAAG;gCACb,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;gCACvB,GAAG,gBAAgB;gCACnB,yFAAyF;gCACzF,qGAAqG;gCACrG,sFAAsF;gCACtF,wEAAwE;gCACxE,MAAM,EAAE;oCACN,GAAG,YAAY;oCACf,GAAG,gBAAgB;iCACpB;6BACF,CAAC;4BACF,OAAO;gCACL,GAAG,KAAK;gCACR,MAAM;6BACP,CAAC;wBACJ,CAAC,CAAC;qBACH,CAAC;oBACF,OAAO,QAAQ,CAAC;gBAClB,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import {\n CommonNavigationAction,\n ParamListBase,\n Router,\n TabActionType,\n TabNavigationState,\n TabRouter,\n type TabRouterOptions,\n} from '@react-navigation/native';\n\nexport function NativeBottomTabsRouter(options: TabRouterOptions) {\n const tabRouter = TabRouter({ ...options });\n\n const nativeTabRouter: Router<\n TabNavigationState<ParamListBase>,\n TabActionType | CommonNavigationAction\n > = {\n ...tabRouter,\n // @ts-expect-error TODO: For some reason this is not typed correctly\n getStateForAction: (state, action: TabActionType | CommonNavigationAction, options) => {\n switch (action.type) {\n case 'NAVIGATE': {\n const newStateFromNavigation = tabRouter.getStateForAction(state, action, options);\n const index = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (index === -1 || !newStateFromNavigation) {\n return newStateFromNavigation;\n }\n\n const newState = {\n ...newStateFromNavigation,\n routes: newStateFromNavigation.routes.map((route) => {\n if (route.name !== action.payload.name) {\n return route;\n }\n\n const nestedParams =\n route.params &&\n 'params' in route.params &&\n typeof route.params.params === 'object' &&\n route.params.params\n ? route.params.params\n : {};\n\n const isPreviewNavigation =\n action.payload.params &&\n '__internal__expoRouterIsPreviewNavigation' in action.payload.params\n ? action.payload.params.__internal__expoRouterIsPreviewNavigation\n : undefined;\n const previewKeyParams = isPreviewNavigation\n ? {\n __internal__expoRouterIsPreviewNavigation: isPreviewNavigation,\n }\n : {};\n\n const params = {\n ...(route.params || {}),\n ...previewKeyParams,\n // This is a workaround for the issue with the preview key not being passed to the params\n // https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573\n // Another solution would be to propagate the preview key in the useNavigationBuilder,\n // but that would require us to fork the @react-navigation/core package.\n params: {\n ...nestedParams,\n ...previewKeyParams,\n },\n };\n return {\n ...route,\n params,\n };\n }),\n };\n return newState;\n }\n }\n return tabRouter.getStateForAction(state, action, options);\n },\n };\n\n return nativeTabRouter;\n}\n"]}
@@ -0,0 +1,47 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import type { ExtendedNativeTabOptions, NativeTabTriggerProps } from './types';
3
+ /**
4
+ * The component used to customize the native tab options both in the _layout file and from the tab screen.
5
+ *
6
+ * When used in the _layout file, you need to provide a `name` prop.
7
+ * When used in the tab screen, the `name` prop takes no effect.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * // In _layout file
12
+ * import { NativeTabs } from 'expo-router/unstable-native-tabs';
13
+ *
14
+ * export default function Layout() {
15
+ * return (
16
+ * <NativeTabs>
17
+ * <NativeTabs.Trigger name="home" />
18
+ * <NativeTabs.Trigger name="settings" />
19
+ * </NativeTabs>
20
+ * );
21
+ * }
22
+ * ```
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * // In a tab screen
27
+ * import { NativeTabs } from 'expo-router/unstable-native-tabs';
28
+ *
29
+ * export default function HomeScreen() {
30
+ * return (
31
+ * <View>
32
+ * <NativeTabs.Trigger>
33
+ * <Label>Home</Label>
34
+ * </NativeTabs.Trigger>
35
+ * <Text>This is home screen!</Text>
36
+ * </View>
37
+ * );
38
+ * }
39
+ *
40
+ * **Note:** You can use the alias `NativeTabs.Trigger` for this component.
41
+ */
42
+ export declare function NativeTabTrigger(props: NativeTabTriggerProps): null;
43
+ export declare function convertTabPropsToOptions({ options, hidden, children, disablePopToTop, disableScrollToTop, }: NativeTabTriggerProps): ExtendedNativeTabOptions;
44
+ export declare function isNativeTabTrigger(child: ReactNode, contextKey?: string): child is ReactElement<NativeTabTriggerProps & {
45
+ name: string;
46
+ }>;
47
+ //# sourceMappingURL=NativeTabTrigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeTabTrigger.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabTrigger.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAK/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,QAqB5D;AAED,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,MAAM,EACN,QAAQ,EACR,eAAe,EACf,kBAAkB,GACnB,EAAE,qBAAqB,4BAgEvB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,KAAK,IAAI,YAAY,CAAC,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA6BjE"}