expo-router 6.1.0-canary-20251015-a6a1272 → 7.0.0-canary-20251031-b135dff

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 (279) hide show
  1. package/_error.js +36 -3
  2. package/build/ExpoRoot.js +1 -1
  3. package/build/ExpoRoot.js.map +1 -1
  4. package/build/global-state/router-store.d.ts +2 -0
  5. package/build/global-state/router-store.d.ts.map +1 -1
  6. package/build/global-state/router-store.js +16 -12
  7. package/build/global-state/router-store.js.map +1 -1
  8. package/build/global-state/routing.d.ts +12 -4
  9. package/build/global-state/routing.d.ts.map +1 -1
  10. package/build/global-state/routing.js +35 -10
  11. package/build/global-state/routing.js.map +1 -1
  12. package/build/global-state/storeContext.d.ts +2 -0
  13. package/build/global-state/storeContext.d.ts.map +1 -1
  14. package/build/internal/routing.d.ts +7 -0
  15. package/build/internal/routing.d.ts.map +1 -0
  16. package/build/internal/routing.js +21 -0
  17. package/build/internal/routing.js.map +1 -0
  18. package/build/internal/rsc.d.ts +5 -0
  19. package/build/internal/rsc.d.ts.map +1 -0
  20. package/build/internal/rsc.js +18 -0
  21. package/build/internal/rsc.js.map +1 -0
  22. package/build/internal/static.d.ts +3 -0
  23. package/build/internal/static.d.ts.map +1 -0
  24. package/build/internal/static.js +8 -0
  25. package/build/internal/static.js.map +1 -0
  26. package/build/internal/testing.d.ts +3 -0
  27. package/build/internal/testing.d.ts.map +1 -0
  28. package/build/internal/testing.js +11 -0
  29. package/build/internal/testing.js.map +1 -0
  30. package/build/internal/utils.d.ts +2 -0
  31. package/build/internal/utils.d.ts.map +1 -0
  32. package/build/internal/utils.js +6 -0
  33. package/build/internal/utils.js.map +1 -0
  34. package/build/layouts/BaseStack.d.ts +3 -0
  35. package/build/layouts/BaseStack.d.ts.map +1 -0
  36. package/build/layouts/BaseStack.js +8 -0
  37. package/build/layouts/BaseStack.js.map +1 -0
  38. package/build/layouts/ExperimentalModalStack.d.ts +9 -0
  39. package/build/layouts/ExperimentalModalStack.d.ts.map +1 -0
  40. package/build/layouts/ExperimentalModalStack.js +15 -0
  41. package/build/layouts/ExperimentalModalStack.js.map +1 -0
  42. package/build/layouts/IsWithinLayoutContext.d.ts +2 -0
  43. package/build/layouts/IsWithinLayoutContext.d.ts.map +1 -0
  44. package/build/layouts/IsWithinLayoutContext.js +7 -0
  45. package/build/layouts/IsWithinLayoutContext.js.map +1 -0
  46. package/build/layouts/Stack.web.d.ts +1 -14
  47. package/build/layouts/Stack.web.d.ts.map +1 -1
  48. package/build/layouts/Stack.web.js +10 -13
  49. package/build/layouts/Stack.web.js.map +1 -1
  50. package/build/layouts/_web-modal.d.ts +3 -0
  51. package/build/layouts/_web-modal.d.ts.map +1 -0
  52. package/build/layouts/_web-modal.js +8 -0
  53. package/build/layouts/_web-modal.js.map +1 -0
  54. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  55. package/build/layouts/withLayoutContext.js +5 -2
  56. package/build/layouts/withLayoutContext.js.map +1 -1
  57. package/build/loaders/ServerDataLoaderContext.d.ts +2 -1
  58. package/build/loaders/ServerDataLoaderContext.d.ts.map +1 -1
  59. package/build/loaders/ServerDataLoaderContext.js.map +1 -1
  60. package/build/modal/web/ModalStack.d.ts.map +1 -1
  61. package/build/modal/web/ModalStack.js +7 -2
  62. package/build/modal/web/ModalStack.js.map +1 -1
  63. package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsNavigator.d.ts → NativeBottomTabsNavigator.d.ts} +3 -3
  64. package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -0
  65. package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsNavigator.js → NativeBottomTabsNavigator.js} +49 -14
  66. package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -0
  67. package/build/native-tabs/NativeBottomTabsRouter.d.ts.map +1 -0
  68. package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsRouter.js → NativeBottomTabsRouter.js} +1 -1
  69. package/build/native-tabs/NativeBottomTabsRouter.js.map +1 -0
  70. package/build/native-tabs/{NativeBottomTabs/NativeTabTrigger.d.ts → NativeTabTrigger.d.ts} +1 -1
  71. package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -0
  72. package/build/native-tabs/{NativeBottomTabs/NativeTabTrigger.js → NativeTabTrigger.js} +9 -5
  73. package/build/native-tabs/NativeTabTrigger.js.map +1 -0
  74. package/build/native-tabs/NativeTabs.d.ts.map +1 -0
  75. package/build/native-tabs/{NativeBottomTabs/NativeTabs.js → NativeTabs.js} +2 -0
  76. package/build/native-tabs/NativeTabs.js.map +1 -0
  77. package/build/native-tabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
  78. package/build/native-tabs/NativeTabsTriggerTabBar.js.map +1 -0
  79. package/build/native-tabs/NativeTabsView.d.ts.map +1 -0
  80. package/build/native-tabs/NativeTabsView.js +103 -0
  81. package/build/native-tabs/NativeTabsView.js.map +1 -0
  82. package/build/native-tabs/NativeTabsView.web.d.ts.map +1 -0
  83. package/build/native-tabs/{NativeBottomTabs/NativeTabsView.web.js → NativeTabsView.web.js} +18 -57
  84. package/build/native-tabs/NativeTabsView.web.js.map +1 -0
  85. package/build/native-tabs/{NativeBottomTabs/appearance.d.ts → appearance.d.ts} +2 -2
  86. package/build/native-tabs/appearance.d.ts.map +1 -0
  87. package/build/native-tabs/{NativeBottomTabs/appearance.js → appearance.js} +18 -6
  88. package/build/native-tabs/appearance.js.map +1 -0
  89. package/build/native-tabs/common/elements.d.ts +1 -1
  90. package/build/native-tabs/common/elements.d.ts.map +1 -1
  91. package/build/native-tabs/common/elements.js.map +1 -1
  92. package/build/native-tabs/index.d.ts +4 -4
  93. package/build/native-tabs/index.d.ts.map +1 -1
  94. package/build/native-tabs/index.js +3 -3
  95. package/build/native-tabs/index.js.map +1 -1
  96. package/build/native-tabs/{NativeBottomTabs/types.d.ts → types.d.ts} +19 -6
  97. package/build/native-tabs/types.d.ts.map +1 -0
  98. package/build/native-tabs/types.js.map +1 -0
  99. package/build/native-tabs/{NativeBottomTabs/utils.d.ts → utils/children.d.ts} +1 -3
  100. package/build/native-tabs/utils/children.d.ts.map +1 -0
  101. package/build/native-tabs/{NativeBottomTabs/utils.js → utils/children.js} +1 -7
  102. package/build/native-tabs/utils/children.js.map +1 -0
  103. package/build/native-tabs/utils/icon.d.ts +25 -0
  104. package/build/native-tabs/utils/icon.d.ts.map +1 -0
  105. package/build/native-tabs/utils/icon.js +68 -0
  106. package/build/native-tabs/utils/icon.js.map +1 -0
  107. package/build/native-tabs/utils/index.d.ts +4 -0
  108. package/build/native-tabs/utils/index.d.ts.map +1 -0
  109. package/build/native-tabs/utils/index.js +11 -0
  110. package/build/native-tabs/utils/index.js.map +1 -0
  111. package/build/native-tabs/utils/label.d.ts +6 -0
  112. package/build/native-tabs/utils/label.d.ts.map +1 -0
  113. package/build/native-tabs/utils/label.js +15 -0
  114. package/build/native-tabs/utils/label.js.map +1 -0
  115. package/build/renderRootComponent.d.ts.map +1 -1
  116. package/build/renderRootComponent.js +4 -7
  117. package/build/renderRootComponent.js.map +1 -1
  118. package/build/split-view/elements.d.ts +10 -0
  119. package/build/split-view/elements.d.ts.map +1 -0
  120. package/build/split-view/elements.js +15 -0
  121. package/build/split-view/elements.js.map +1 -0
  122. package/build/split-view/index.d.ts +2 -0
  123. package/build/split-view/index.d.ts.map +1 -0
  124. package/build/split-view/index.js +6 -0
  125. package/build/split-view/index.js.map +1 -0
  126. package/build/split-view/split-view.d.ts +13 -0
  127. package/build/split-view/split-view.d.ts.map +1 -0
  128. package/build/split-view/split-view.js +93 -0
  129. package/build/split-view/split-view.js.map +1 -0
  130. package/build/static/html.d.ts +5 -15
  131. package/build/static/html.d.ts.map +1 -1
  132. package/build/static/html.js +9 -25
  133. package/build/static/html.js.map +1 -1
  134. package/build/static/registerRootComponent.d.ts +11 -0
  135. package/build/static/registerRootComponent.d.ts.map +1 -0
  136. package/build/static/registerRootComponent.js +11 -0
  137. package/build/static/registerRootComponent.js.map +1 -0
  138. package/build/types.d.ts +4 -2
  139. package/build/types.d.ts.map +1 -1
  140. package/build/types.js.map +1 -1
  141. package/build/ui/TabRouter.d.ts +3 -4
  142. package/build/ui/TabRouter.d.ts.map +1 -1
  143. package/build/ui/TabRouter.js +14 -67
  144. package/build/ui/TabRouter.js.map +1 -1
  145. package/build/ui/TabTrigger.d.ts +4 -5
  146. package/build/ui/TabTrigger.d.ts.map +1 -1
  147. package/build/ui/TabTrigger.js +9 -8
  148. package/build/ui/TabTrigger.js.map +1 -1
  149. package/build/ui/Tabs.d.ts +0 -1
  150. package/build/ui/Tabs.d.ts.map +1 -1
  151. package/build/ui/Tabs.js.map +1 -1
  152. package/html.js +1 -1
  153. package/internal/routing.d.ts +1 -0
  154. package/internal/routing.js +1 -0
  155. package/internal/rsc.d.ts +1 -0
  156. package/internal/rsc.js +1 -0
  157. package/internal/static.d.ts +1 -0
  158. package/internal/static.js +1 -0
  159. package/internal/testing.d.ts +1 -0
  160. package/internal/testing.js +1 -0
  161. package/internal/utils.d.ts +1 -0
  162. package/internal/utils.js +1 -0
  163. package/package.json +13 -11
  164. package/plugin/build/index.js +10 -0
  165. package/plugin/options.json +5 -0
  166. package/plugin/src/index.ts +17 -1
  167. package/rsc/headers.d.ts +1 -1
  168. package/rsc/headers.js +1 -1
  169. package/unstable-split-view.d.ts +1 -0
  170. package/unstable-split-view.js +1 -0
  171. package/build/getRoutesSSR.d.ts +0 -20
  172. package/build/getRoutesSSR.d.ts.map +0 -1
  173. package/build/getRoutesSSR.js +0 -97
  174. package/build/getRoutesSSR.js.map +0 -1
  175. package/build/getServerManifest.d.ts +0 -88
  176. package/build/getServerManifest.d.ts.map +0 -1
  177. package/build/getServerManifest.js +0 -238
  178. package/build/getServerManifest.js.map +0 -1
  179. package/build/loadStaticParamsAsync.d.ts +0 -9
  180. package/build/loadStaticParamsAsync.d.ts.map +0 -1
  181. package/build/loadStaticParamsAsync.js +0 -163
  182. package/build/loadStaticParamsAsync.js.map +0 -1
  183. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +0 -1
  184. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +0 -1
  185. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +0 -1
  186. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +0 -1
  187. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +0 -1
  188. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +0 -1
  189. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +0 -1
  190. package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +0 -1
  191. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +0 -1
  192. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +0 -1
  193. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +0 -1
  194. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +0 -187
  195. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +0 -1
  196. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +0 -1
  197. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +0 -1
  198. package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +0 -1
  199. package/build/native-tabs/NativeBottomTabs/appearance.js.map +0 -1
  200. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +0 -1
  201. package/build/native-tabs/NativeBottomTabs/types.js.map +0 -1
  202. package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +0 -1
  203. package/build/native-tabs/NativeBottomTabs/utils.js.map +0 -1
  204. package/build/routes-manifest.d.ts +0 -28
  205. package/build/routes-manifest.d.ts.map +0 -1
  206. package/build/routes-manifest.js +0 -30
  207. package/build/routes-manifest.js.map +0 -1
  208. package/build/rsc/middleware.d.ts +0 -8
  209. package/build/rsc/middleware.d.ts.map +0 -1
  210. package/build/rsc/middleware.js +0 -105
  211. package/build/rsc/middleware.js.map +0 -1
  212. package/build/rsc/path.d.ts +0 -34
  213. package/build/rsc/path.d.ts.map +0 -1
  214. package/build/rsc/path.js +0 -174
  215. package/build/rsc/path.js.map +0 -1
  216. package/build/rsc/router/create-expo-pages.d.ts +0 -20
  217. package/build/rsc/router/create-expo-pages.d.ts.map +0 -1
  218. package/build/rsc/router/create-expo-pages.js +0 -21
  219. package/build/rsc/router/create-expo-pages.js.map +0 -1
  220. package/build/rsc/router/create-pages.d.ts +0 -80
  221. package/build/rsc/router/create-pages.d.ts.map +0 -1
  222. package/build/rsc/router/create-pages.js +0 -232
  223. package/build/rsc/router/create-pages.js.map +0 -1
  224. package/build/rsc/router/defineRouter.d.ts +0 -30
  225. package/build/rsc/router/defineRouter.d.ts.map +0 -1
  226. package/build/rsc/router/defineRouter.js +0 -171
  227. package/build/rsc/router/defineRouter.js.map +0 -1
  228. package/build/rsc/router/expo-definedRouter.d.ts +0 -3
  229. package/build/rsc/router/expo-definedRouter.d.ts.map +0 -1
  230. package/build/rsc/router/expo-definedRouter.js +0 -112
  231. package/build/rsc/router/expo-definedRouter.js.map +0 -1
  232. package/build/rsc/router/noopRouter.d.ts +0 -3
  233. package/build/rsc/router/noopRouter.d.ts.map +0 -1
  234. package/build/rsc/router/noopRouter.js +0 -7
  235. package/build/rsc/router/noopRouter.js.map +0 -1
  236. package/build/rsc/rsc-renderer.d.ts +0 -44
  237. package/build/rsc/rsc-renderer.d.ts.map +0 -1
  238. package/build/rsc/rsc-renderer.js +0 -200
  239. package/build/rsc/rsc-renderer.js.map +0 -1
  240. package/build/rsc/server.d.ts +0 -65
  241. package/build/rsc/server.d.ts.map +0 -1
  242. package/build/rsc/server.js +0 -89
  243. package/build/rsc/server.js.map +0 -1
  244. package/build/static/getRootComponent.d.ts +0 -2
  245. package/build/static/getRootComponent.d.ts.map +0 -1
  246. package/build/static/getRootComponent.js +0 -25
  247. package/build/static/getRootComponent.js.map +0 -1
  248. package/build/static/getServerManifest.d.ts +0 -22
  249. package/build/static/getServerManifest.d.ts.map +0 -1
  250. package/build/static/getServerManifest.js +0 -50
  251. package/build/static/getServerManifest.js.map +0 -1
  252. package/build/static/renderStaticContent.d.ts +0 -15
  253. package/build/static/renderStaticContent.d.ts.map +0 -1
  254. package/build/static/renderStaticContent.js +0 -130
  255. package/build/static/renderStaticContent.js.map +0 -1
  256. package/build/typed-routes/generate.d.ts +0 -8
  257. package/build/typed-routes/generate.d.ts.map +0 -1
  258. package/build/typed-routes/generate.js +0 -186
  259. package/build/typed-routes/generate.js.map +0 -1
  260. package/build/typed-routes/index.d.ts +0 -35
  261. package/build/typed-routes/index.d.ts.map +0 -1
  262. package/build/typed-routes/index.js +0 -99
  263. package/build/typed-routes/index.js.map +0 -1
  264. package/build/typed-routes/testSetup.d.ts +0 -2
  265. package/build/typed-routes/testSetup.d.ts.map +0 -1
  266. package/build/typed-routes/testSetup.js +0 -42
  267. package/build/typed-routes/testSetup.js.map +0 -1
  268. package/build/utils/html.d.ts +0 -12
  269. package/build/utils/html.d.ts.map +0 -1
  270. package/build/utils/html.js +0 -29
  271. package/build/utils/html.js.map +0 -1
  272. package/node/render.js +0 -3
  273. /package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsRouter.d.ts → NativeBottomTabsRouter.d.ts} +0 -0
  274. /package/build/native-tabs/{NativeBottomTabs/NativeTabs.d.ts → NativeTabs.d.ts} +0 -0
  275. /package/build/native-tabs/{NativeBottomTabs/NativeTabsTriggerTabBar.d.ts → NativeTabsTriggerTabBar.d.ts} +0 -0
  276. /package/build/native-tabs/{NativeBottomTabs/NativeTabsTriggerTabBar.js → NativeTabsTriggerTabBar.js} +0 -0
  277. /package/build/native-tabs/{NativeBottomTabs/NativeTabsView.d.ts → NativeTabsView.d.ts} +0 -0
  278. /package/build/native-tabs/{NativeBottomTabs/NativeTabsView.web.d.ts → NativeTabsView.web.d.ts} +0 -0
  279. /package/build/native-tabs/{NativeBottomTabs/types.js → types.js} +0 -0
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ScrollViewStyleReset = ScrollViewStyleReset;
7
- exports.PreloadedDataScript = PreloadedDataScript;
8
- exports.Html = Html;
7
+ exports.InnerRoot = InnerRoot;
9
8
  /**
10
9
  * Copyright © 2023 650 Industries.
11
10
  *
12
11
  * This source code is licensed under the MIT license found in the
13
12
  * LICENSE file in the root directory of this source tree.
14
13
  */
