expo-router 7.0.0-canary-20260113-4879b86 → 7.0.0-canary-20260119-70f7c28

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 (242) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/ExpoRoot.d.ts.map +1 -1
  3. package/build/ExpoRoot.js +2 -0
  4. package/build/ExpoRoot.js.map +1 -1
  5. package/build/global.d.ts +29 -0
  6. package/build/global.d.ts.map +1 -0
  7. package/build/global.js +3 -0
  8. package/build/global.js.map +1 -0
  9. package/build/index.d.ts +1 -0
  10. package/build/index.d.ts.map +1 -1
  11. package/build/index.js +1 -0
  12. package/build/index.js.map +1 -1
  13. package/build/layouts/Stack.d.ts.map +1 -1
  14. package/build/layouts/Stack.js +3 -0
  15. package/build/layouts/Stack.js.map +1 -1
  16. package/build/layouts/Stack.web.js +1 -0
  17. package/build/layouts/Stack.web.js.map +1 -1
  18. package/build/layouts/StackClient.d.ts +13 -14
  19. package/build/layouts/StackClient.d.ts.map +1 -1
  20. package/build/layouts/StackClient.js +3 -2
  21. package/build/layouts/StackClient.js.map +1 -1
  22. package/build/layouts/stack-utils/StackHeaderComponent.d.ts +12 -23
  23. package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -1
  24. package/build/layouts/stack-utils/StackHeaderComponent.js +15 -55
  25. package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
  26. package/build/layouts/stack-utils/StackScreen.d.ts +5 -0
  27. package/build/layouts/stack-utils/StackScreen.d.ts.map +1 -1
  28. package/build/layouts/stack-utils/StackScreen.js +34 -7
  29. package/build/layouts/stack-utils/StackScreen.js.map +1 -1
  30. package/build/layouts/stack-utils/StackSearchBar.d.ts +28 -0
  31. package/build/layouts/stack-utils/StackSearchBar.d.ts.map +1 -1
  32. package/build/layouts/stack-utils/StackSearchBar.js +29 -0
  33. package/build/layouts/stack-utils/StackSearchBar.js.map +1 -1
  34. package/build/layouts/stack-utils/common-primitives.d.ts +6 -6
  35. package/build/layouts/stack-utils/common-primitives.d.ts.map +1 -1
  36. package/build/layouts/stack-utils/common-primitives.js +4 -4
  37. package/build/layouts/stack-utils/common-primitives.js.map +1 -1
  38. package/build/layouts/stack-utils/index.d.ts +4 -23
  39. package/build/layouts/stack-utils/index.d.ts.map +1 -1
  40. package/build/layouts/stack-utils/index.js +18 -35
  41. package/build/layouts/stack-utils/index.js.map +1 -1
  42. package/build/layouts/stack-utils/screen/StackScreenBackButton.d.ts +68 -0
  43. package/build/layouts/stack-utils/screen/StackScreenBackButton.d.ts.map +1 -0
  44. package/build/layouts/stack-utils/screen/StackScreenBackButton.js +58 -0
  45. package/build/layouts/stack-utils/screen/StackScreenBackButton.js.map +1 -0
  46. package/build/layouts/stack-utils/screen/StackScreenTitle.d.ts +58 -0
  47. package/build/layouts/stack-utils/screen/StackScreenTitle.d.ts.map +1 -0
  48. package/build/layouts/stack-utils/screen/StackScreenTitle.js +75 -0
  49. package/build/layouts/stack-utils/screen/StackScreenTitle.js.map +1 -0
  50. package/build/layouts/stack-utils/screen/index.d.ts +3 -0
  51. package/build/layouts/stack-utils/screen/index.d.ts.map +1 -0
  52. package/build/layouts/stack-utils/screen/index.js +10 -0
  53. package/build/layouts/stack-utils/screen/index.js.map +1 -0
  54. package/build/layouts/stack-utils/shared.js +3 -3
  55. package/build/layouts/stack-utils/shared.js.map +1 -1
  56. package/build/layouts/stack-utils/toolbar/StackToolbar.d.ts +3 -0
  57. package/build/layouts/stack-utils/toolbar/StackToolbar.d.ts.map +1 -0
  58. package/build/layouts/stack-utils/toolbar/StackToolbar.js +24 -0
  59. package/build/layouts/stack-utils/toolbar/StackToolbar.js.map +1 -0
  60. package/build/layouts/stack-utils/toolbar/StackToolbarButton.d.ts +144 -0
  61. package/build/layouts/stack-utils/toolbar/StackToolbarButton.d.ts.map +1 -0
  62. package/build/layouts/stack-utils/toolbar/StackToolbarButton.js +68 -0
  63. package/build/layouts/stack-utils/toolbar/StackToolbarButton.js.map +1 -0
  64. package/build/layouts/stack-utils/toolbar/StackToolbarClient.d.ts +104 -0
  65. package/build/layouts/stack-utils/toolbar/StackToolbarClient.d.ts.map +1 -0
  66. package/build/layouts/stack-utils/toolbar/StackToolbarClient.js +214 -0
  67. package/build/layouts/stack-utils/toolbar/StackToolbarClient.js.map +1 -0
  68. package/build/layouts/stack-utils/{StackHeaderMenu.d.ts → toolbar/StackToolbarMenu.d.ts} +58 -106
  69. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.d.ts.map +1 -0
  70. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.js +190 -0
  71. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.js.map +1 -0
  72. package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.d.ts +48 -0
  73. package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.d.ts.map +1 -0
  74. package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.js +44 -0
  75. package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.js.map +1 -0
  76. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.d.ts +80 -0
  77. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.d.ts.map +1 -0
  78. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.js +77 -0
  79. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.js.map +1 -0
  80. package/build/layouts/stack-utils/{StackHeaderView.d.ts → toolbar/StackToolbarView.d.ts} +21 -17
  81. package/build/layouts/stack-utils/toolbar/StackToolbarView.d.ts.map +1 -0
  82. package/build/layouts/stack-utils/toolbar/StackToolbarView.js +61 -0
  83. package/build/layouts/stack-utils/toolbar/StackToolbarView.js.map +1 -0
  84. package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.d.ts +93 -0
  85. package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.d.ts.map +1 -0
  86. package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.js +89 -0
  87. package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.js.map +1 -0
  88. package/build/layouts/stack-utils/toolbar/context.d.ts +9 -0
  89. package/build/layouts/stack-utils/toolbar/context.d.ts.map +1 -0
  90. package/build/layouts/stack-utils/toolbar/context.js +16 -0
  91. package/build/layouts/stack-utils/toolbar/context.js.map +1 -0
  92. package/build/layouts/stack-utils/toolbar/index.d.ts +10 -0
  93. package/build/layouts/stack-utils/toolbar/index.d.ts.map +1 -0
  94. package/build/layouts/stack-utils/toolbar/index.js +23 -0
  95. package/build/layouts/stack-utils/toolbar/index.js.map +1 -0
  96. package/build/link/LinkWithPreview.d.ts.map +1 -1
  97. package/build/link/LinkWithPreview.js +8 -5
  98. package/build/link/LinkWithPreview.js.map +1 -1
  99. package/build/link/NativeMenuContext.d.ts +5 -0
  100. package/build/link/NativeMenuContext.d.ts.map +1 -0
  101. package/build/link/NativeMenuContext.js +9 -0
  102. package/build/link/NativeMenuContext.js.map +1 -0
  103. package/build/link/elements.d.ts +41 -0
  104. package/build/link/elements.d.ts.map +1 -1
  105. package/build/link/elements.js +3 -2
  106. package/build/link/elements.js.map +1 -1
  107. package/build/link/preview/native.d.ts +2 -0
  108. package/build/link/preview/native.d.ts.map +1 -1
  109. package/build/link/preview/native.js +3 -1
  110. package/build/link/preview/native.js.map +1 -1
  111. package/build/native-tabs/NativeBottomTabsNavigator.d.ts +1 -1
  112. package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
  113. package/build/native-tabs/NativeBottomTabsNavigator.js +2 -1
  114. package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
  115. package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
  116. package/build/native-tabs/NativeTabTrigger.js +6 -4
  117. package/build/native-tabs/NativeTabTrigger.js.map +1 -1
  118. package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
  119. package/build/native-tabs/NativeTabsView.js +0 -3
  120. package/build/native-tabs/NativeTabsView.js.map +1 -1
  121. package/build/native-tabs/common/elements.d.ts +10 -0
  122. package/build/native-tabs/common/elements.d.ts.map +1 -1
  123. package/build/native-tabs/common/elements.js.map +1 -1
  124. package/build/native-tabs/types.d.ts +6 -0
  125. package/build/native-tabs/types.d.ts.map +1 -1
  126. package/build/native-tabs/types.js.map +1 -1
  127. package/build/native-tabs/utils/icon.d.ts +2 -0
  128. package/build/native-tabs/utils/icon.d.ts.map +1 -1
  129. package/build/native-tabs/utils/icon.js +3 -0
  130. package/build/native-tabs/utils/icon.js.map +1 -1
  131. package/build/navigationEvents/index.d.ts +7 -24
  132. package/build/navigationEvents/index.d.ts.map +1 -1
  133. package/build/navigationEvents/index.js +47 -12
  134. package/build/navigationEvents/index.js.map +1 -1
  135. package/build/navigationEvents/types.d.ts +23 -0
  136. package/build/navigationEvents/types.d.ts.map +1 -0
  137. package/build/navigationEvents/types.js +3 -0
  138. package/build/navigationEvents/types.js.map +1 -0
  139. package/build/navigationEvents/utils.d.ts +9 -0
  140. package/build/navigationEvents/utils.d.ts.map +1 -0
  141. package/build/navigationEvents/utils.js +25 -0
  142. package/build/navigationEvents/utils.js.map +1 -0
  143. package/build/primitives/types.d.ts +6 -6
  144. package/build/primitives/types.d.ts.map +1 -1
  145. package/build/primitives/types.js.map +1 -1
  146. package/build/screensFeatureFlags.d.ts +2 -0
  147. package/build/screensFeatureFlags.d.ts.map +1 -0
  148. package/build/screensFeatureFlags.js +20 -0
  149. package/build/screensFeatureFlags.js.map +1 -0
  150. package/build/split-view/split-view.d.ts.map +1 -1
  151. package/build/split-view/split-view.js +0 -7
  152. package/build/split-view/split-view.js.map +1 -1
  153. package/build/toolbar/native.types.d.ts +0 -14
  154. package/build/toolbar/native.types.d.ts.map +1 -1
  155. package/build/toolbar/native.types.js.map +1 -1
  156. package/build/ui/TabRouter.d.ts +14 -2
  157. package/build/ui/TabRouter.d.ts.map +1 -1
  158. package/build/ui/TabRouter.js +34 -4
  159. package/build/ui/TabRouter.js.map +1 -1
  160. package/build/useScreens.d.ts.map +1 -1
  161. package/build/useScreens.js +30 -15
  162. package/build/useScreens.js.map +1 -1
  163. package/expo-module.config.json +1 -1
  164. package/ios/LinkPreview/LinkPreviewNativeActionView.swift +18 -2
  165. package/ios/LinkPreview/LinkPreviewNativeModule.swift +3 -0
  166. package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +2 -2
  167. package/ios/LinkPreview/LinkZoomTransition.swift +2 -2
  168. package/ios/Toolbar/RouterToolbarHostView.swift +68 -43
  169. package/ios/Toolbar/RouterToolbarItemView.swift +89 -21
  170. package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.module → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module} +7 -7
  171. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.md5 +1 -0
  172. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.sha1 +1 -0
  173. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.sha256 +1 -0
  174. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.sha512 +1 -0
  175. package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.pom → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom} +1 -1
  176. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.md5 +1 -0
  177. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.sha1 +1 -0
  178. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.sha256 +1 -0
  179. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.sha512 +1 -0
  180. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  181. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  182. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  183. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  184. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  185. package/package.json +11 -13
  186. package/plugin/build/index.js +3 -4
  187. package/plugin/options.json +2 -2
  188. package/plugin/src/index.ts +3 -9
  189. package/build/layouts/stack-utils/StackHeaderBackButton.d.ts +0 -14
  190. package/build/layouts/stack-utils/StackHeaderBackButton.d.ts.map +0 -1
  191. package/build/layouts/stack-utils/StackHeaderBackButton.js +0 -19
  192. package/build/layouts/stack-utils/StackHeaderBackButton.js.map +0 -1
  193. package/build/layouts/stack-utils/StackHeaderButton.d.ts +0 -114
  194. package/build/layouts/stack-utils/StackHeaderButton.d.ts.map +0 -1
  195. package/build/layouts/stack-utils/StackHeaderButton.js +0 -49
  196. package/build/layouts/stack-utils/StackHeaderButton.js.map +0 -1
  197. package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts +0 -119
  198. package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts.map +0 -1
  199. package/build/layouts/stack-utils/StackHeaderLeftRight.js +0 -206
  200. package/build/layouts/stack-utils/StackHeaderLeftRight.js.map +0 -1
  201. package/build/layouts/stack-utils/StackHeaderMenu.d.ts.map +0 -1
  202. package/build/layouts/stack-utils/StackHeaderMenu.js +0 -214
  203. package/build/layouts/stack-utils/StackHeaderMenu.js.map +0 -1
  204. package/build/layouts/stack-utils/StackHeaderSpacer.d.ts +0 -46
  205. package/build/layouts/stack-utils/StackHeaderSpacer.d.ts.map +0 -1
  206. package/build/layouts/stack-utils/StackHeaderSpacer.js +0 -44
  207. package/build/layouts/stack-utils/StackHeaderSpacer.js.map +0 -1
  208. package/build/layouts/stack-utils/StackHeaderTitle.d.ts +0 -22
  209. package/build/layouts/stack-utils/StackHeaderTitle.d.ts.map +0 -1
  210. package/build/layouts/stack-utils/StackHeaderTitle.js +0 -36
  211. package/build/layouts/stack-utils/StackHeaderTitle.js.map +0 -1
  212. package/build/layouts/stack-utils/StackHeaderView.d.ts.map +0 -1
  213. package/build/layouts/stack-utils/StackHeaderView.js +0 -56
  214. package/build/layouts/stack-utils/StackHeaderView.js.map +0 -1
  215. package/build/toolbar/elements.d.ts +0 -417
  216. package/build/toolbar/elements.d.ts.map +0 -1
  217. package/build/toolbar/elements.js +0 -188
  218. package/build/toolbar/elements.js.map +0 -1
  219. package/build/toolbar/index.d.ts +0 -42
  220. package/build/toolbar/index.d.ts.map +0 -1
  221. package/build/toolbar/index.js +0 -49
  222. package/build/toolbar/index.js.map +0 -1
  223. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.module.md5 +0 -1
  224. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.module.sha1 +0 -1
  225. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.module.sha256 +0 -1
  226. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.module.sha512 +0 -1
  227. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.pom.md5 +0 -1
  228. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.pom.sha1 +0 -1
  229. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.pom.sha256 +0 -1
  230. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.pom.sha512 +0 -1
  231. package/unstable-toolbar.d.ts +0 -1
  232. package/unstable-toolbar.js +0 -1
  233. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86-sources.jar → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar} +0 -0
  234. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86-sources.jar.md5 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.md5} +0 -0
  235. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86-sources.jar.sha1 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.sha1} +0 -0
  236. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86-sources.jar.sha256 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.sha256} +0 -0
  237. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86-sources.jar.sha512 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.sha512} +0 -0
  238. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.aar → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar} +0 -0
  239. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.aar.md5 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.md5} +0 -0
  240. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.aar.sha1 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.sha1} +0 -0
  241. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.aar.sha256 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.sha256} +0 -0
  242. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260113-4879b86/expo.modules.router-7.0.0-canary-20260113-4879b86.aar.sha512 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.sha512} +0 -0
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StackToolbarMenuAction = exports.StackToolbarMenu = void 0;
5
+ exports.convertStackToolbarMenuPropsToRNHeaderItem = convertStackToolbarMenuPropsToRNHeaderItem;
6
+ exports.convertStackToolbarMenuActionPropsToRNHeaderItem = convertStackToolbarMenuActionPropsToRNHeaderItem;
7
+ const react_1 = require("react");
8
+ const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
9
+ const context_1 = require("./context");
10
+ const primitives_1 = require("../../../primitives");
11
+ const children_1 = require("../../../utils/children");
12
+ const shared_1 = require("../shared");
13
+ /**
14
+ * Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.
15
+ * It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`
16
+ * elements. Menu can be configured using both component props and child
17
+ * elements.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * import { Stack } from 'expo-router';
22
+ * import { Alert } from 'react-native';
23
+ *
24
+ * export default function Page() {
25
+ * return (
26
+ * <>
27
+ * <Stack.Toolbar placement="right">
28
+ * <Stack.Toolbar.Menu icon="ellipsis.circle">
29
+ * <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>
30
+ * Action 1
31
+ * </Stack.Toolbar.MenuAction>
32
+ * </Stack.Toolbar.Menu>
33
+ * </Stack.Toolbar>
34
+ * <ScreenContent />
35
+ * </>
36
+ * );
37
+ * }
38
+ * ```
39
+ *
40
+ * @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.
41
+ *
42
+ * @platform ios
43
+ */
44
+ const StackToolbarMenu = ({ children, ...props }) => {
45
+ const placement = (0, context_1.useToolbarPlacement)();
46
+ const allowedChildren = (0, react_1.useMemo)(() => placement === 'bottom'
47
+ ? [exports.StackToolbarMenu, exports.StackToolbarMenuAction, bottom_toolbar_native_elements_1.NativeToolbarMenu, bottom_toolbar_native_elements_1.NativeToolbarMenuAction]
48
+ : [exports.StackToolbarMenu, exports.StackToolbarMenuAction], [placement]);
49
+ const validChildren = (0, react_1.useMemo)(() => (0, children_1.filterAllowedChildrenElements)(children, allowedChildren), [children, allowedChildren]);
50
+ if (process.env.NODE_ENV !== 'production') {
51
+ const allChildren = react_1.Children.toArray(children);
52
+ if (allChildren.length !== validChildren.length) {
53
+ throw new Error(`Stack.Toolbar.Menu only accepts Stack.Toolbar.Menu and Stack.Toolbar.MenuAction as its children.`);
54
+ }
55
+ }
56
+ if (placement === 'bottom') {
57
+ // TODO(@ubax): Handle image loading using useImage in a follow-up PR.
58
+ return <bottom_toolbar_native_elements_1.NativeToolbarMenu {...props} image={props.image} children={validChildren}/>;
59
+ }
60
+ return <primitives_1.Menu {...props} children={validChildren}/>;
61
+ };
62
+ exports.StackToolbarMenu = StackToolbarMenu;
63
+ function convertStackToolbarMenuPropsToRNHeaderItem(props) {
64
+ if (props.hidden) {
65
+ return undefined;
66
+ }
67
+ const { title, ...rest } = props;
68
+ const actions = react_1.Children.toArray(props.children).filter((child) => (0, children_1.isChildOfType)(child, exports.StackToolbarMenuAction) || (0, children_1.isChildOfType)(child, exports.StackToolbarMenu));
69
+ const item = {
70
+ ...(0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(rest),
71
+ type: 'menu',
72
+ menu: {
73
+ items: actions
74
+ .map((action) => {
75
+ if ((0, children_1.isChildOfType)(action, exports.StackToolbarMenu)) {
76
+ return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);
77
+ }
78
+ return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);
79
+ })
80
+ .filter((i) => !!i),
81
+ },
82
+ };
83
+ if (title) {
84
+ item.menu.title = title;
85
+ }
86
+ return item;
87
+ }
88
+ function convertStackToolbarSubmenuMenuPropsToRNHeaderItem(props) {
89
+ if (props.hidden) {
90
+ return undefined;
91
+ }
92
+ const sharedProps = (0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(props);
93
+ const actions = react_1.Children.toArray(props.children).filter((child) => (0, children_1.isChildOfType)(child, exports.StackToolbarMenuAction) || (0, children_1.isChildOfType)(child, exports.StackToolbarMenu));
94
+ // TODO: Remove Pick<HeaderBarButtonItemSubmenu> when this PR is merged and released in react-navigation:
95
+ // https://github.com/react-navigation/react-navigation/pull/12895
96
+ const item = {
97
+ type: 'submenu',
98
+ items: actions
99
+ .map((action) => {
100
+ if ((0, children_1.isChildOfType)(action, exports.StackToolbarMenu)) {
101
+ return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);
102
+ }
103
+ return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);
104
+ })
105
+ .filter((i) => !!i),
106
+ label: sharedProps.label || props.title || '',
107
+ };
108
+ if (props.inline !== undefined) {
109
+ item.displayInline = props.inline;
110
+ }
111
+ if (props.palette !== undefined) {
112
+ item.displayAsPalette = props.palette;
113
+ }
114
+ if (props.destructive !== undefined) {
115
+ item.destructive = props.destructive;
116
+ }
117
+ // TODO: Add elementSize to react-native-screens
118
+ if (sharedProps.icon) {
119
+ // Only SF Symbols are supported in submenu icons
120
+ // TODO(@ubax): Add support for other images in react-native-screens
121
+ if (sharedProps.icon.type === 'sfSymbol') {
122
+ item.icon = sharedProps.icon;
123
+ }
124
+ else {
125
+ console.warn('When Icon is used inside Stack.Toolbar.Menu used as a submenu, only sfSymbol icons are supported. This is a limitation of React Native Screens.');
126
+ }
127
+ }
128
+ return item;
129
+ }
130
+ /**
131
+ * An action item for a `Stack.Toolbar.Menu`.
132
+ *
133
+ * @example
134
+ * ```tsx
135
+ * import { Stack } from 'expo-router';
136
+ *
137
+ * export default function Page() {
138
+ * return (
139
+ * <>
140
+ * <Stack.Toolbar placement="right">
141
+ * <Stack.Toolbar.Menu icon="ellipsis.circle">
142
+ * <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>
143
+ * Action 1
144
+ * </Stack.Toolbar.MenuAction>
145
+ * </Stack.Toolbar.Menu>
146
+ * </Stack.Toolbar>
147
+ * <ScreenContent />
148
+ * </>
149
+ * );
150
+ * }
151
+ * ```
152
+ *
153
+ * @platform ios
154
+ */
155
+ const StackToolbarMenuAction = (props) => {
156
+ const placement = (0, context_1.useToolbarPlacement)();
157
+ if (placement === 'bottom') {
158
+ // TODO(@ubax): Handle image loading using useImage in a follow-up PR.
159
+ const icon = typeof props.icon === 'string' ? props.icon : undefined;
160
+ return <bottom_toolbar_native_elements_1.NativeToolbarMenuAction {...props} icon={icon} image={props.image}/>;
161
+ }
162
+ return <primitives_1.MenuAction {...props}/>;
163
+ };
164
+ exports.StackToolbarMenuAction = StackToolbarMenuAction;
165
+ function convertStackToolbarMenuActionPropsToRNHeaderItem(props) {
166
+ const { children, isOn, unstable_keepPresented, icon, ...rest } = props;
167
+ const sharedProps = (0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(props);
168
+ const item = {
169
+ ...rest,
170
+ type: 'action',
171
+ label: sharedProps.label,
172
+ state: isOn ? 'on' : 'off',
173
+ onPress: props.onPress ?? (() => { }),
174
+ };
175
+ if (unstable_keepPresented !== undefined) {
176
+ item.keepsMenuPresented = unstable_keepPresented;
177
+ }
178
+ if (sharedProps.icon) {
179
+ // Only SF Symbols are supported in submenu icons
180
+ // TODO(@ubax): Add support for other images in react-native-screens
181
+ if (sharedProps.icon.type === 'sfSymbol') {
182
+ item.icon = sharedProps.icon;
183
+ }
184
+ else {
185
+ console.warn('When Icon is used inside Stack.Toolbar.MenuAction, only sfSymbol icons are supported. This is a limitation of React Native Screens.');
186
+ }
187
+ }
188
+ return item;
189
+ }
190
+ //# sourceMappingURL=StackToolbarMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarMenu.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarMenu.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA8Lb,gGA8BC;AAiJD,4GA2BC;AAjYD,iCAA0D;AAK1D,qFAA8F;AAC9F,uCAAgD;AAChD,oDAAuD;AACvD,sDAAuF;AACvF,sCAGmB;AA2GnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,MAAM,gBAAgB,GAAoC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC1F,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CACH,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EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,qIAAqI,CACtI,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["'use client';\nimport type {\n NativeStackHeaderItemMenu,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n} from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport { Children, useMemo, type ReactNode } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\nimport type { HeaderBarButtonItemSubmenu } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { NativeToolbarMenu, NativeToolbarMenuAction } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport { Menu, MenuAction } from '../../../primitives';\nimport { filterAllowedChildrenElements, isChildOfType } from '../../../utils/children';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarMenuProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * Menu content - can include icons, labels, badges and menu actions.\n *\n * @example\n * ```tsx\n * <Stack.Toolbar.Menu>\n * <Stack.Toolbar.Icon sfSymbol=\"ellipsis.circle\" />\n * <Stack.Toolbar.Label>Options</Stack.Toolbar.Label>\n * <Stack.Toolbar.MenuAction onPress={() => {}}>Action 1</Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * ```\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n disabled?: boolean;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu item.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n /**\n * Whether to hide the shared background.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether the menu should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Icon for the menu item.\n *\n * Can be an SF Symbol name or an image source.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * > **Note**: Inline menus are only supported in submenus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n inline?: boolean;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * > **Note**: Palette menus are only supported in submenus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n palette?: boolean;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StackHeaderItemSharedProps['style'];\n /**\n * The tint color to apply to the button item\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.\n */\n tintColor?: StackHeaderItemSharedProps['tintColor'];\n /**\n * Optional title to show on top of the menu.\n */\n title?: string;\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n // TODO(@ubax): Add elementSize support in react-native-screens for header menus.\n /**\n * The preferred size of the menu elements.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/preferredelementsize) for more information.\n *\n * @platform iOS 16.0+\n */\n elementSize?: 'auto' | 'small' | 'medium' | 'large';\n}\n\n/**\n * Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.\n * It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`\n * elements. Menu can be configured using both component props and child\n * elements.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n * import { Alert } from 'react-native';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.\n *\n * @platform ios\n */\nexport const StackToolbarMenu: React.FC<StackToolbarMenuProps> = ({ children, ...props }) => {\n const placement = useToolbarPlacement();\n\n const allowedChildren = useMemo(\n () =>\n placement === 'bottom'\n ? [StackToolbarMenu, StackToolbarMenuAction, NativeToolbarMenu, NativeToolbarMenuAction]\n : [StackToolbarMenu, StackToolbarMenuAction],\n [placement]\n );\n\n const validChildren = useMemo(\n () => filterAllowedChildrenElements(children, allowedChildren),\n [children, allowedChildren]\n );\n\n if (process.env.NODE_ENV !== 'production') {\n const allChildren = Children.toArray(children);\n if (allChildren.length !== validChildren.length) {\n throw new Error(\n `Stack.Toolbar.Menu only accepts Stack.Toolbar.Menu and Stack.Toolbar.MenuAction as its children.`\n );\n }\n }\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n return <NativeToolbarMenu {...props} image={props.image} children={validChildren} />;\n }\n\n return <Menu {...props} children={validChildren} />;\n};\n\nexport function convertStackToolbarMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const { title, ...rest } = props;\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n const item: NativeStackHeaderItemMenu = {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(rest),\n type: 'menu',\n menu: {\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n },\n };\n if (title) {\n item.menu.title = title;\n }\n\n return item;\n}\n\nfunction convertStackToolbarSubmenuMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenuSubmenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n\n // TODO: Remove Pick<HeaderBarButtonItemSubmenu> when this PR is merged and released in react-navigation:\n // https://github.com/react-navigation/react-navigation/pull/12895\n const item: NativeStackHeaderItemMenuSubmenu &\n Pick<HeaderBarButtonItemSubmenu, 'displayAsPalette' | 'displayInline' | 'destructive'> = {\n type: 'submenu',\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n label: sharedProps.label || props.title || '',\n };\n\n if (props.inline !== undefined) {\n item.displayInline = props.inline;\n }\n if (props.palette !== undefined) {\n item.displayAsPalette = props.palette;\n }\n if (props.destructive !== undefined) {\n item.destructive = props.destructive;\n }\n // TODO: Add elementSize to react-native-screens\n\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.Menu used as a submenu, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n\n return item;\n}\n\nexport interface StackToolbarMenuActionProps {\n /**\n * Can be an Icon, Label or string title.\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n icon?: SFSymbol | ImageSourcePropType;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu action.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress?: () => void;\n /**\n * An elaborated title that explains the purpose of the action.\n */\n discoverabilityLabel?: string;\n /**\n * An optional subtitle for the menu item.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n hidden?: boolean;\n}\n\n/**\n * An action item for a `Stack.Toolbar.Menu`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarMenuAction: React.FC<StackToolbarMenuActionProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n const icon = typeof props.icon === 'string' ? props.icon : undefined;\n return <NativeToolbarMenuAction {...props} icon={icon} image={props.image} />;\n }\n\n return <MenuAction {...props} />;\n};\n\nexport function convertStackToolbarMenuActionPropsToRNHeaderItem(\n props: StackToolbarMenuActionProps\n): NativeStackHeaderItemMenuAction {\n const { children, isOn, unstable_keepPresented, icon, ...rest } = props;\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const item: NativeStackHeaderItemMenuAction = {\n ...rest,\n type: 'action',\n label: sharedProps.label,\n state: isOn ? 'on' : 'off',\n onPress: props.onPress ?? (() => {}),\n };\n if (unstable_keepPresented !== undefined) {\n item.keepsMenuPresented = unstable_keepPresented;\n }\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.MenuAction, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n return item;\n}\n"]}
@@ -0,0 +1,48 @@
1
+ export interface StackToolbarSearchBarSlotProps {
2
+ /**
3
+ * Whether the search bar slot should be hidden.
4
+ *
5
+ * @default false
6
+ */
7
+ hidden?: boolean;
8
+ /**
9
+ * Whether to hide the shared background.
10
+ *
11
+ * @platform iOS 26+
12
+ */
13
+ hidesSharedBackground?: boolean;
14
+ /**
15
+ * Whether this search bar slot shares background with adjacent items.
16
+ *
17
+ * @platform iOS 26+
18
+ */
19
+ sharesBackground?: boolean;
20
+ }
21
+ /**
22
+ * A search bar slot for the bottom toolbar. This reserves space for the search bar
23
+ * in the toolbar and allows positioning it among other toolbar items.
24
+ *
25
+ * This component is only available in bottom placement (`<Stack.Toolbar>` or `<Stack.Toolbar placement="bottom">`).
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * import { Stack } from 'expo-router';
30
+ *
31
+ * export default function Page() {
32
+ * return (
33
+ * <>
34
+ * <Stack.Toolbar>
35
+ * <Stack.Toolbar.Button icon="folder" />
36
+ * <Stack.Toolbar.SearchBarSlot />
37
+ * <Stack.Toolbar.Button icon="ellipsis.circle" />
38
+ * </Stack.Toolbar>
39
+ * <ScreenContent />
40
+ * </>
41
+ * );
42
+ * }
43
+ * ```
44
+ *
45
+ * @platform iOS 26+
46
+ */
47
+ export declare const StackToolbarSearchBarSlot: React.FC<StackToolbarSearchBarSlotProps>;
48
+ //# sourceMappingURL=StackToolbarSearchBarSlot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarSearchBarSlot.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAa9E,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StackToolbarSearchBarSlot = void 0;
5
+ const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
6
+ const context_1 = require("./context");
7
+ /**
8
+ * A search bar slot for the bottom toolbar. This reserves space for the search bar
9
+ * in the toolbar and allows positioning it among other toolbar items.
10
+ *
11
+ * This component is only available in bottom placement (`<Stack.Toolbar>` or `<Stack.Toolbar placement="bottom">`).
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { Stack } from 'expo-router';
16
+ *
17
+ * export default function Page() {
18
+ * return (
19
+ * <>
20
+ * <Stack.Toolbar>
21
+ * <Stack.Toolbar.Button icon="folder" />
22
+ * <Stack.Toolbar.SearchBarSlot />
23
+ * <Stack.Toolbar.Button icon="ellipsis.circle" />
24
+ * </Stack.Toolbar>
25
+ * <ScreenContent />
26
+ * </>
27
+ * );
28
+ * }
29
+ * ```
30
+ *
31
+ * @platform iOS 26+
32
+ */
33
+ const StackToolbarSearchBarSlot = (props) => {
34
+ const placement = (0, context_1.useToolbarPlacement)();
35
+ if (placement !== 'bottom') {
36
+ if (process.env.NODE_ENV !== 'production') {
37
+ console.warn('Stack.Toolbar.SearchBarSlot is only available in Bottom placement. It will not render in Left or Right placement.');
38
+ }
39
+ return null;
40
+ }
41
+ return <bottom_toolbar_native_elements_1.NativeToolbarSearchBarSlot {...props}/>;
42
+ };
43
+ exports.StackToolbarSearchBarSlot = StackToolbarSearchBarSlot;
44
+ //# sourceMappingURL=StackToolbarSearchBarSlot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarSearchBarSlot.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,qFAA8E;AAC9E,uCAAgD;AAuBhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,MAAM,yBAAyB,GAA6C,CAAC,KAAK,EAAE,EAAE;IAC3F,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,OAAO,CAAC,IAAI,CACV,mHAAmH,CACpH,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,2DAA0B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnD,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC","sourcesContent":["'use client';\nimport { NativeToolbarSearchBarSlot } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\n\nexport interface StackToolbarSearchBarSlotProps {\n /**\n * Whether the search bar slot should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether this search bar slot shares background with adjacent items.\n *\n * @platform iOS 26+\n */\n sharesBackground?: boolean;\n}\n\n/**\n * A search bar slot for the bottom toolbar. This reserves space for the search bar\n * in the toolbar and allows positioning it among other toolbar items.\n *\n * This component is only available in bottom placement (`<Stack.Toolbar>` or `<Stack.Toolbar placement=\"bottom\">`).\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar>\n * <Stack.Toolbar.Button icon=\"folder\" />\n * <Stack.Toolbar.SearchBarSlot />\n * <Stack.Toolbar.Button icon=\"ellipsis.circle\" />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform iOS 26+\n */\nexport const StackToolbarSearchBarSlot: React.FC<StackToolbarSearchBarSlotProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement !== 'bottom') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Stack.Toolbar.SearchBarSlot is only available in Bottom placement. It will not render in Left or Right placement.'\n );\n }\n return null;\n }\n\n return <NativeToolbarSearchBarSlot {...props} />;\n};\n"]}
@@ -0,0 +1,80 @@
1
+ import type { NativeStackHeaderItemSpacing } from '@react-navigation/native-stack';
2
+ export interface StackToolbarSpacerProps {
3
+ /**
4
+ * Whether the spacer should be hidden.
5
+ *
6
+ * @default false
7
+ */
8
+ hidden?: boolean;
9
+ /**
10
+ * The width of the spacing element.
11
+ *
12
+ * In Left/Right placements, width is required.
13
+ * In Bottom placement, if width is not provided, the spacer will be flexible
14
+ * and expand to fill available space.
15
+ */
16
+ width?: number;
17
+ /**
18
+ * Whether to hide the shared background.
19
+ *
20
+ * Only available in bottom placement.
21
+ *
22
+ * @platform iOS 26+
23
+ */
24
+ hidesSharedBackground?: boolean;
25
+ /**
26
+ * Whether this spacer shares background with adjacent items.
27
+ *
28
+ * Only available in bottom placement.
29
+ *
30
+ * @platform iOS 26+
31
+ */
32
+ sharesBackground?: boolean;
33
+ }
34
+ /**
35
+ * A spacing helper used inside `Stack.Toolbar` to create empty space between toolbar items.
36
+ *
37
+ * In left/right placements, width is required.
38
+ * In bottom placement, if width is not provided, creates a flexible spacer that expands to fill space.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * import { Stack } from 'expo-router';
43
+ *
44
+ * export default function Page() {
45
+ * return (
46
+ * <>
47
+ * <Stack.Toolbar placement="left">
48
+ * <Stack.Toolbar.Button icon="arrow.left" />
49
+ * <Stack.Toolbar.Spacer width={8} />
50
+ * <Stack.Toolbar.Button icon="arrow.right" />
51
+ * </Stack.Toolbar>
52
+ * <ScreenContent />
53
+ * </>
54
+ * );
55
+ * }
56
+ * ```
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * import { Stack } from 'expo-router';
61
+ *
62
+ * export default function Page() {
63
+ * return (
64
+ * <>
65
+ * <Stack.Toolbar>
66
+ * <Stack.Toolbar.Spacer />
67
+ * <Stack.Toolbar.Button icon="search" />
68
+ * <Stack.Toolbar.Spacer />
69
+ * </Stack.Toolbar>
70
+ * <ScreenContent />
71
+ * </>
72
+ * );
73
+ * }
74
+ * ```
75
+ *
76
+ * @platform ios
77
+ */
78
+ export declare const StackToolbarSpacer: React.FC<StackToolbarSpacerProps>;
79
+ export declare function convertStackToolbarSpacerPropsToRNHeaderItem(props: StackToolbarSpacerProps): NativeStackHeaderItemSpacing | undefined;
80
+ //# sourceMappingURL=StackToolbarSpacer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarSpacer.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarSpacer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAKnF,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAQhE,CAAC;AAEF,wBAAgB,4CAA4C,CAC1D,KAAK,EAAE,uBAAuB,GAC7B,4BAA4B,GAAG,SAAS,CAqB1C"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StackToolbarSpacer = void 0;
5
+ exports.convertStackToolbarSpacerPropsToRNHeaderItem = convertStackToolbarSpacerPropsToRNHeaderItem;
6
+ const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
7
+ const context_1 = require("./context");
8
+ /**
9
+ * A spacing helper used inside `Stack.Toolbar` to create empty space between toolbar items.
10
+ *
11
+ * In left/right placements, width is required.
12
+ * In bottom placement, if width is not provided, creates a flexible spacer that expands to fill space.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * import { Stack } from 'expo-router';
17
+ *
18
+ * export default function Page() {
19
+ * return (
20
+ * <>
21
+ * <Stack.Toolbar placement="left">
22
+ * <Stack.Toolbar.Button icon="arrow.left" />
23
+ * <Stack.Toolbar.Spacer width={8} />
24
+ * <Stack.Toolbar.Button icon="arrow.right" />
25
+ * </Stack.Toolbar>
26
+ * <ScreenContent />
27
+ * </>
28
+ * );
29
+ * }
30
+ * ```
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { Stack } from 'expo-router';
35
+ *
36
+ * export default function Page() {
37
+ * return (
38
+ * <>
39
+ * <Stack.Toolbar>
40
+ * <Stack.Toolbar.Spacer />
41
+ * <Stack.Toolbar.Button icon="search" />
42
+ * <Stack.Toolbar.Spacer />
43
+ * </Stack.Toolbar>
44
+ * <ScreenContent />
45
+ * </>
46
+ * );
47
+ * }
48
+ * ```
49
+ *
50
+ * @platform ios
51
+ */
52
+ const StackToolbarSpacer = (props) => {
53
+ const placement = (0, context_1.useToolbarPlacement)();
54
+ if (placement === 'bottom') {
55
+ return <bottom_toolbar_native_elements_1.NativeToolbarSpacer {...props}/>;
56
+ }
57
+ return null;
58
+ };
59
+ exports.StackToolbarSpacer = StackToolbarSpacer;
60
+ function convertStackToolbarSpacerPropsToRNHeaderItem(props) {
61
+ const { hidden, width } = props;
62
+ if (hidden) {
63
+ return undefined;
64
+ }
65
+ // Warn if using flexible spacer in Left/Right placement
66
+ if (width === undefined) {
67
+ if (process.env.NODE_ENV !== 'production') {
68
+ console.warn('Stack.Toolbar.Spacer requires `width` when used in Left or Right placement. Flexible spacers are only supported in Bottom placement.');
69
+ }
70
+ return undefined;
71
+ }
72
+ return {
73
+ type: 'spacing',
74
+ spacing: width ?? 0,
75
+ };
76
+ }
77
+ //# sourceMappingURL=StackToolbarSpacer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarSpacer.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarSpacer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA+Fb,oGAuBC;AAnHD,qFAAuE;AACvE,uCAAgD;AAqChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACI,MAAM,kBAAkB,GAAsC,CAAC,KAAK,EAAE,EAAE;IAC7E,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,CAAC,oDAAmB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;IAC5C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF,SAAgB,4CAA4C,CAC1D,KAA8B;IAE9B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEhC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,wDAAwD;IACxD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,OAAO,CAAC,IAAI,CACV,sIAAsI,CACvI,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK,IAAI,CAAC;KACpB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport type { NativeStackHeaderItemSpacing } from '@react-navigation/native-stack';\n\nimport { NativeToolbarSpacer } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\n\nexport interface StackToolbarSpacerProps {\n /**\n * Whether the spacer should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n // TODO(@ubax): implement fluid spacing in react-native-screens\n /**\n * The width of the spacing element.\n *\n * In Left/Right placements, width is required.\n * In Bottom placement, if width is not provided, the spacer will be flexible\n * and expand to fill available space.\n */\n width?: number;\n // TODO(@ubax): implement missing props in react-native-screens\n /**\n * Whether to hide the shared background.\n *\n * Only available in bottom placement.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether this spacer shares background with adjacent items.\n *\n * Only available in bottom placement.\n *\n * @platform iOS 26+\n */\n sharesBackground?: boolean;\n}\n\n/**\n * A spacing helper used inside `Stack.Toolbar` to create empty space between toolbar items.\n *\n * In left/right placements, width is required.\n * In bottom placement, if width is not provided, creates a flexible spacer that expands to fill space.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left\" />\n * <Stack.Toolbar.Spacer width={8} />\n * <Stack.Toolbar.Button icon=\"arrow.right\" />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar>\n * <Stack.Toolbar.Spacer />\n * <Stack.Toolbar.Button icon=\"search\" />\n * <Stack.Toolbar.Spacer />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarSpacer: React.FC<StackToolbarSpacerProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n return <NativeToolbarSpacer {...props} />;\n }\n\n return null;\n};\n\nexport function convertStackToolbarSpacerPropsToRNHeaderItem(\n props: StackToolbarSpacerProps\n): NativeStackHeaderItemSpacing | undefined {\n const { hidden, width } = props;\n\n if (hidden) {\n return undefined;\n }\n\n // Warn if using flexible spacer in Left/Right placement\n if (width === undefined) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Stack.Toolbar.Spacer requires `width` when used in Left or Right placement. Flexible spacers are only supported in Bottom placement.'\n );\n }\n return undefined;\n }\n\n return {\n type: 'spacing',\n spacing: width ?? 0,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { NativeStackHeaderItemCustom } from '@react-navigation/native-stack';
2
- export interface StackHeaderViewProps {
2
+ export interface StackToolbarViewProps {
3
3
  /**
4
4
  * Can be any React node.
5
5
  */
@@ -18,34 +18,38 @@ export interface StackHeaderViewProps {
18
18
  * @platform iOS 26+
19
19
  */
20
20
  hidesSharedBackground?: boolean;
21
+ /**
22
+ * Whether to separate the background of this item from other items.
23
+ *
24
+ * Only available in bottom placement.
25
+ *
26
+ * @default false
27
+ */
28
+ separateBackground?: boolean;
21
29
  }
22
30
  /**
23
- * A wrapper to render custom content in the header.
31
+ * A wrapper to render custom content in the toolbar.
24
32
  *
25
- * Use as `Stack.Header.Item` to render a custom React element into the header
33
+ * Use inside `Stack.Toolbar` to render a custom React element.
26
34
  *
27
35
  * @example
28
36
  * ```tsx
29
37
  * import { Stack } from 'expo-router';
30
38
  * import { Text } from 'react-native';
31
39
  *
32
- * function CustomHeaderElement() {
40
+ * function CustomElement() {
33
41
  * return <Text>Custom Element</Text>;
34
42
  * }
35
43
  *
36
- * function Screen() {
44
+ * export default function Page() {
37
45
  * return (
38
46
  * <>
47
+ * <Stack.Toolbar>
48
+ * <Stack.Toolbar.View>
49
+ * <CustomElement />
50
+ * </Stack.Toolbar.View>
51
+ * </Stack.Toolbar>
39
52
  * <ScreenContent />
40
- * <Stack.Screen>
41
- * <Stack.Header>
42
- * <Stack.Header.Left>
43
- * <Stack.Header.Item>
44
- * <CustomHeaderElement />
45
- * </Stack.Header.Item>
46
- * </Stack.Header.Left>
47
- * </Stack.Header>
48
- * </Stack.Screen>
49
53
  * </>
50
54
  * );
51
55
  * }
@@ -53,6 +57,6 @@ export interface StackHeaderViewProps {
53
57
  *
54
58
  * @platform ios
55
59
  */
56
- export declare const StackHeaderView: React.FC<StackHeaderViewProps>;
57
- export declare function convertStackHeaderViewPropsToRNHeaderItem(props: StackHeaderViewProps): NativeStackHeaderItemCustom | undefined;
58
- //# sourceMappingURL=StackHeaderView.d.ts.map
60
+ export declare const StackToolbarView: React.FC<StackToolbarViewProps>;
61
+ export declare function convertStackToolbarViewPropsToRNHeaderItem(props: StackToolbarViewProps): NativeStackHeaderItemCustom | undefined;
62
+ //# sourceMappingURL=StackToolbarView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarView.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAKlF,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,2BAA2B,CAAC,SAAS,CAAC,CAAC;IAClD;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAQ5D,CAAC;AAEF,wBAAgB,0CAA0C,CACxD,KAAK,EAAE,qBAAqB,GAC3B,2BAA2B,GAAG,SAAS,CAgBzC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StackToolbarView = void 0;
5
+ exports.convertStackToolbarViewPropsToRNHeaderItem = convertStackToolbarViewPropsToRNHeaderItem;
6
+ const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
7
+ const context_1 = require("./context");
8
+ /**
9
+ * A wrapper to render custom content in the toolbar.
10
+ *
11
+ * Use inside `Stack.Toolbar` to render a custom React element.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { Stack } from 'expo-router';
16
+ * import { Text } from 'react-native';
17
+ *
18
+ * function CustomElement() {
19
+ * return <Text>Custom Element</Text>;
20
+ * }
21
+ *
22
+ * export default function Page() {
23
+ * return (
24
+ * <>
25
+ * <Stack.Toolbar>
26
+ * <Stack.Toolbar.View>
27
+ * <CustomElement />
28
+ * </Stack.Toolbar.View>
29
+ * </Stack.Toolbar>
30
+ * <ScreenContent />
31
+ * </>
32
+ * );
33
+ * }
34
+ * ```
35
+ *
36
+ * @platform ios
37
+ */
38
+ const StackToolbarView = (props) => {
39
+ const placement = (0, context_1.useToolbarPlacement)();
40
+ if (placement === 'bottom') {
41
+ return <bottom_toolbar_native_elements_1.NativeToolbarView {...props}>{props.children}</bottom_toolbar_native_elements_1.NativeToolbarView>;
42
+ }
43
+ return null;
44
+ };
45
+ exports.StackToolbarView = StackToolbarView;
46
+ function convertStackToolbarViewPropsToRNHeaderItem(props) {
47
+ if (props.hidden) {
48
+ return undefined;
49
+ }
50
+ const { children, hidesSharedBackground } = props;
51
+ if (!children) {
52
+ console.warn('Stack.Toolbar.View requires a child element to render custom content in the toolbar.');
53
+ }
54
+ const element = children ? children : <></>;
55
+ return {
56
+ type: 'custom',
57
+ element,
58
+ hidesSharedBackground,
59
+ };
60
+ }
61
+ //# sourceMappingURL=StackToolbarView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackToolbarView.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA4Eb,gGAkBC;AA3FD,qFAAqE;AACrE,uCAAgD;AAgChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACI,MAAM,gBAAgB,GAAoC,CAAC,KAAK,EAAE,EAAE;IACzE,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,CAAC,kDAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,kDAAiB,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B;AAEF,SAAgB,0CAA0C,CACxD,KAA4B;IAE5B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CACV,sFAAsF,CACvF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;IAC5C,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,qBAAqB;KACtB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport type { NativeStackHeaderItemCustom } from '@react-navigation/native-stack';\n\nimport { NativeToolbarView } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\n\nexport interface StackToolbarViewProps {\n /**\n * Can be any React node.\n */\n children?: NativeStackHeaderItemCustom['element'];\n /**\n * Whether the view should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n // TODO(@ubax): implement missing props in react-native-screens\n /**\n * Whether to separate the background of this item from other items.\n *\n * Only available in bottom placement.\n *\n * @default false\n */\n separateBackground?: boolean;\n}\n\n/**\n * A wrapper to render custom content in the toolbar.\n *\n * Use inside `Stack.Toolbar` to render a custom React element.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n * import { Text } from 'react-native';\n *\n * function CustomElement() {\n * return <Text>Custom Element</Text>;\n * }\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar>\n * <Stack.Toolbar.View>\n * <CustomElement />\n * </Stack.Toolbar.View>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarView: React.FC<StackToolbarViewProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n return <NativeToolbarView {...props}>{props.children}</NativeToolbarView>;\n }\n\n return null;\n};\n\nexport function convertStackToolbarViewPropsToRNHeaderItem(\n props: StackToolbarViewProps\n): NativeStackHeaderItemCustom | undefined {\n if (props.hidden) {\n return undefined;\n }\n const { children, hidesSharedBackground } = props;\n if (!children) {\n console.warn(\n 'Stack.Toolbar.View requires a child element to render custom content in the toolbar.'\n );\n }\n const element = children ? children : <></>;\n return {\n type: 'custom',\n element,\n hidesSharedBackground,\n };\n}\n"]}