14
+ const native_1 = require("@react-navigation/native");
15
15
  const react_1 = __importDefault(require("react"));
16
- const html_1 = require("../utils/html");
16
+ const ServerDataLoaderContext_1 = require("../loaders/ServerDataLoaderContext");
17
17
  /**
18
18
  * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).
19
19
  */
@@ -22,27 +22,11 @@ function ScrollViewStyleReset() {
22
22
  __html: `#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}`,
23
23
  }}/>);
24
24
  }
25
- /**
26
- * Injects loader data into the HTML as a script tag for client-side hydration.
27
- * The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.
28
- */
29
- function PreloadedDataScript({ data }) {
30
- const safeJson = (0, html_1.escapeUnsafeCharacters)(JSON.stringify(data));
31
- return (<script id="expo-router-data" type="module" dangerouslySetInnerHTML={{
32
- // NOTE(@hassankhan): The double serialization used here isn't as much of a problem server-side, but allows faster
33
- // client-side parsing using native `JSON.parse()`. See https://v8.dev/blog/cost-of-javascript-2019#json
34
- __html: `globalThis.__EXPO_ROUTER_LOADER_DATA__ = JSON.parse(${JSON.stringify(safeJson)});`,
35
- }}/>);
36
- }
37
- function Html({ children }) {
38
- return (<html lang="en">
39
- <head>
40
- <meta charSet="utf-8"/>
41
- <meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
42
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
43
- <ScrollViewStyleReset />
44
- </head>
45
- <body>{children}</body>
46
- </html>);
25
+ function InnerRoot({ children, loadedData, }) {
26
+ // NOTE(@hassankhan): This ref seems to be unnecessary, double-check SSR/SSG code paths and remove
27
+ const ref = react_1.default.createRef();
28
+ return (<ServerDataLoaderContext_1.ServerDataLoaderContext value={loadedData}>
29
+ <native_1.ServerContainer ref={ref}>{children}</native_1.ServerContainer>
30
+ </ServerDataLoaderContext_1.ServerDataLoaderContext>);
47
31
  }
48
32
  //# sourceMappingURL=html.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":";;;;;AAaA,oDASC;AAMD,kDAcC;AAED,oBAYC;AAxDD;;;;;GAKG;AACH,kDAAsD;AAEtD,wCAAuD;AAEvD;;GAEG;AACH,SAAgB,oBAAoB;IAClC,OAAO,CACL,CAAC,KAAK,CACJ,EAAE,CAAC,YAAY,CACf,uBAAuB,CAAC,CAAC;YACvB,MAAM,EAAE,sEAAsE;SAC/E,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAqC;IAC7E,MAAM,QAAQ,GAAG,IAAA,6BAAsB,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9D,OAAO,CACL,CAAC,MAAM,CACL,EAAE,CAAC,kBAAkB,CACrB,IAAI,CAAC,QAAQ,CACb,uBAAuB,CAAC,CAAC;YACvB,kHAAkH;YAClH,wGAAwG;YACxG,MAAM,EAAE,uDAAuD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI;SAC5F,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,SAAgB,IAAI,CAAC,EAAE,QAAQ,EAAqB;IAClD,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACb;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EACrB;QAAA,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EACnD;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,uDAAuD,EACrF;QAAA,CAAC,oBAAoB,CAAC,AAAD,EACvB;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CACxB;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React, { type PropsWithChildren } from 'react';\n\nimport { escapeUnsafeCharacters } from '../utils/html';\n\n/**\n * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).\n */\nexport function ScrollViewStyleReset() {\n return (\n <style\n id=\"expo-reset\"\n dangerouslySetInnerHTML={{\n __html: `#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}`,\n }}\n />\n );\n}\n\n/**\n * Injects loader data into the HTML as a script tag for client-side hydration.\n * The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.\n */\nexport function PreloadedDataScript({ data }: { data: Record<string, unknown> }) {\n const safeJson = escapeUnsafeCharacters(JSON.stringify(data));\n\n return (\n <script\n id=\"expo-router-data\"\n type=\"module\"\n dangerouslySetInnerHTML={{\n // NOTE(@hassankhan): The double serialization used here isn't as much of a problem server-side, but allows faster\n // client-side parsing using native `JSON.parse()`. See https://v8.dev/blog/cost-of-javascript-2019#json\n __html: `globalThis.__EXPO_ROUTER_LOADER_DATA__ = JSON.parse(${JSON.stringify(safeJson)});`,\n }}\n />\n );\n}\n\nexport function Html({ children }: PropsWithChildren) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta httpEquiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\" />\n <ScrollViewStyleReset />\n </head>\n <body>{children}</body>\n </html>\n );\n}\n"]}
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":";;;;;AAcA,oDASC;AAED,8BAYC;AArCD;;;;;GAKG;AACH,qDAA+E;AAC/E,kDAAiD;AAEjD,gFAAmG;AAEnG;;GAEG;AACH,SAAgB,oBAAoB;IAClC,OAAO,CACL,CAAC,KAAK,CACJ,EAAE,CAAC,YAAY,CACf,uBAAuB,CAAC,CAAC;YACvB,MAAM,EAAE,sEAAsE;SAC/E,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,SAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,UAAU,GAC8C;IACxD,kGAAkG;IAClG,MAAM,GAAG,GAAG,eAAK,CAAC,SAAS,EAAsB,CAAC;IAElD,OAAO,CACL,CAAC,iDAAuB,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CACzC;MAAA,CAAC,wBAAe,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,wBAAe,CACxD;IAAA,EAAE,iDAAuB,CAAC,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ServerContainer, ServerContainerRef } from '@react-navigation/native';\nimport React, { PropsWithChildren } from 'react';\n\nimport { ServerDataLoaderContext, ServerDataLoaderData } from '../loaders/ServerDataLoaderContext';\n\n/**\n * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).\n */\nexport function ScrollViewStyleReset() {\n return (\n <style\n id=\"expo-reset\"\n dangerouslySetInnerHTML={{\n __html: `#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}`,\n }}\n />\n );\n}\n\nexport function InnerRoot({\n children,\n loadedData,\n}: PropsWithChildren<{ loadedData: ServerDataLoaderData }>) {\n // NOTE(@hassankhan): This ref seems to be unnecessary, double-check SSR/SSG code paths and remove\n const ref = React.createRef<ServerContainerRef>();\n\n return (\n <ServerDataLoaderContext value={loadedData}>\n <ServerContainer ref={ref}>{children}</ServerContainer>\n </ServerDataLoaderContext>\n );\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { ComponentType, JSX, PropsWithChildren } from 'react';
2
+ import type { ExpoRootProps } from '../ExpoRoot';
3
+ import type { RequireContext } from '../types';
4
+ type InitialProps = {
5
+ location: URL;
6
+ context: RequireContext;
7
+ wrapper: ComponentType<PropsWithChildren>;
8
+ };
9
+ export declare function registerStaticRootComponent<P extends InitialProps>(component: (props: ExpoRootProps) => JSX.Element, initialProps: P): any;
10
+ export {};
11
+ //# sourceMappingURL=registerRootComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerRootComponent.d.ts","sourceRoot":"","sources":["../../src/static/registerRootComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAInE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,KAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAIF,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,YAAY,EAChE,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,GAAG,CAAC,OAAO,EAChD,YAAY,EAAE,CAAC,OAIhB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerStaticRootComponent = registerStaticRootComponent;
4
+ // @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)
5
+ const react_native_web_1 = require("react-native-web");
6
+ const APP_KEY = 'App';
7
+ function registerStaticRootComponent(component, initialProps) {
8
+ react_native_web_1.AppRegistry.registerComponent(APP_KEY, () => component);
9
+ return react_native_web_1.AppRegistry.getApplication(APP_KEY, { initialProps });
10
+ }
11
+ //# sourceMappingURL=registerRootComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerRootComponent.js","sourceRoot":"","sources":["../../src/static/registerRootComponent.ts"],"names":[],"mappings":";;AAeA,kEAMC;AApBD,wFAAwF;AACxF,uDAA+C;AAW/C,MAAM,OAAO,GAAG,KAAK,CAAC;AAEtB,SAAgB,2BAA2B,CACzC,SAAgD,EAChD,YAAe;IAEf,8BAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACxD,OAAO,8BAAW,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import type { ComponentType, JSX, PropsWithChildren } from 'react';\n// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)\nimport { AppRegistry } from 'react-native-web';\n\nimport type { ExpoRootProps } from '../ExpoRoot';\nimport type { RequireContext } from '../types';\n\ntype InitialProps = {\n location: URL;\n context: RequireContext;\n wrapper: ComponentType<PropsWithChildren>;\n};\n\nconst APP_KEY = 'App';\n\nexport function registerStaticRootComponent<P extends InitialProps>(\n component: (props: ExpoRootProps) => JSX.Element,\n initialProps: P\n) {\n AppRegistry.registerComponent(APP_KEY, () => component);\n return AppRegistry.getApplication(APP_KEY, { initialProps });\n}\n"]}
package/build/types.d.ts CHANGED
@@ -32,7 +32,9 @@ export type NativeIntent = {
32
32
  * - **path**: represents the URL or path undergoing processing.
33
33
  * - **initial**: a boolean indicating whether the path is the app's initial URL.
34
34
  *
35
- * It's return value should either be a `string` or a `Promise<string>`.
35
+ * Its return value should be a `string`, a `Promise<string | null>`, or `null`. When a falsy value
36
+ * is returned (for example, `null`), no redirection occurs and the app stays on the current path.
37
+ *
36
38
  * Note that throwing errors within this method may result in app crashes. It's recommended to
37
39
  * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.
38
40
  *
@@ -41,7 +43,7 @@ export type NativeIntent = {
41
43
  redirectSystemPath?: (event: {
42
44
  path: string;
43
45
  initial: boolean;
44
- }) => Promise<string> | string;
46
+ }) => Promise<string | null> | string | null;
45
47
  /**
46
48
  * > **warning** Experimentally available in SDK 52.
47
49
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEjF;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,C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AC;KAClB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAAK,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;CACzF,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErB,mBAAmB,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// TODO: Use the global type\n/**\n * @hidden\n */\nexport interface RequireContext {\n /** Return the keys that can be resolved. */\n keys(): string[];\n (id: string): any;\n <T>(id: string): T;\n /** **Unimplemented:** Return the module identifier for a user request. */\n resolve(id: string): string;\n /** **Unimplemented:** Readable identifier for the context module. */\n id: string;\n}\n\n/**\n * The list of input keys will become optional, everything else will remain the same.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * Created by using a special file called `+native-intent.tsx` at the top-level of your\n * project's **app** directory. It exports `redirectSystemPath` or `legacy_subscribe` functions,\n * both methods designed to handle URL/path processing.\n *\n * Useful for re-writing URLs to correctly target a route when unique/referred URLs\n * are incoming from third-party providers or stale URLs from previous versions.\n *\n * @see For more information on how to use `NativeIntent`, see [Customizing links](/router/advanced/native-intent/).\n */\nexport type NativeIntent = {\n /**\n * A special method used to process URLs in native apps. When invoked, it receives an\n * `options` object with the following properties:\n * - **path**: represents the URL or path undergoing processing.\n * - **initial**: a boolean indicating whether the path is the app's initial URL.\n *\n * It's return value should either be a `string` or a `Promise<string>`.\n * Note that throwing errors within this method may result in app crashes. It's recommended to\n * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.\n *\n * @see For usage information, see [Redirecting system paths](/router/advanced/native-intent/#redirectsystempath).\n */\n redirectSystemPath?: (event: { path: string; initial: boolean }) => Promise<string> | string;\n /**\n * > **warning** Experimentally available in SDK 52.\n *\n * Useful as an alternative API when a third-party provider doesn't support Expo Router\n * but has support for React Navigation via `Linking.subscribe()` for existing projects.\n *\n * Using this API is not recommended for newer projects or integrations since it is\n * incompatible with Server Side Routing and\n * [Static Rendering](/router/reference/static-rendering/), and can become challenging to manage while offline or in a low network environment.\n *\n */\n legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);\n};\n\n/**\n * Function type for route loaders. Loaders are executed on the server during\n * SSR/SSG to fetch data required by a route.\n */\nexport type LoaderFunction<T = any> = (args: {\n params: Record<string, string | string[]>;\n request?: Request;\n}) => Promise<T> | T;\n\nexport type * from './typed-routes/types';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// TODO: Use the global type\n/**\n * @hidden\n */\nexport interface RequireContext {\n /** Return the keys that can be resolved. */\n keys(): string[];\n (id: string): any;\n <T>(id: string): T;\n /** **Unimplemented:** Return the module identifier for a user request. */\n resolve(id: string): string;\n /** **Unimplemented:** Readable identifier for the context module. */\n id: string;\n}\n\n/**\n * The list of input keys will become optional, everything else will remain the same.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * Created by using a special file called `+native-intent.tsx` at the top-level of your\n * project's **app** directory. It exports `redirectSystemPath` or `legacy_subscribe` functions,\n * both methods designed to handle URL/path processing.\n *\n * Useful for re-writing URLs to correctly target a route when unique/referred URLs\n * are incoming from third-party providers or stale URLs from previous versions.\n *\n * @see For more information on how to use `NativeIntent`, see [Customizing links](/router/advanced/native-intent/).\n */\nexport type NativeIntent = {\n /**\n * A special method used to process URLs in native apps. When invoked, it receives an\n * `options` object with the following properties:\n * - **path**: represents the URL or path undergoing processing.\n * - **initial**: a boolean indicating whether the path is the app's initial URL.\n *\n * Its return value should be a `string`, a `Promise<string | null>`, or `null`. When a falsy value\n * is returned (for example, `null`), no redirection occurs and the app stays on the current path.\n *\n * Note that throwing errors within this method may result in app crashes. It's recommended to\n * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.\n *\n * @see For usage information, see [Redirecting system paths](/router/advanced/native-intent/#redirectsystempath).\n */\n redirectSystemPath?: (event: {\n path: string;\n initial: boolean;\n }) => Promise<string | null> | string | null;\n /**\n * > **warning** Experimentally available in SDK 52.\n *\n * Useful as an alternative API when a third-party provider doesn't support Expo Router\n * but has support for React Navigation via `Linking.subscribe()` for existing projects.\n *\n * Using this API is not recommended for newer projects or integrations since it is\n * incompatible with Server Side Routing and\n * [Static Rendering](/router/reference/static-rendering/), and can become challenging to manage while offline or in a low network environment.\n *\n */\n legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);\n};\n\n/**\n * Function type for route loaders. Loaders are executed on the server during\n * SSR/SSG to fetch data required by a route.\n */\nexport type LoaderFunction<T = any> = (args: {\n params: Record<string, string | string[]>;\n request?: Request;\n}) => Promise<T> | T;\n\nexport type * from './typed-routes/types';\n"]}
@@ -3,18 +3,17 @@ import { TriggerMap } from './common';
3
3
  export type ExpoTabRouterOptions = RNTabRouterOptions & {
4
4
  triggerMap: TriggerMap;
5
5
  };
6
- export type ExpoTabsResetValue = 'always' | 'onFocus' | 'never';
7
6
  export type ExpoTabActionType = RNTabActionType | CommonNavigationAction | {
8
7
  type: 'JUMP_TO';
9
8
  source?: string;
10
9
  target?: string;
11
10
  payload: {
12
11
  name: string;
13
- reset?: ExpoTabsResetValue;
12
+ resetOnFocus?: boolean;
14
13
  params?: object;
15
14
  };
16
15
  };
17
- export declare function ExpoTabRouter({ triggerMap, ...options }: ExpoTabRouterOptions): Router<TabNavigationState<ParamListBase>, {
16
+ export declare function ExpoTabRouter(options: ExpoTabRouterOptions): Router<TabNavigationState<ParamListBase>, {
18
17
  type: "GO_BACK";
19
18
  source?: string;
20
19
  target?: string;
@@ -97,7 +96,7 @@ export declare function ExpoTabRouter({ triggerMap, ...options }: ExpoTabRouterO
97
96
  target?: string;
98
97
  payload: {
99
98
  name: string;
100
- reset?: ExpoTabsResetValue;
99
+ resetOnFocus?: boolean;
101
100
  params?: object;
102
101
  };
103
102
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../../src/ui/TabRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,aAAa,EAEb,MAAM,EACN,aAAa,IAAI,eAAe,EAChC,kBAAkB,EAClB,gBAAgB,IAAI,kBAAkB,EACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG;IACtD,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf,sBAAsB,GACtB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,kBAAkB,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEN,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,EAAE,oBAAoB;;;;;;;;cAhBpE,CAAC;YAAsB,CAAC;aAAuB,CAAC;WAE5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aACN,MAAM;aACN;QACP,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;GAmDN"}
@@ -1,42 +1,8 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.ExpoTabRouter = ExpoTabRouter;
37
4
  const native_1 = require("@react-navigation/native");
38
- const Linking = __importStar(require("expo-linking"));
39
- function ExpoTabRouter({ triggerMap, ...options }) {
5
+ function ExpoTabRouter(options) {
40
6
  const rnTabRouter = (0, native_1.TabRouter)(options);
41
7
  const router = {
42
8
  ...rnTabRouter,
@@ -44,49 +10,30 @@ function ExpoTabRouter({ triggerMap, ...options }) {
44
10
  if (action.type !== 'JUMP_TO') {
45
11
  return rnTabRouter.getStateForAction(state, action, options);
46
12
  }
47
- const name = action.payload.name;
48
- const trigger = triggerMap[name];
49
- if (!trigger) {
50
- // This is probably for a different navigator
51
- return null;
52
- }
53
- else if (trigger.type === 'external') {
54
- Linking.openURL(trigger.href);
55
- return state;
56
- }
57
- const route = state.routes.find((route) => route.name === trigger.routeNode.route);
13
+ const route = state.routes.find((route) => route.name === action.payload.name);
58
14
  if (!route) {
59
15
  // This shouldn't occur, but lets just hand it off to the next navigator in case.
60
16
  return null;
61
17
  }
62
18
  // We should reset if this is the first time visiting the route
63
19
  let shouldReset = !state.history.some((item) => item.key === route?.key) && !route.state;
64
- if (!shouldReset && 'reset' in action.payload && action.payload.reset) {
65
- switch (action.payload.reset) {
66
- case 'never': {
67
- shouldReset = false;
68
- break;
69
- }
70
- case 'always': {
71
- shouldReset = true;
72
- break;
73
- }
74
- case 'onFocus': {
75
- shouldReset = state.routes[state.index].key === route.key;
76
- break;
77
- }
78
- default: {
79
- // TypeScript trick to ensure all use-cases are accounted for
80
- action.payload.reset;
81
- }
82
- }
20
+ if (!shouldReset && 'resetOnFocus' in action.payload && action.payload.resetOnFocus) {
21
+ shouldReset = state.routes[state.index].key !== route.key;
83
22
  }
84
23
  if (shouldReset) {
85
24
  options.routeParamList[route.name] = {
86
25
  ...options.routeParamList[route.name],
87
- ...trigger.action.payload.params,
88
26
  };
89
- return rnTabRouter.getStateForAction(state, trigger.action, options);
27
+ state = {
28
+ ...state,
29
+ routes: state.routes.map((r) => {
30
+ if (r.key !== route.key) {
31
+ return r;
32
+ }
33
+ return { ...r, state: undefined };
34
+ }),
35
+ };
36
+ return rnTabRouter.getStateForAction(state, action, options);
90
37
  }
91
38
  else {
92
39
  return rnTabRouter.getStateForRouteFocus(state, route.key);
@@ -1 +1 @@
1
- {"version":3,"file":"TabRouter.js","sourceRoot":"","sources":["../../src/ui/TabRouter.tsx"],"names":[],"mappings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NTabActionType,\n TabNavigationState,\n TabRouterOptions as RNTabRouterOptions,\n} from '@react-navigation/native';\nimport * as Linking from 'expo-linking';\n\nimport { TriggerMap } from './common';\n\nexport type ExpoTabRouterOptions = RNTabRouterOptions & {\n triggerMap: TriggerMap;\n};\n\nexport type ExpoTabsResetValue = 'always' | 'onFocus' | 'never';\n\nexport type ExpoTabActionType =\n | RNTabActionType\n | CommonNavigationAction\n | {\n type: 'JUMP_TO';\n source?: string;\n target?: string;\n payload: {\n name: string;\n reset?: ExpoTabsResetValue;\n params?: object;\n };\n };\n\nexport function ExpoTabRouter({ triggerMap, ...options }: ExpoTabRouterOptions) {\n const rnTabRouter = RNTabRouter(options);\n\n const router: Router<\n TabNavigationState<ParamListBase>,\n ExpoTabActionType | CommonNavigationAction\n > = {\n ...rnTabRouter,\n getStateForAction(state, action, options) {\n if (action.type !== 'JUMP_TO') {\n return rnTabRouter.getStateForAction(state, action, options);\n }\n\n const name = action.payload.name;\n const trigger = triggerMap[name];\n\n if (!trigger) {\n // This is probably for a different navigator\n return null;\n } else if (trigger.type === 'external') {\n Linking.openURL(trigger.href);\n return state;\n }\n\n const route = state.routes.find((route) => route.name === trigger.routeNode.route);\n\n if (!route) {\n // This shouldn't occur, but lets just hand it off to the next navigator in case.\n return null;\n }\n\n // We should reset if this is the first time visiting the route\n let shouldReset = !state.history.some((item) => item.key === route?.key) && !route.state;\n\n if (!shouldReset && 'reset' in action.payload && action.payload.reset) {\n switch (action.payload.reset) {\n case 'never': {\n shouldReset = false;\n break;\n }\n case 'always': {\n shouldReset = true;\n break;\n }\n case 'onFocus': {\n shouldReset = state.routes[state.index].key === route.key;\n break;\n }\n default: {\n // TypeScript trick to ensure all use-cases are accounted for\n action.payload.reset satisfies never;\n }\n }\n }\n\n if (shouldReset) {\n options.routeParamList[route.name] = {\n ...options.routeParamList[route.name],\n ...trigger.action.payload.params,\n };\n return rnTabRouter.getStateForAction(state, trigger.action, options);\n } else {\n return rnTabRouter.getStateForRouteFocus(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,CAAC,GAAG;oBACnC,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;iBACtC,CAAC;gBACF,KAAK,GAAG;oBACN,GAAG,KAAK;oBACR,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBAC7B,IAAI,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC;4BACxB,OAAO,CAAC,CAAC;wBACX,CAAC;wBACD,OAAO,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;oBACpC,CAAC,CAAC;iBACH,CAAC;gBACF,OAAO,WAAW,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACN,OAAO,WAAW,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n CommonNavigationAction,\n ParamListBase,\n TabRouter as RNTabRouter,\n Router,\n TabActionType as RNTabActionType,\n TabNavigationState,\n TabRouterOptions as RNTabRouterOptions,\n} from '@react-navigation/native';\n\nimport { TriggerMap } from './common';\n\nexport type ExpoTabRouterOptions = RNTabRouterOptions & {\n triggerMap: TriggerMap;\n};\n\nexport type ExpoTabActionType =\n | RNTabActionType\n | CommonNavigationAction\n | {\n type: 'JUMP_TO';\n source?: string;\n target?: string;\n payload: {\n name: string;\n resetOnFocus?: boolean;\n params?: object;\n };\n };\n\nexport function ExpoTabRouter(options: ExpoTabRouterOptions) {\n const rnTabRouter = RNTabRouter(options);\n\n const router: Router<\n TabNavigationState<ParamListBase>,\n ExpoTabActionType | CommonNavigationAction\n > = {\n ...rnTabRouter,\n getStateForAction(state, action, options) {\n if (action.type !== 'JUMP_TO') {\n return rnTabRouter.getStateForAction(state, action, options);\n }\n\n const route = state.routes.find((route) => route.name === action.payload.name);\n\n if (!route) {\n // This shouldn't occur, but lets just hand it off to the next navigator in case.\n return null;\n }\n\n // We should reset if this is the first time visiting the route\n let shouldReset = !state.history.some((item) => item.key === route?.key) && !route.state;\n\n if (!shouldReset && 'resetOnFocus' in action.payload && action.payload.resetOnFocus) {\n shouldReset = state.routes[state.index].key !== route.key;\n }\n\n if (shouldReset) {\n options.routeParamList[route.name] = {\n ...options.routeParamList[route.name],\n };\n state = {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route.key) {\n return r;\n }\n return { ...r, state: undefined };\n }),\n };\n return rnTabRouter.getStateForAction(state, action, options);\n } else {\n return rnTabRouter.getStateForRouteFocus(state, route.key);\n }\n },\n };\n\n return router;\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import { TabNavigationState } from '@react-navigation/native';
2
2
  import { ReactNode, ReactElement, ComponentProps } from 'react';
3
3
  import { View, PressableProps } from 'react-native';
4
- import { ExpoTabsResetValue } from './TabRouter';
5
4
  import type { TriggerMap } from './common';
6
5
  import type { Href } from '../types';
7
6
  type PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {
@@ -24,7 +23,7 @@ export type TabTriggerProps = PressablePropsWithoutFunctionChildren & {
24
23
  /**
25
24
  * Resets the route when switching to a tab.
26
25
  */
27
- reset?: SwitchToOptions['reset'] | 'onLongPress';
26
+ resetOnFocus?: boolean;
28
27
  };
29
28
  export type TabTriggerOptions = {
30
29
  name: string;
@@ -51,7 +50,7 @@ export type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren & React.
51
50
  * </Tabs>
52
51
  * ```
53
52
  */
54
- export declare function TabTrigger({ asChild, name, href, reset, ...props }: TabTriggerProps): import("react").JSX.Element;
53
+ export declare function TabTrigger({ asChild, name, href, resetOnFocus, ...props }: TabTriggerProps): import("react").JSX.Element;
55
54
  /**
56
55
  * @hidden
57
56
  */
@@ -61,9 +60,9 @@ export declare function isTabTrigger(child: ReactElement<any>): child is ReactEl
61
60
  */
62
61
  export type SwitchToOptions = {
63
62
  /**
64
- * Navigate and reset the history.
63
+ * Navigate and reset the history on route focus.
65
64
  */
66
- reset?: ExpoTabsResetValue;
65
+ resetOnFocus?: boolean;
67
66
  };
68
67
  export type Trigger = TriggerMap[string] & {
69
68
  isFocused: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"TabTrigger.d.ts","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAO,YAAY,EAAE,cAAc,EAAe,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,IAAI,EAAyB,cAAc,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC,KAAK,qCAAqC,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,qCAAqC,GAAG;IACpE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qCAAqC,GACrE,KAAK,CAAC,aAAa,CAAC,IA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CAC1B,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GACvB,KAAK,IAAI,YAAY,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,CAE1D;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACnC,WAAW,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAyG3E"}
@@ -30,10 +30,10 @@ const TabTriggerSlot = react_slot_1.Slot;
30
30
  * </Tabs>
31
31
  * ```
32
32
  */
33
- function TabTrigger({ asChild, name, href, reset = 'onFocus', ...props }) {
33
+ function TabTrigger({ asChild, name, href, resetOnFocus, ...props }) {
34
34
  const { trigger, triggerProps } = useTabTrigger({
35
35
  name,
36
- reset,
36
+ resetOnFocus,
37
37
  ...props,
38
38
  });
39
39
  // Pressable doesn't accept the extra props, so only pass them if we are using asChild
@@ -61,7 +61,7 @@ function isTabTrigger(child) {
61
61
  */
62
62
  function useTabTrigger(options) {
63
63
  const { state, navigation } = (0, Navigator_1.useNavigatorContext)();
64
- const { name, reset, onPress, onLongPress } = options;
64
+ const { name, resetOnFocus, onPress, onLongPress } = options;
65
65
  const triggerMap = (0, react_1.use)(TabContext_1.TabTriggerMapContext);
66
66
  const getTrigger = (0, react_1.useCallback)((name) => {
67
67
  const config = triggerMap[name];
@@ -84,9 +84,10 @@ function useTabTrigger(options) {
84
84
  }
85
85
  else {
86
86
  return navigation?.dispatch({
87
+ ...config.action,
87
88
  type: 'JUMP_TO',
88
89
  payload: {
89
- name,
90
+ ...config.action.payload,
90
91
  ...options,
91
92
  },
92
93
  });
@@ -114,8 +115,8 @@ function useTabTrigger(options) {
114
115
  });
115
116
  if (!(0, useLinkToPathProps_1.shouldHandleMouseEvent)(event))
116
117
  return;
117
- switchTab(name, { reset: reset !== 'onLongPress' ? reset : undefined });
118
- }, [onPress, name, reset, trigger]);
118
+ switchTab(name, { resetOnFocus });
119
+ }, [onPress, name, resetOnFocus, trigger]);
119
120
  const handleOnLongPress = (0, react_1.useCallback)((event) => {
120
121
  onLongPress?.(event);
121
122
  if (!trigger)
@@ -129,9 +130,9 @@ function useTabTrigger(options) {
129
130
  if (!(0, useLinkToPathProps_1.shouldHandleMouseEvent)(event))
130
131
  return;
131
132
  switchTab(name, {
132
- reset: reset === 'onLongPress' ? 'always' : reset,
133
+ resetOnFocus,
133
134
  });
134
- }, [onLongPress, name, reset, trigger]);
135
+ }, [onLongPress, name, resetOnFocus, trigger]);
135
136
  const triggerProps = {
136
137
  isFocused: Boolean(trigger?.isFocused),
137
138
  onPress: handleOnPress,
@@ -1 +1 @@
1
- {"version":3,"file":"TabTrigger.js","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":";;AAqEA,gCA4BC;AAKD,oCAIC;AAkCD,sCAwGC;AApPD,qDAA4C;AA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AAE,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI;SACxE,CAAC,CAAC;QAEH,IAAI,CAAC,IAAA,2CAAsB,EAAC,KAAK,CAAC;YAAE,OAAO;QAE3C,SAAS,CAAC,IAAI,EAAE;YACd,KAAK,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;SAClD,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CACpC,CAAC;IAEF,MAAM,YAAY,GAAG;QACnB,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QACtC,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,iBAAiB;KAC/B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,UAAU;QACV,OAAO;QACP,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { TabNavigationState } from '@react-navigation/native';\nimport { ReactNode, use, ReactElement, ComponentProps, useCallback } from 'react';\nimport { View, StyleSheet, Pressable, PressableProps } from 'react-native';\n\nimport { TabTriggerMapContext } from './TabContext';\nimport { ExpoTabsResetValue } from './TabRouter';\nimport type { TriggerMap } from './common';\nimport { appendBaseUrl } from '../fork/getPathFromState';\nimport { router } from '../imperative-api';\nimport { shouldHandleMouseEvent } from '../link/useLinkToPathProps';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport type { Href } from '../types';\nimport { useNavigatorContext } from '../views/Navigator';\n\ntype PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {\n children?: ReactNode | undefined;\n};\n\nexport type TabTriggerProps = PressablePropsWithoutFunctionChildren & {\n /**\n * Name of tab. When used within a `TabList` this sets the name of the tab.\n * Otherwise, this references the name.\n */\n name: string;\n /**\n * Name of tab. Required when used within a `TabList`.\n */\n href?: Href;\n /**\n * Forward props to child component. Useful for custom wrappers.\n */\n asChild?: boolean;\n /**\n * Resets the route when switching to a tab.\n */\n reset?: SwitchToOptions['reset'] | 'onLongPress';\n};\n\nexport type TabTriggerOptions = {\n name: string;\n href: Href;\n};\n\nexport type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren &\n React.RefAttributes<View> & {\n isFocused?: boolean;\n href?: string;\n };\n\nconst TabTriggerSlot = Slot as React.ForwardRefExoticComponent<TabTriggerSlotProps>;\n\n/**\n * Creates a trigger to navigate to a tab. When used as child of `TabList`, its\n * functionality slightly changes since the `href` prop is required,\n * and the trigger also defines what routes are present in the `Tabs`.\n *\n * When used outside of `TabList`, this component no longer requires an `href`.\n *\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabTrigger({ asChild, name, href, reset = 'onFocus', ...props }: TabTriggerProps) {\n const { trigger, triggerProps } = useTabTrigger({\n name,\n reset,\n ...props,\n });\n\n // Pressable doesn't accept the extra props, so only pass them if we are using asChild\n if (asChild) {\n return (\n <TabTriggerSlot\n style={styles.tabTrigger}\n {...props}\n {...triggerProps}\n href={trigger?.resolvedHref}>\n {props.children}\n </TabTriggerSlot>\n );\n } else {\n // These props are not typed, but are allowed by React Native Web\n const reactNativeWebProps = { href: trigger?.resolvedHref };\n\n return (\n <Pressable style={styles.tabTrigger} {...reactNativeWebProps} {...props} {...triggerProps}>\n {props.children}\n </Pressable>\n );\n }\n}\n\n/**\n * @hidden\n */\nexport function isTabTrigger(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabTrigger>> {\n return child.type === TabTrigger;\n}\n\n/**\n * Options for `switchTab` function.\n */\nexport type SwitchToOptions = {\n /**\n * Navigate and reset the history.\n */\n reset?: ExpoTabsResetValue;\n};\n\nexport type Trigger = TriggerMap[string] & {\n isFocused: boolean;\n resolvedHref: string;\n route: TabNavigationState<any>['routes'][number];\n};\n\nexport type UseTabTriggerResult = {\n switchTab: (name: string, options: SwitchToOptions) => void;\n getTrigger: (name: string) => Trigger | undefined;\n trigger?: Trigger;\n triggerProps: TriggerProps;\n};\n\nexport type TriggerProps = {\n isFocused: boolean;\n onPress: PressableProps['onPress'];\n onLongPress: PressableProps['onLongPress'];\n};\n\n/**\n * Utility hook creating custom `TabTrigger`.\n */\nexport function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult {\n const { state, navigation } = useNavigatorContext();\n const { name, reset, onPress, onLongPress } = options;\n const triggerMap = use(TabTriggerMapContext);\n\n const getTrigger = useCallback(\n (name: string) => {\n const config = triggerMap[name];\n\n if (!config) {\n return;\n }\n\n return {\n isFocused: state.index === config.index,\n route: state.routes[config.index],\n resolvedHref: stripGroupSegmentsFromPath(appendBaseUrl(config.href)),\n ...config,\n };\n },\n [triggerMap]\n );\n\n const trigger = name !== undefined ? getTrigger(name) : undefined;\n\n const switchTab = useCallback(\n (name: string, options?: SwitchToOptions) => {\n const config = triggerMap[name];\n\n if (config) {\n if (config.type === 'external') {\n return router.navigate(config.href);\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n ...options,\n },\n });\n }\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n },\n });\n }\n },\n [navigation, triggerMap]\n );\n\n const handleOnPress = useCallback<NonNullable<PressableProps['onPress']>>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n canPreventDefault: true,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, { reset: reset !== 'onLongPress' ? reset : undefined });\n },\n [onPress, name, reset, trigger]\n );\n\n const handleOnLongPress = useCallback<NonNullable<PressableProps['onLongPress']>>(\n (event) => {\n onLongPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabLongPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, {\n reset: reset === 'onLongPress' ? 'always' : reset,\n });\n },\n [onLongPress, name, reset, trigger]\n );\n\n const triggerProps = {\n isFocused: Boolean(trigger?.isFocused),\n onPress: handleOnPress,\n onLongPress: handleOnLongPress,\n };\n\n return {\n switchTab,\n getTrigger,\n trigger,\n triggerProps,\n };\n}\n\nconst styles = StyleSheet.create({\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
1
+ {"version":3,"file":"TabTrigger.js","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":";;AAoEA,gCA4BC;AAKD,oCAIC;AAkCD,sCAyGC;AApPD,qDAA4C;AAE5C,iCAAkF;AAClF,+CAA2E;AAE3E,6CAAoD;AAEpD,+DAAyD;AACzD,sDAA2C;AAC3C,mEAAoE;AACpE,0CAAyD;AAEzD,kDAAyD;AAqCzD,MAAM,cAAc,GAAG,iBAA4D,CAAC;AAEpF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,KAAK,EAAmB;IACzF,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;QAC9C,IAAI;QACJ,YAAY;QACZ,GAAG,KAAK;KACT,CAAC,CAAC;IAEH,sFAAsF;IACtF,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,CAAC,cAAc,CACb,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CACzB,IAAI,KA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AAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { TabNavigationState } from '@react-navigation/native';\nimport { ReactNode, use, ReactElement, ComponentProps, useCallback } from 'react';\nimport { View, StyleSheet, Pressable, PressableProps } from 'react-native';\n\nimport { TabTriggerMapContext } from './TabContext';\nimport type { TriggerMap } from './common';\nimport { appendBaseUrl } from '../fork/getPathFromState';\nimport { router } from '../imperative-api';\nimport { shouldHandleMouseEvent } from '../link/useLinkToPathProps';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport type { Href } from '../types';\nimport { useNavigatorContext } from '../views/Navigator';\n\ntype PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {\n children?: ReactNode | undefined;\n};\n\nexport type TabTriggerProps = PressablePropsWithoutFunctionChildren & {\n /**\n * Name of tab. When used within a `TabList` this sets the name of the tab.\n * Otherwise, this references the name.\n */\n name: string;\n /**\n * Name of tab. Required when used within a `TabList`.\n */\n href?: Href;\n /**\n * Forward props to child component. Useful for custom wrappers.\n */\n asChild?: boolean;\n /**\n * Resets the route when switching to a tab.\n */\n resetOnFocus?: boolean;\n};\n\nexport type TabTriggerOptions = {\n name: string;\n href: Href;\n};\n\nexport type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren &\n React.RefAttributes<View> & {\n isFocused?: boolean;\n href?: string;\n };\n\nconst TabTriggerSlot = Slot as React.ForwardRefExoticComponent<TabTriggerSlotProps>;\n\n/**\n * Creates a trigger to navigate to a tab. When used as child of `TabList`, its\n * functionality slightly changes since the `href` prop is required,\n * and the trigger also defines what routes are present in the `Tabs`.\n *\n * When used outside of `TabList`, this component no longer requires an `href`.\n *\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabTrigger({ asChild, name, href, resetOnFocus, ...props }: TabTriggerProps) {\n const { trigger, triggerProps } = useTabTrigger({\n name,\n resetOnFocus,\n ...props,\n });\n\n // Pressable doesn't accept the extra props, so only pass them if we are using asChild\n if (asChild) {\n return (\n <TabTriggerSlot\n style={styles.tabTrigger}\n {...props}\n {...triggerProps}\n href={trigger?.resolvedHref}>\n {props.children}\n </TabTriggerSlot>\n );\n } else {\n // These props are not typed, but are allowed by React Native Web\n const reactNativeWebProps = { href: trigger?.resolvedHref };\n\n return (\n <Pressable style={styles.tabTrigger} {...reactNativeWebProps} {...props} {...triggerProps}>\n {props.children}\n </Pressable>\n );\n }\n}\n\n/**\n * @hidden\n */\nexport function isTabTrigger(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabTrigger>> {\n return child.type === TabTrigger;\n}\n\n/**\n * Options for `switchTab` function.\n */\nexport type SwitchToOptions = {\n /**\n * Navigate and reset the history on route focus.\n */\n resetOnFocus?: boolean;\n};\n\nexport type Trigger = TriggerMap[string] & {\n isFocused: boolean;\n resolvedHref: string;\n route: TabNavigationState<any>['routes'][number];\n};\n\nexport type UseTabTriggerResult = {\n switchTab: (name: string, options: SwitchToOptions) => void;\n getTrigger: (name: string) => Trigger | undefined;\n trigger?: Trigger;\n triggerProps: TriggerProps;\n};\n\nexport type TriggerProps = {\n isFocused: boolean;\n onPress: PressableProps['onPress'];\n onLongPress: PressableProps['onLongPress'];\n};\n\n/**\n * Utility hook creating custom `TabTrigger`.\n */\nexport function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult {\n const { state, navigation } = useNavigatorContext();\n const { name, resetOnFocus, onPress, onLongPress } = options;\n const triggerMap = use(TabTriggerMapContext);\n\n const getTrigger = useCallback(\n (name: string) => {\n const config = triggerMap[name];\n\n if (!config) {\n return;\n }\n\n return {\n isFocused: state.index === config.index,\n route: state.routes[config.index],\n resolvedHref: stripGroupSegmentsFromPath(appendBaseUrl(config.href)),\n ...config,\n };\n },\n [triggerMap]\n );\n\n const trigger = name !== undefined ? getTrigger(name) : undefined;\n\n const switchTab = useCallback(\n (name: string, options?: SwitchToOptions) => {\n const config = triggerMap[name];\n\n if (config) {\n if (config.type === 'external') {\n return router.navigate(config.href);\n } else {\n return navigation?.dispatch({\n ...config.action,\n type: 'JUMP_TO',\n payload: {\n ...config.action.payload,\n ...options,\n },\n });\n }\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n },\n });\n }\n },\n [navigation, triggerMap]\n );\n\n const handleOnPress = useCallback<NonNullable<PressableProps['onPress']>>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n canPreventDefault: true,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, { resetOnFocus });\n },\n [onPress, name, resetOnFocus, trigger]\n );\n\n const handleOnLongPress = useCallback<NonNullable<PressableProps['onLongPress']>>(\n (event) => {\n onLongPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabLongPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, {\n resetOnFocus,\n });\n },\n [onLongPress, name, resetOnFocus, trigger]\n );\n\n const triggerProps = {\n isFocused: Boolean(trigger?.isFocused),\n onPress: handleOnPress,\n onLongPress: handleOnLongPress,\n };\n\n return {\n switchTab,\n getTrigger,\n trigger,\n triggerProps,\n };\n}\n\nconst styles = StyleSheet.create({\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
@@ -7,7 +7,6 @@ export * from './TabContext';
7
7
  export * from './TabList';
8
8
  export * from './TabSlot';
9
9
  export * from './TabTrigger';
10
- export { ExpoTabsResetValue } from './TabRouter';
11
10
  /**
12
11
  * Options to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E;QACR,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["import {\n DefaultNavigatorOptions,\n LinkingContext,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n Children,\n ComponentProps,\n Fragment,\n ReactElement,\n ReactNode,\n isValidElement,\n use,\n useMemo,\n PropsWithChildren,\n} from 'react';\nimport { StyleSheet, ViewProps, View } from 'react-native';\n\nimport {\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n TabTriggerMapContext,\n TabsContextValue,\n} from './TabContext';\nimport { isTabList } from './TabList';\nimport { ExpoTabRouter, ExpoTabRouterOptions } from './TabRouter';\nimport { isTabSlot } from './TabSlot';\nimport { isTabTrigger } from './TabTrigger';\nimport { ViewSlot, ScreenTrigger, triggersToScreens } from './common';\nimport { useComponent } from './useComponent';\nimport { useRouteNode, useContextKey } from '../Route';\nimport { useRouteInfo } from '../hooks';\nimport { resolveHref } from '../link/href';\nimport { shouldLinkExternally } from '../utils/url';\nimport { NavigatorContext, NavigatorContextValue } from '../views/Navigator';\n\nexport * from './TabContext';\nexport * from './TabList';\nexport * from './TabSlot';\nexport * from './TabTrigger';\nexport { ExpoTabsResetValue } from './TabRouter';\n\n/**\n * Options to provide to the Tab Router.\n */\nexport type UseTabsOptions = Omit<\n DefaultNavigatorOptions<\n ParamListBase,\n any,\n TabNavigationState<any>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n any\n >,\n 'children'\n> & {\n backBehavior?: TabRouterOptions['backBehavior'];\n};\n\nexport type TabsProps = ViewProps & {\n /** Forward props to child component and removes the extra `<View>`. Useful for custom wrappers. */\n asChild?: boolean;\n options?: UseTabsOptions;\n};\n\n/**\n * Root component for the headless tabs.\n *\n * @see [`useTabsWithChildren`](#usetabswithchildrenoptions) for a hook version of this component.\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function Tabs(props: TabsProps) {\n const { children, asChild, options, ...rest } = props;\n const Comp = asChild ? ViewSlot : View;\n\n const { NavigationContent } = useTabsWithChildren({\n // asChild adds an extra layer, so we need to process the child's children\n children:\n asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ? (children.props.children as ReactNode)\n : children,\n ...options,\n });\n\n return (\n <Comp style={styles.tabsRoot} {...rest}>\n <NavigationContent>{children}</NavigationContent>\n </Comp>\n );\n}\n\n// @docsMissing\nexport type UseTabsWithChildrenOptions = PropsWithChildren<UseTabsOptions>;\n\n// @docsMissing\nexport type UseTabsWithTriggersOptions = UseTabsOptions & {\n triggers: ScreenTrigger[];\n};\n\n/**\n * Hook version of `Tabs`. The returned NavigationContent component\n * should be rendered. Using the hook requires using the `<TabList />`\n * and `<TabTrigger />` components exported from Expo Router.\n *\n * The `useTabsWithTriggers()` hook can be used for custom components.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ children })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithChildren(options: UseTabsWithChildrenOptions) {\n const { children, ...rest } = options;\n return useTabsWithTriggers({ triggers: parseTriggersFromChildren(children), ...rest });\n}\n\n/**\n * Alternative hook version of `Tabs` that uses explicit triggers\n * instead of `children`.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ triggers: [] })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithTriggers(options: UseTabsWithTriggersOptions): TabsContextValue {\n const { triggers, ...rest } = options;\n // Ensure we extend the parent triggers, so we can trigger them as well\n const parentTriggerMap = use(TabTriggerMapContext);\n const routeNode = useRouteNode();\n const contextKey = useContextKey();\n const linking = use(LinkingContext).options;\n const routeInfo = useRouteInfo();\n\n if (!routeNode || !linking) {\n throw new Error('No RouteNode. This is likely a bug in expo-router.');\n }\n\n const initialRouteName = routeNode.initialRouteName;\n\n const { children, triggerMap } = triggersToScreens(\n triggers,\n routeNode,\n linking,\n initialRouteName,\n parentTriggerMap,\n routeInfo,\n contextKey\n );\n\n const navigatorContext = useNavigationBuilder<\n TabNavigationState<any>,\n ExpoTabRouterOptions,\n TabActionHelpers<ParamListBase>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap\n >(ExpoTabRouter, {\n children,\n ...rest,\n triggerMap,\n id: contextKey,\n initialRouteName,\n });\n\n const {\n state,\n descriptors,\n navigation,\n describe,\n NavigationContent: RNNavigationContent,\n } = navigatorContext;\n\n const navigatorContextValue = useMemo<NavigatorContextValue>(\n () => ({\n ...(navigatorContext as unknown as ReturnType<typeof useNavigationBuilder>),\n contextKey,\n router: ExpoTabRouter,\n }),\n [navigatorContext, contextKey, ExpoTabRouter]\n );\n\n const NavigationContent = useComponent((children: React.ReactNode) => (\n <TabTriggerMapContext.Provider value={triggerMap}>\n <NavigatorContext.Provider value={navigatorContextValue}>\n <RNNavigationContent>{children}</RNNavigationContent>\n </NavigatorContext.Provider>\n </TabTriggerMapContext.Provider>\n )) as TabsContextValue['NavigationContent'];\n\n return { state, descriptors, navigation, NavigationContent, describe };\n}\n\nfunction parseTriggersFromChildren(\n children: ReactNode,\n screenTriggers: ScreenTrigger[] = [],\n isInTabList = false\n) {\n Children.forEach(children, (child) => {\n if (!child || !isValidElement(child) || isTabSlot(child)) {\n return;\n }\n\n if (isFragment(child) && typeof child.props.children !== 'function') {\n return parseTriggersFromChildren(\n child.props.children,\n screenTriggers,\n isInTabList || isTabList(child)\n );\n }\n\n if (isTabList(child) && typeof child.props.children !== 'function') {\n let children = child.props.children;\n\n // <TabList asChild /> adds an extra layer. We need to parse the child's children\n if (\n child.props.asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ) {\n children = children.props.children as ReactNode;\n }\n\n return parseTriggersFromChildren(children, screenTriggers, isInTabList || isTabList(child));\n }\n\n // We should only process TabTriggers within the TabList. All other components will be ignored\n if (!isInTabList || !isTabTrigger(child)) {\n return;\n }\n\n const { href, name } = child.props;\n\n if (!href) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger name={${name}}> does not have a 'href' prop. TabTriggers within a <TabList /> are required to have an href.`\n );\n }\n return;\n }\n\n const resolvedHref = resolveHref(href);\n\n if (shouldLinkExternally(resolvedHref)) {\n return screenTriggers.push({\n type: 'external',\n name,\n href: resolvedHref,\n });\n }\n\n if (!name) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger> does not have a 'name' prop. TabTriggers within a <TabList /> are required to have a name.`\n );\n }\n return;\n }\n\n return screenTriggers.push({ type: 'internal', href: resolvedHref, name });\n });\n\n return screenTriggers;\n}\n\nfunction isFragment(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof Fragment>> {\n return child.type === Fragment;\n}\n\nconst styles = StyleSheet.create({\n tabsRoot: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/ui/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkFA,oBAsBC;AA2BD,kDAGC;AAgBD,kDAiEC;AAvND,qDAQkC;AAClC,iCAUe;AACf,+CAA2D;AAE3D,6CAKsB;AACtB,uCAAsC;AACtC,2CAAkE;AAClE,uCAAsC;AACtC,6CAA4C;AAC5C,qCAAsE;AACtE,iDAA8C;AAC9C,oCAAuD;AACvD,oCAAwC;AACxC,uCAA2C;AAC3C,sCAAoD;AACpD,kDAA6E;AAE7E,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B;AAC1B,+CAA6B;AAyB7B;;;;;;;;;;;;;GAaG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GA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AC/B,QAAQ,EAAE;QACR,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["import {\n DefaultNavigatorOptions,\n LinkingContext,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n Children,\n ComponentProps,\n Fragment,\n ReactElement,\n ReactNode,\n isValidElement,\n use,\n useMemo,\n PropsWithChildren,\n} from 'react';\nimport { StyleSheet, ViewProps, View } from 'react-native';\n\nimport {\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n TabTriggerMapContext,\n TabsContextValue,\n} from './TabContext';\nimport { isTabList } from './TabList';\nimport { ExpoTabRouter, ExpoTabRouterOptions } from './TabRouter';\nimport { isTabSlot } from './TabSlot';\nimport { isTabTrigger } from './TabTrigger';\nimport { ViewSlot, ScreenTrigger, triggersToScreens } from './common';\nimport { useComponent } from './useComponent';\nimport { useRouteNode, useContextKey } from '../Route';\nimport { useRouteInfo } from '../hooks';\nimport { resolveHref } from '../link/href';\nimport { shouldLinkExternally } from '../utils/url';\nimport { NavigatorContext, NavigatorContextValue } from '../views/Navigator';\n\nexport * from './TabContext';\nexport * from './TabList';\nexport * from './TabSlot';\nexport * from './TabTrigger';\n\n/**\n * Options to provide to the Tab Router.\n */\nexport type UseTabsOptions = Omit<\n DefaultNavigatorOptions<\n ParamListBase,\n any,\n TabNavigationState<any>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n any\n >,\n 'children'\n> & {\n backBehavior?: TabRouterOptions['backBehavior'];\n};\n\nexport type TabsProps = ViewProps & {\n /** Forward props to child component and removes the extra `<View>`. Useful for custom wrappers. */\n asChild?: boolean;\n options?: UseTabsOptions;\n};\n\n/**\n * Root component for the headless tabs.\n *\n * @see [`useTabsWithChildren`](#usetabswithchildrenoptions) for a hook version of this component.\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function Tabs(props: TabsProps) {\n const { children, asChild, options, ...rest } = props;\n const Comp = asChild ? ViewSlot : View;\n\n const { NavigationContent } = useTabsWithChildren({\n // asChild adds an extra layer, so we need to process the child's children\n children:\n asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ? (children.props.children as ReactNode)\n : children,\n ...options,\n });\n\n return (\n <Comp style={styles.tabsRoot} {...rest}>\n <NavigationContent>{children}</NavigationContent>\n </Comp>\n );\n}\n\n// @docsMissing\nexport type UseTabsWithChildrenOptions = PropsWithChildren<UseTabsOptions>;\n\n// @docsMissing\nexport type UseTabsWithTriggersOptions = UseTabsOptions & {\n triggers: ScreenTrigger[];\n};\n\n/**\n * Hook version of `Tabs`. The returned NavigationContent component\n * should be rendered. Using the hook requires using the `<TabList />`\n * and `<TabTrigger />` components exported from Expo Router.\n *\n * The `useTabsWithTriggers()` hook can be used for custom components.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ children })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithChildren(options: UseTabsWithChildrenOptions) {\n const { children, ...rest } = options;\n return useTabsWithTriggers({ triggers: parseTriggersFromChildren(children), ...rest });\n}\n\n/**\n * Alternative hook version of `Tabs` that uses explicit triggers\n * instead of `children`.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ triggers: [] })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithTriggers(options: UseTabsWithTriggersOptions): TabsContextValue {\n const { triggers, ...rest } = options;\n // Ensure we extend the parent triggers, so we can trigger them as well\n const parentTriggerMap = use(TabTriggerMapContext);\n const routeNode = useRouteNode();\n const contextKey = useContextKey();\n const linking = use(LinkingContext).options;\n const routeInfo = useRouteInfo();\n\n if (!routeNode || !linking) {\n throw new Error('No RouteNode. This is likely a bug in expo-router.');\n }\n\n const initialRouteName = routeNode.initialRouteName;\n\n const { children, triggerMap } = triggersToScreens(\n triggers,\n routeNode,\n linking,\n initialRouteName,\n parentTriggerMap,\n routeInfo,\n contextKey\n );\n\n const navigatorContext = useNavigationBuilder<\n TabNavigationState<any>,\n ExpoTabRouterOptions,\n TabActionHelpers<ParamListBase>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap\n >(ExpoTabRouter, {\n children,\n ...rest,\n triggerMap,\n id: contextKey,\n initialRouteName,\n });\n\n const {\n state,\n descriptors,\n navigation,\n describe,\n NavigationContent: RNNavigationContent,\n } = navigatorContext;\n\n const navigatorContextValue = useMemo<NavigatorContextValue>(\n () => ({\n ...(navigatorContext as unknown as ReturnType<typeof useNavigationBuilder>),\n contextKey,\n router: ExpoTabRouter,\n }),\n [navigatorContext, contextKey, ExpoTabRouter]\n );\n\n const NavigationContent = useComponent((children: React.ReactNode) => (\n <TabTriggerMapContext.Provider value={triggerMap}>\n <NavigatorContext.Provider value={navigatorContextValue}>\n <RNNavigationContent>{children}</RNNavigationContent>\n </NavigatorContext.Provider>\n </TabTriggerMapContext.Provider>\n )) as TabsContextValue['NavigationContent'];\n\n return { state, descriptors, navigation, NavigationContent, describe };\n}\n\nfunction parseTriggersFromChildren(\n children: ReactNode,\n screenTriggers: ScreenTrigger[] = [],\n isInTabList = false\n) {\n Children.forEach(children, (child) => {\n if (!child || !isValidElement(child) || isTabSlot(child)) {\n return;\n }\n\n if (isFragment(child) && typeof child.props.children !== 'function') {\n return parseTriggersFromChildren(\n child.props.children,\n screenTriggers,\n isInTabList || isTabList(child)\n );\n }\n\n if (isTabList(child) && typeof child.props.children !== 'function') {\n let children = child.props.children;\n\n // <TabList asChild /> adds an extra layer. We need to parse the child's children\n if (\n child.props.asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ) {\n children = children.props.children as ReactNode;\n }\n\n return parseTriggersFromChildren(children, screenTriggers, isInTabList || isTabList(child));\n }\n\n // We should only process TabTriggers within the TabList. All other components will be ignored\n if (!isInTabList || !isTabTrigger(child)) {\n return;\n }\n\n const { href, name } = child.props;\n\n if (!href) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger name={${name}}> does not have a 'href' prop. TabTriggers within a <TabList /> are required to have an href.`\n );\n }\n return;\n }\n\n const resolvedHref = resolveHref(href);\n\n if (shouldLinkExternally(resolvedHref)) {\n return screenTriggers.push({\n type: 'external',\n name,\n href: resolvedHref,\n });\n }\n\n if (!name) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger> does not have a 'name' prop. TabTriggers within a <TabList /> are required to have a name.`\n );\n }\n return;\n }\n\n return screenTriggers.push({ type: 'internal', href: resolvedHref, name });\n });\n\n return screenTriggers;\n}\n\nfunction isFragment(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof Fragment>> {\n return child.type === Fragment;\n}\n\nconst styles = StyleSheet.create({\n tabsRoot: {\n flex: 1,\n },\n});\n"]}
package/html.js CHANGED
@@ -1 +1 @@
1
- export { ScrollViewStyleReset } from './build/static/html';
1
+ export { ScrollViewStyleReset } from './build/static/html';
@@ -0,0 +1 @@
1
+ export * from '../build/internal/routing';
@@ -0,0 +1 @@
1
+ module.exports = require('../build/internal/routing');
@@ -0,0 +1 @@
1
+ export * from '../build/internal/rsc';
@@ -0,0 +1 @@
1
+ module.exports = require('../build/internal/rsc');
@@ -0,0 +1 @@
1
+ export * from '../build/internal/static';