@tamagui/sheet 2.7.7 → 3.0.0-beta.643.1

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 (435) hide show
  1. package/dist/cjs/GestureDetectorWrapper.cjs +32 -41
  2. package/dist/cjs/GestureDetectorWrapper.native.cjs +48 -0
  3. package/dist/cjs/GestureDetectorWrapper.native.js +32 -40
  4. package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -1
  5. package/dist/cjs/GestureSheetContext.cjs +29 -37
  6. package/dist/cjs/GestureSheetContext.native.cjs +49 -0
  7. package/dist/cjs/GestureSheetContext.native.js +30 -37
  8. package/dist/cjs/GestureSheetContext.native.js.map +1 -1
  9. package/dist/cjs/Sheet.cjs +206 -99
  10. package/dist/cjs/Sheet.native.cjs +234 -0
  11. package/dist/cjs/Sheet.native.js +212 -98
  12. package/dist/cjs/Sheet.native.js.map +1 -1
  13. package/dist/cjs/SheetContext.cjs +44 -22
  14. package/dist/cjs/SheetContext.native.cjs +58 -0
  15. package/dist/cjs/SheetContext.native.js +45 -22
  16. package/dist/cjs/SheetContext.native.js.map +1 -1
  17. package/dist/cjs/SheetController.cjs +50 -56
  18. package/dist/cjs/SheetController.native.cjs +72 -0
  19. package/dist/cjs/SheetController.native.js +53 -58
  20. package/dist/cjs/SheetController.native.js.map +1 -1
  21. package/dist/cjs/SheetImplementationCustom.cjs +674 -605
  22. package/dist/cjs/SheetImplementationCustom.native.cjs +762 -0
  23. package/dist/cjs/SheetImplementationCustom.native.js +713 -644
  24. package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
  25. package/dist/cjs/SheetScrollView.cjs +291 -312
  26. package/dist/cjs/SheetScrollView.native.cjs +326 -0
  27. package/dist/cjs/SheetScrollView.native.js +299 -319
  28. package/dist/cjs/SheetScrollView.native.js.map +1 -1
  29. package/dist/cjs/constants.cjs +22 -21
  30. package/dist/cjs/constants.native.cjs +37 -0
  31. package/dist/cjs/constants.native.js +22 -20
  32. package/dist/cjs/constants.native.js.map +1 -1
  33. package/dist/cjs/contexts.cjs +20 -28
  34. package/dist/cjs/contexts.native.cjs +38 -0
  35. package/dist/cjs/contexts.native.js +20 -27
  36. package/dist/cjs/contexts.native.js.map +1 -1
  37. package/dist/cjs/controller.cjs +17 -18
  38. package/dist/cjs/controller.native.cjs +32 -0
  39. package/dist/cjs/controller.native.js +17 -17
  40. package/dist/cjs/controller.native.js.map +1 -1
  41. package/dist/cjs/gestureState.cjs +29 -30
  42. package/dist/cjs/gestureState.native.cjs +54 -0
  43. package/dist/cjs/gestureState.native.js +30 -30
  44. package/dist/cjs/gestureState.native.js.map +1 -1
  45. package/dist/cjs/helpers.cjs +21 -24
  46. package/dist/cjs/helpers.native.cjs +35 -0
  47. package/dist/cjs/helpers.native.js +22 -24
  48. package/dist/cjs/helpers.native.js.map +1 -1
  49. package/dist/cjs/index.cjs +15 -21
  50. package/dist/cjs/index.native.cjs +37 -0
  51. package/dist/cjs/index.native.js +16 -21
  52. package/dist/cjs/index.native.js.map +1 -1
  53. package/dist/cjs/keyboardAvoidance.cjs +56 -79
  54. package/dist/cjs/keyboardAvoidance.native.cjs +75 -0
  55. package/dist/cjs/keyboardAvoidance.native.js +56 -78
  56. package/dist/cjs/keyboardAvoidance.native.js.map +1 -1
  57. package/dist/cjs/nativeSheet.cjs +64 -76
  58. package/dist/cjs/nativeSheet.native.cjs +94 -0
  59. package/dist/cjs/nativeSheet.native.js +70 -83
  60. package/dist/cjs/nativeSheet.native.js.map +1 -1
  61. package/dist/cjs/types.cjs +10 -11
  62. package/dist/cjs/types.native.cjs +19 -0
  63. package/dist/cjs/types.native.js +10 -10
  64. package/dist/cjs/types.native.js.map +1 -1
  65. package/dist/cjs/useGestureHandlerPan.cjs +245 -257
  66. package/dist/cjs/useGestureHandlerPan.native.cjs +273 -0
  67. package/dist/cjs/useGestureHandlerPan.native.js +254 -265
  68. package/dist/cjs/useGestureHandlerPan.native.js.map +1 -1
  69. package/dist/cjs/useKeyboardControllerSheet.cjs +83 -88
  70. package/dist/cjs/useKeyboardControllerSheet.native.cjs +119 -0
  71. package/dist/cjs/useKeyboardControllerSheet.native.js +100 -111
  72. package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -1
  73. package/dist/cjs/useSafeAreaInsets.cjs +20 -26
  74. package/dist/cjs/useSafeAreaInsets.native.cjs +51 -0
  75. package/dist/cjs/useSafeAreaInsets.native.js +30 -25
  76. package/dist/cjs/useSafeAreaInsets.native.js.map +1 -1
  77. package/dist/cjs/useSheetController.cjs +27 -39
  78. package/dist/cjs/useSheetController.native.cjs +42 -0
  79. package/dist/cjs/useSheetController.native.js +28 -39
  80. package/dist/cjs/useSheetController.native.js.map +1 -1
  81. package/dist/cjs/useSheetOffscreenSize.cjs +44 -53
  82. package/dist/cjs/useSheetOffscreenSize.native.cjs +60 -0
  83. package/dist/cjs/useSheetOffscreenSize.native.js +48 -56
  84. package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
  85. package/dist/cjs/useSheetOpenState.cjs +69 -40
  86. package/dist/cjs/useSheetOpenState.native.cjs +88 -0
  87. package/dist/cjs/useSheetOpenState.native.js +74 -42
  88. package/dist/cjs/useSheetOpenState.native.js.map +1 -1
  89. package/dist/cjs/useSheetProviderProps.cjs +146 -164
  90. package/dist/cjs/useSheetProviderProps.native.cjs +176 -0
  91. package/dist/cjs/useSheetProviderProps.native.js +156 -174
  92. package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
  93. package/dist/cjs/useSheetScrollViewGestures.cjs +172 -180
  94. package/dist/cjs/useSheetScrollViewGestures.native.cjs +150 -0
  95. package/dist/cjs/useSheetScrollViewGestures.native.js +136 -147
  96. package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -1
  97. package/dist/cjs/webViewport.cjs +47 -48
  98. package/dist/cjs/webViewport.native.cjs +79 -0
  99. package/dist/cjs/webViewport.native.js +50 -50
  100. package/dist/cjs/webViewport.native.js.map +1 -1
  101. package/dist/esm/GestureDetectorWrapper.mjs +19 -23
  102. package/dist/esm/GestureDetectorWrapper.mjs.map +1 -1
  103. package/dist/esm/GestureDetectorWrapper.native.js +20 -24
  104. package/dist/esm/GestureDetectorWrapper.native.js.map +1 -1
  105. package/dist/esm/GestureSheetContext.mjs +15 -20
  106. package/dist/esm/GestureSheetContext.mjs.map +1 -1
  107. package/dist/esm/GestureSheetContext.native.js +17 -22
  108. package/dist/esm/GestureSheetContext.native.js.map +1 -1
  109. package/dist/esm/Sheet.mjs +191 -83
  110. package/dist/esm/Sheet.mjs.map +1 -1
  111. package/dist/esm/Sheet.native.js +198 -83
  112. package/dist/esm/Sheet.native.js.map +1 -1
  113. package/dist/esm/SheetContext.mjs +21 -5
  114. package/dist/esm/SheetContext.mjs.map +1 -1
  115. package/dist/esm/SheetContext.native.js +21 -5
  116. package/dist/esm/SheetContext.native.js.map +1 -1
  117. package/dist/esm/SheetController.mjs +34 -30
  118. package/dist/esm/SheetController.mjs.map +1 -1
  119. package/dist/esm/SheetController.native.js +38 -34
  120. package/dist/esm/SheetController.native.js.map +1 -1
  121. package/dist/esm/SheetImplementationCustom.mjs +655 -580
  122. package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
  123. package/dist/esm/SheetImplementationCustom.native.js +691 -612
  124. package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
  125. package/dist/esm/SheetScrollView.mjs +277 -288
  126. package/dist/esm/SheetScrollView.mjs.map +1 -1
  127. package/dist/esm/SheetScrollView.native.js +286 -297
  128. package/dist/esm/SheetScrollView.native.js.map +1 -1
  129. package/dist/esm/constants.mjs +5 -3
  130. package/dist/esm/constants.mjs.map +1 -1
  131. package/dist/esm/constants.native.js +5 -3
  132. package/dist/esm/constants.native.js.map +1 -1
  133. package/dist/esm/contexts.mjs +3 -3
  134. package/dist/esm/contexts.mjs.map +1 -1
  135. package/dist/esm/contexts.native.js +3 -3
  136. package/dist/esm/contexts.native.js.map +1 -1
  137. package/dist/esm/controller.mjs +2 -2
  138. package/dist/esm/controller.native.js +2 -2
  139. package/dist/esm/gestureState.mjs +13 -11
  140. package/dist/esm/gestureState.mjs.map +1 -1
  141. package/dist/esm/gestureState.native.js +14 -12
  142. package/dist/esm/gestureState.native.js.map +1 -1
  143. package/dist/esm/helpers.mjs +7 -6
  144. package/dist/esm/helpers.mjs.map +1 -1
  145. package/dist/esm/helpers.native.js +8 -7
  146. package/dist/esm/helpers.native.js.map +1 -1
  147. package/dist/esm/index.js +21 -14
  148. package/dist/esm/index.mjs +21 -14
  149. package/dist/esm/index.native.js +21 -14
  150. package/dist/esm/keyboardAvoidance.mjs +40 -61
  151. package/dist/esm/keyboardAvoidance.mjs.map +1 -1
  152. package/dist/esm/keyboardAvoidance.native.js +40 -61
  153. package/dist/esm/keyboardAvoidance.native.js.map +1 -1
  154. package/dist/esm/nativeSheet.mjs +52 -61
  155. package/dist/esm/nativeSheet.mjs.map +1 -1
  156. package/dist/esm/nativeSheet.native.js +58 -69
  157. package/dist/esm/nativeSheet.native.js.map +1 -1
  158. package/dist/esm/types.mjs +0 -2
  159. package/dist/esm/types.native.js +0 -2
  160. package/dist/esm/useGestureHandlerPan.mjs +232 -239
  161. package/dist/esm/useGestureHandlerPan.mjs.map +1 -1
  162. package/dist/esm/useGestureHandlerPan.native.js +241 -248
  163. package/dist/esm/useGestureHandlerPan.native.js.map +1 -1
  164. package/dist/esm/useKeyboardControllerSheet.mjs +71 -71
  165. package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -1
  166. package/dist/esm/useKeyboardControllerSheet.native.js +92 -94
  167. package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -1
  168. package/dist/esm/useSafeAreaInsets.mjs +3 -1
  169. package/dist/esm/useSafeAreaInsets.mjs.map +1 -1
  170. package/dist/esm/useSafeAreaInsets.native.js +15 -3
  171. package/dist/esm/useSafeAreaInsets.native.js.map +1 -1
  172. package/dist/esm/useSheetController.mjs +14 -12
  173. package/dist/esm/useSheetController.mjs.map +1 -1
  174. package/dist/esm/useSheetController.native.js +14 -12
  175. package/dist/esm/useSheetController.native.js.map +1 -1
  176. package/dist/esm/useSheetOffscreenSize.mjs +30 -35
  177. package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
  178. package/dist/esm/useSheetOffscreenSize.native.js +34 -39
  179. package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
  180. package/dist/esm/useSheetOpenState.mjs +50 -22
  181. package/dist/esm/useSheetOpenState.mjs.map +1 -1
  182. package/dist/esm/useSheetOpenState.native.js +55 -25
  183. package/dist/esm/useSheetOpenState.native.js.map +1 -1
  184. package/dist/esm/useSheetProviderProps.mjs +130 -138
  185. package/dist/esm/useSheetProviderProps.mjs.map +1 -1
  186. package/dist/esm/useSheetProviderProps.native.js +140 -149
  187. package/dist/esm/useSheetProviderProps.native.js.map +1 -1
  188. package/dist/esm/useSheetScrollViewGestures.mjs +159 -162
  189. package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -1
  190. package/dist/esm/useSheetScrollViewGestures.native.js +123 -130
  191. package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -1
  192. package/dist/esm/webViewport.mjs +26 -25
  193. package/dist/esm/webViewport.mjs.map +1 -1
  194. package/dist/esm/webViewport.native.js +29 -28
  195. package/dist/esm/webViewport.native.js.map +1 -1
  196. package/dist/jsx/GestureDetectorWrapper.mjs +19 -23
  197. package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -1
  198. package/dist/jsx/GestureDetectorWrapper.native.cjs +48 -0
  199. package/dist/jsx/GestureDetectorWrapper.native.js +32 -40
  200. package/dist/jsx/GestureDetectorWrapper.native.js.map +1 -1
  201. package/dist/jsx/GestureSheetContext.mjs +15 -20
  202. package/dist/jsx/GestureSheetContext.mjs.map +1 -1
  203. package/dist/jsx/GestureSheetContext.native.cjs +49 -0
  204. package/dist/jsx/GestureSheetContext.native.js +30 -37
  205. package/dist/jsx/GestureSheetContext.native.js.map +1 -1
  206. package/dist/jsx/Sheet.mjs +191 -83
  207. package/dist/jsx/Sheet.mjs.map +1 -1
  208. package/dist/jsx/Sheet.native.cjs +234 -0
  209. package/dist/jsx/Sheet.native.js +212 -98
  210. package/dist/jsx/Sheet.native.js.map +1 -1
  211. package/dist/jsx/SheetContext.mjs +21 -5
  212. package/dist/jsx/SheetContext.mjs.map +1 -1
  213. package/dist/jsx/SheetContext.native.cjs +58 -0
  214. package/dist/jsx/SheetContext.native.js +45 -22
  215. package/dist/jsx/SheetContext.native.js.map +1 -1
  216. package/dist/jsx/SheetController.mjs +34 -30
  217. package/dist/jsx/SheetController.mjs.map +1 -1
  218. package/dist/jsx/SheetController.native.cjs +72 -0
  219. package/dist/jsx/SheetController.native.js +53 -58
  220. package/dist/jsx/SheetController.native.js.map +1 -1
  221. package/dist/jsx/SheetImplementationCustom.mjs +655 -580
  222. package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
  223. package/dist/jsx/SheetImplementationCustom.native.cjs +762 -0
  224. package/dist/jsx/SheetImplementationCustom.native.js +713 -644
  225. package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
  226. package/dist/jsx/SheetScrollView.mjs +277 -288
  227. package/dist/jsx/SheetScrollView.mjs.map +1 -1
  228. package/dist/jsx/SheetScrollView.native.cjs +326 -0
  229. package/dist/jsx/SheetScrollView.native.js +299 -319
  230. package/dist/jsx/SheetScrollView.native.js.map +1 -1
  231. package/dist/jsx/constants.mjs +5 -3
  232. package/dist/jsx/constants.mjs.map +1 -1
  233. package/dist/jsx/constants.native.cjs +37 -0
  234. package/dist/jsx/constants.native.js +22 -20
  235. package/dist/jsx/constants.native.js.map +1 -1
  236. package/dist/jsx/contexts.mjs +3 -3
  237. package/dist/jsx/contexts.mjs.map +1 -1
  238. package/dist/jsx/contexts.native.cjs +38 -0
  239. package/dist/jsx/contexts.native.js +20 -27
  240. package/dist/jsx/contexts.native.js.map +1 -1
  241. package/dist/jsx/controller.mjs +2 -2
  242. package/dist/jsx/controller.native.cjs +32 -0
  243. package/dist/jsx/controller.native.js +17 -17
  244. package/dist/jsx/controller.native.js.map +1 -1
  245. package/dist/jsx/gestureState.mjs +13 -11
  246. package/dist/jsx/gestureState.mjs.map +1 -1
  247. package/dist/jsx/gestureState.native.cjs +54 -0
  248. package/dist/jsx/gestureState.native.js +30 -30
  249. package/dist/jsx/gestureState.native.js.map +1 -1
  250. package/dist/jsx/helpers.mjs +7 -6
  251. package/dist/jsx/helpers.mjs.map +1 -1
  252. package/dist/jsx/helpers.native.cjs +35 -0
  253. package/dist/jsx/helpers.native.js +22 -24
  254. package/dist/jsx/helpers.native.js.map +1 -1
  255. package/dist/jsx/index.js +21 -14
  256. package/dist/jsx/index.mjs +21 -14
  257. package/dist/jsx/index.native.cjs +37 -0
  258. package/dist/jsx/index.native.js +16 -21
  259. package/dist/jsx/index.native.js.map +1 -1
  260. package/dist/jsx/keyboardAvoidance.mjs +40 -61
  261. package/dist/jsx/keyboardAvoidance.mjs.map +1 -1
  262. package/dist/jsx/keyboardAvoidance.native.cjs +75 -0
  263. package/dist/jsx/keyboardAvoidance.native.js +56 -78
  264. package/dist/jsx/keyboardAvoidance.native.js.map +1 -1
  265. package/dist/jsx/nativeSheet.mjs +52 -61
  266. package/dist/jsx/nativeSheet.mjs.map +1 -1
  267. package/dist/jsx/nativeSheet.native.cjs +94 -0
  268. package/dist/jsx/nativeSheet.native.js +70 -83
  269. package/dist/jsx/nativeSheet.native.js.map +1 -1
  270. package/dist/jsx/types.mjs +0 -2
  271. package/dist/jsx/types.native.cjs +19 -0
  272. package/dist/jsx/types.native.js +10 -10
  273. package/dist/jsx/types.native.js.map +1 -1
  274. package/dist/jsx/useGestureHandlerPan.mjs +232 -239
  275. package/dist/jsx/useGestureHandlerPan.mjs.map +1 -1
  276. package/dist/jsx/useGestureHandlerPan.native.cjs +273 -0
  277. package/dist/jsx/useGestureHandlerPan.native.js +254 -265
  278. package/dist/jsx/useGestureHandlerPan.native.js.map +1 -1
  279. package/dist/jsx/useKeyboardControllerSheet.mjs +71 -71
  280. package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -1
  281. package/dist/jsx/useKeyboardControllerSheet.native.cjs +119 -0
  282. package/dist/jsx/useKeyboardControllerSheet.native.js +100 -111
  283. package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -1
  284. package/dist/jsx/useSafeAreaInsets.mjs +3 -1
  285. package/dist/jsx/useSafeAreaInsets.mjs.map +1 -1
  286. package/dist/jsx/useSafeAreaInsets.native.cjs +51 -0
  287. package/dist/jsx/useSafeAreaInsets.native.js +30 -25
  288. package/dist/jsx/useSafeAreaInsets.native.js.map +1 -1
  289. package/dist/jsx/useSheetController.mjs +14 -12
  290. package/dist/jsx/useSheetController.mjs.map +1 -1
  291. package/dist/jsx/useSheetController.native.cjs +42 -0
  292. package/dist/jsx/useSheetController.native.js +28 -39
  293. package/dist/jsx/useSheetController.native.js.map +1 -1
  294. package/dist/jsx/useSheetOffscreenSize.mjs +30 -35
  295. package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
  296. package/dist/jsx/useSheetOffscreenSize.native.cjs +60 -0
  297. package/dist/jsx/useSheetOffscreenSize.native.js +48 -56
  298. package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
  299. package/dist/jsx/useSheetOpenState.mjs +50 -22
  300. package/dist/jsx/useSheetOpenState.mjs.map +1 -1
  301. package/dist/jsx/useSheetOpenState.native.cjs +88 -0
  302. package/dist/jsx/useSheetOpenState.native.js +74 -42
  303. package/dist/jsx/useSheetOpenState.native.js.map +1 -1
  304. package/dist/jsx/useSheetProviderProps.mjs +130 -138
  305. package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
  306. package/dist/jsx/useSheetProviderProps.native.cjs +176 -0
  307. package/dist/jsx/useSheetProviderProps.native.js +156 -174
  308. package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
  309. package/dist/jsx/useSheetScrollViewGestures.mjs +159 -162
  310. package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -1
  311. package/dist/jsx/useSheetScrollViewGestures.native.cjs +150 -0
  312. package/dist/jsx/useSheetScrollViewGestures.native.js +136 -147
  313. package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -1
  314. package/dist/jsx/webViewport.mjs +26 -25
  315. package/dist/jsx/webViewport.mjs.map +1 -1
  316. package/dist/jsx/webViewport.native.cjs +79 -0
  317. package/dist/jsx/webViewport.native.js +50 -50
  318. package/dist/jsx/webViewport.native.js.map +1 -1
  319. package/package.json +33 -39
  320. package/src/Sheet.tsx +316 -77
  321. package/src/SheetContext.tsx +57 -7
  322. package/src/SheetController.tsx +7 -6
  323. package/src/SheetImplementationCustom.tsx +343 -140
  324. package/src/SheetScrollView.tsx +24 -13
  325. package/src/constants.tsx +3 -3
  326. package/src/helpers.tsx +0 -14
  327. package/src/index.ts +3 -6
  328. package/src/nativeSheet.tsx +5 -15
  329. package/src/types.tsx +104 -92
  330. package/src/useKeyboardControllerSheet.native.ts +7 -2
  331. package/src/useSafeAreaInsets.native.ts +20 -13
  332. package/src/useSheetController.tsx +15 -7
  333. package/src/useSheetOpenState.tsx +50 -4
  334. package/src/useSheetProviderProps.tsx +4 -27
  335. package/src/useSheetScrollViewGestures.ts +2 -2
  336. package/types/GestureDetectorWrapper.d.ts +1 -1
  337. package/types/GestureDetectorWrapper.d.ts.map +1 -1
  338. package/types/GestureSheetContext.d.ts +1 -1
  339. package/types/GestureSheetContext.d.ts.map +1 -1
  340. package/types/Sheet.d.ts +384 -135
  341. package/types/Sheet.d.ts.map +1 -1
  342. package/types/SheetContext.d.ts +28 -42
  343. package/types/SheetContext.d.ts.map +1 -1
  344. package/types/SheetController.d.ts +4 -2
  345. package/types/SheetController.d.ts.map +1 -1
  346. package/types/SheetImplementationCustom.d.ts +3 -35
  347. package/types/SheetImplementationCustom.d.ts.map +1 -1
  348. package/types/SheetScrollView.d.ts +57 -23
  349. package/types/SheetScrollView.d.ts.map +1 -1
  350. package/types/constants.d.ts +3 -2
  351. package/types/constants.d.ts.map +1 -1
  352. package/types/index.d.ts +1 -3
  353. package/types/index.d.ts.map +1 -1
  354. package/types/nativeSheet.d.ts.map +1 -1
  355. package/types/types.d.ts +28 -17
  356. package/types/types.d.ts.map +1 -1
  357. package/types/useKeyboardControllerSheet.native.d.ts.map +1 -1
  358. package/types/useSafeAreaInsets.native.d.ts +4 -12
  359. package/types/useSafeAreaInsets.native.d.ts.map +1 -1
  360. package/types/useSheetController.d.ts +6 -6
  361. package/types/useSheetController.d.ts.map +1 -1
  362. package/types/useSheetOffscreenSize.d.ts.map +1 -1
  363. package/types/useSheetOpenState.d.ts +3 -2
  364. package/types/useSheetOpenState.d.ts.map +1 -1
  365. package/types/useSheetProviderProps.d.ts +5 -8
  366. package/types/useSheetProviderProps.d.ts.map +1 -1
  367. package/types/useSheetScrollViewGestures.d.ts +2 -2
  368. package/types/useSheetScrollViewGestures.d.ts.map +1 -1
  369. package/.turbo/turbo-build.log +0 -2
  370. package/controller/index.cjs +0 -2
  371. package/controller/index.d.ts +0 -5
  372. package/controller/index.js +0 -2
  373. package/controller/index.native.cjs +0 -2
  374. package/controller/index.native.js +0 -2
  375. package/dist/cjs/createSheet.cjs +0 -194
  376. package/dist/cjs/createSheet.native.js +0 -204
  377. package/dist/cjs/createSheet.native.js.map +0 -1
  378. package/dist/cjs/setupGestureHandler.cjs +0 -55
  379. package/dist/cjs/setupGestureHandler.native.js +0 -60
  380. package/dist/cjs/setupGestureHandler.native.js.map +0 -1
  381. package/dist/cjs/useSheet.cjs +0 -29
  382. package/dist/cjs/useSheet.native.js +0 -34
  383. package/dist/cjs/useSheet.native.js.map +0 -1
  384. package/dist/esm/controller.mjs.map +0 -1
  385. package/dist/esm/controller.native.js.map +0 -1
  386. package/dist/esm/createSheet.mjs +0 -168
  387. package/dist/esm/createSheet.mjs.map +0 -1
  388. package/dist/esm/createSheet.native.js +0 -176
  389. package/dist/esm/createSheet.native.js.map +0 -1
  390. package/dist/esm/index.js.map +0 -1
  391. package/dist/esm/index.mjs.map +0 -1
  392. package/dist/esm/index.native.js.map +0 -1
  393. package/dist/esm/setupGestureHandler.mjs +0 -29
  394. package/dist/esm/setupGestureHandler.mjs.map +0 -1
  395. package/dist/esm/setupGestureHandler.native.js +0 -31
  396. package/dist/esm/setupGestureHandler.native.js.map +0 -1
  397. package/dist/esm/types.mjs.map +0 -1
  398. package/dist/esm/types.native.js.map +0 -1
  399. package/dist/esm/useSheet.mjs +0 -4
  400. package/dist/esm/useSheet.mjs.map +0 -1
  401. package/dist/esm/useSheet.native.js +0 -6
  402. package/dist/esm/useSheet.native.js.map +0 -1
  403. package/dist/jsx/controller.mjs.map +0 -1
  404. package/dist/jsx/createSheet.mjs +0 -168
  405. package/dist/jsx/createSheet.mjs.map +0 -1
  406. package/dist/jsx/createSheet.native.js +0 -204
  407. package/dist/jsx/createSheet.native.js.map +0 -1
  408. package/dist/jsx/index.js.map +0 -1
  409. package/dist/jsx/index.mjs.map +0 -1
  410. package/dist/jsx/setupGestureHandler.mjs +0 -29
  411. package/dist/jsx/setupGestureHandler.mjs.map +0 -1
  412. package/dist/jsx/setupGestureHandler.native.js +0 -60
  413. package/dist/jsx/setupGestureHandler.native.js.map +0 -1
  414. package/dist/jsx/types.mjs.map +0 -1
  415. package/dist/jsx/useSheet.mjs +0 -4
  416. package/dist/jsx/useSheet.mjs.map +0 -1
  417. package/dist/jsx/useSheet.native.js +0 -34
  418. package/dist/jsx/useSheet.native.js.map +0 -1
  419. package/next.md +0 -78
  420. package/setup-gesture-handler/index.cjs +0 -2
  421. package/setup-gesture-handler/index.js +0 -2
  422. package/setup-gesture-handler/index.native.cjs +0 -2
  423. package/setup-gesture-handler/index.native.js +0 -2
  424. package/setup-gesture-handler.cjs +0 -1
  425. package/src/createSheet.tsx +0 -309
  426. package/src/setupGestureHandler.ts +0 -43
  427. package/src/useSheet.tsx +0 -3
  428. package/test/keyboardAvoidance.test.ts +0 -269
  429. package/tsconfig.json +0 -57
  430. package/types/createSheet.d.ts +0 -195
  431. package/types/createSheet.d.ts.map +0 -1
  432. package/types/setupGestureHandler.d.ts +0 -11
  433. package/types/setupGestureHandler.d.ts.map +0 -1
  434. package/types/useSheet.d.ts +0 -2
  435. package/types/useSheet.d.ts.map +0 -1
@@ -5,10 +5,14 @@ import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
5
5
  import {
6
6
  LayoutMeasurementController,
7
7
  View as TamaguiView,
8
- useConfiguration,
8
+ useAnimationDriver,
9
+ useAnimatedNumber,
10
+ useAnimatedNumberStyle,
9
11
  useDidFinishSSR,
10
12
  useEvent,
11
13
  useThemeName,
14
+ createRefComponent,
15
+ formatDiagnostic,
12
16
  } from '@tamagui/core'
13
17
  import { needsPortalRepropagation, Portal } from '@tamagui/portal'
14
18
  import React, { useState } from 'react'
@@ -20,6 +24,7 @@ import type {
20
24
  } from 'react-native'
21
25
  import { Dimensions, PanResponder, View } from 'react-native'
22
26
  import { ParentSheetContext, SheetInsideSheetContext } from './contexts'
27
+ import { SHEET_OVERLAY_MARKER } from './constants'
23
28
  import { GestureDetectorWrapper } from './GestureDetectorWrapper'
24
29
  import { getGestureHandlerState } from './gestureState'
25
30
  import { GestureSheetProvider } from './GestureSheetContext'
@@ -36,8 +41,17 @@ import {
36
41
  getWebVisualViewportOffsetTop,
37
42
  MIN_KEYBOARD_HEIGHT,
38
43
  } from './webViewport'
39
- import { SheetProvider } from './SheetContext'
40
- import type { SheetProps, SnapPointsMode } from './types'
44
+ import {
45
+ SheetAnimatedPositionContext,
46
+ SheetOverlayLayerContext,
47
+ SheetProvider,
48
+ } from './SheetContext'
49
+ import type {
50
+ SheetProps,
51
+ SheetTransitionCause,
52
+ SheetTransitionEvent,
53
+ SnapPointsMode,
54
+ } from './types'
41
55
  import { useGestureHandlerPan } from './useGestureHandlerPan'
42
56
  import { useKeyboardControllerSheet } from './useKeyboardControllerSheet'
43
57
  import { SafeAreaInsetsContext, useSafeAreaInsets } from './useSafeAreaInsets'
@@ -56,6 +70,11 @@ const rnghRootStyleClosed = { width: '100%', height: 0 } as const
56
70
 
57
71
  let sheetHiddenStyleSheet: HTMLStyleElement | null = null
58
72
 
73
+ // stack of open modal sheets on web so escape only closes the top-most one.
74
+ // pushed on open (child sheets mount their effect after the parent, so the
75
+ // deepest sheet sits last), popped on close/unmount.
76
+ const sheetEscapeLayers: object[] = []
77
+
59
78
  // on web we are always relative to window, on to screen
60
79
  const relativeDimensionTo = isWeb ? 'window' : 'screen'
61
80
 
@@ -72,7 +91,7 @@ function getStableViewportHeight(): number {
72
91
  return Dimensions.get(relativeDimensionTo).height
73
92
  }
74
93
 
75
- export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
94
+ export const SheetImplementationCustom = createRefComponent<View, SheetProps>(
76
95
  function SheetImplementationCustom(props, forwardedRef) {
77
96
  const parentSheet = React.useContext(ParentSheetContext)
78
97
 
@@ -93,18 +112,15 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
93
112
  zIndex = parentSheet.zIndex + 1,
94
113
  moveOnKeyboardChange = false,
95
114
  unmountChildrenWhenHidden = false,
96
- disableTransparencyHide = false,
115
+ disableHideWhenClosed = false,
97
116
  portalProps,
98
117
  containerComponent: ContainerComponent = React.Fragment,
99
- onAnimationComplete,
118
+ onTransition,
100
119
  } = props
101
120
 
102
121
  const state = useSheetOpenState(props)
103
- const [overlayComponent, setOverlayComponent] = React.useState<React.ReactNode>(null)
104
122
 
105
- const providerProps = useSheetProviderProps(props, state, {
106
- onOverlayComponent: setOverlayComponent,
107
- })
123
+ const providerProps = useSheetProviderProps(props, state)
108
124
  const {
109
125
  frameSize,
110
126
  setFrameSize,
@@ -126,12 +142,7 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
126
142
  const sheetRef = React.useRef<View>(undefined as unknown as View)
127
143
  const ref = useComposedRefs(forwardedRef, sheetRef, providerProps.contentRef as any)
128
144
 
129
- // TODO this can be extracted into a helper getAnimationConfig(animationProp as array | string)
130
- const { animationDriver } = useConfiguration()
131
-
132
- if (!animationDriver) {
133
- throw new Error(`Sheet requires an animation driver to be set`)
134
- }
145
+ const animationDriver = useAnimationDriver()
135
146
 
136
147
  const transitionConfig = (() => {
137
148
  // explicit transitionConfig prop always takes precedence
@@ -146,9 +157,17 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
146
157
  : ([transition] as const)
147
158
 
148
159
  // look up named animation config from driver if available
149
- if (animationProp && animationDriver.animations?.[animationProp as string]) {
160
+ const namedConfig =
161
+ animationProp && animationDriver.animations?.[animationProp as string]
162
+ if (namedConfig) {
163
+ // css stores string configs (e.g. '150ms ease-out'); object-spreading a
164
+ // string produces char-indexed junk. the css visual is driven by the DOM
165
+ // `transition` prop, so pass only any explicit override object through.
166
+ if (typeof namedConfig === 'string') {
167
+ return animationPropConfig ?? null
168
+ }
150
169
  return {
151
- ...animationDriver.animations[animationProp as string],
170
+ ...namedConfig,
152
171
  ...animationPropConfig,
153
172
  }
154
173
  }
@@ -334,7 +353,6 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
334
353
  ? preKeyboardFrameSize.current
335
354
  : 0
336
355
 
337
- const { useAnimatedNumber, useAnimatedNumberStyle } = animationDriver
338
356
  const AnimatedView = (animationDriver.View ?? TamaguiView) as typeof Animated.View
339
357
 
340
358
  useIsomorphicLayoutEffect(() => {
@@ -367,8 +385,31 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
367
385
 
368
386
  const hasScrollView = React.useRef(false)
369
387
 
370
- // safety fallback timer for sheet close opacity
371
- const opacityFallbackTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)
388
+ // snap index of the last animated move, so a transition can be classified
389
+ // as open (from closed), snap (between snap points), or close.
390
+ const lastPositionIndexRef = React.useRef(-1)
391
+ // the in-flight transition, so a superseding move reports it interrupted.
392
+ const pendingTransitionRef = React.useRef<{
393
+ cause: SheetTransitionCause
394
+ position: number
395
+ } | null>(null)
396
+
397
+ const emitTransition = useEvent(
398
+ (
399
+ phase: 'start' | 'end',
400
+ event: { cause: SheetTransitionCause; position: number },
401
+ finished?: boolean
402
+ ) => {
403
+ const e: SheetTransitionEvent = {
404
+ phase,
405
+ cause: event.cause,
406
+ position: event.position,
407
+ }
408
+ if (phase === 'end') e.finished = finished
409
+ onTransition?.(e)
410
+ controller?.onTransition?.(e)
411
+ }
412
+ )
372
413
 
373
414
  const syncAnimatedPosition = useEvent((value: number) => {
374
415
  at.current = value
@@ -440,21 +481,54 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
440
481
  const closeTarget = isWeb
441
482
  ? Math.max(effScreenSize, getMaxViewportHeight())
442
483
  : effScreenSize
443
- let toValue = isHidden || position === -1 ? closeTarget : activePositions[position]
444
-
445
- if (at.current === toValue) return
484
+ // dismissOnSnapToBottom appends an offscreen snap point. Gesture release
485
+ // calls setPosition(dismissIndex) and animateTo(dismissIndex) in the same
486
+ // event, before React commits open=false and turns the provider position
487
+ // into -1. Treat that synthetic snap as close here so its in-flight
488
+ // callback owns display-none hiding and the Adapt presence handoff.
489
+ const isDismissPosition =
490
+ dismissOnSnapToBottom && position === activePositions.length - 1
491
+ const isOpenAnimation = position !== -1 && !isHidden && !isDismissPosition
492
+ const toValue = isOpenAnimation ? activePositions[position] : closeTarget
493
+
494
+ if (at.current === toValue) {
495
+ // a drag can land exactly on the synthetic dismiss point. there is no
496
+ // remaining distance to animate, but it is still a completed close and
497
+ // must release the same lifecycle consumers as an animated dismissal.
498
+ if (isDismissPosition) {
499
+ if (pendingTransitionRef.current) {
500
+ emitTransition('end', pendingTransitionRef.current, false)
501
+ pendingTransitionRef.current = null
502
+ }
503
+ stopSpring()
504
+ const event = { cause: 'close' as const, position: toValue }
505
+ lastPositionIndexRef.current = -1
506
+ emitTransition('start', event)
507
+ syncAnimatedPosition(toValue)
508
+ setIsFullyClosed(true)
509
+ emitTransition('end', event, true)
510
+ }
511
+ return
512
+ }
446
513
 
447
514
  at.current = toValue
448
- stopSpring()
449
515
 
450
- const isOpenAnimation = position !== -1 && !isHidden
451
-
452
- // clear any pending fallback timer
453
- if (opacityFallbackTimer.current) {
454
- clearTimeout(opacityFallbackTimer.current)
455
- opacityFallbackTimer.current = null
516
+ const cause: SheetTransitionCause = !isOpenAnimation
517
+ ? 'close'
518
+ : lastPositionIndexRef.current < 0
519
+ ? 'open'
520
+ : 'snap'
521
+ lastPositionIndexRef.current = isOpenAnimation ? position : -1
522
+ const event = { cause, position: toValue }
523
+
524
+ // a new move supersedes any in-flight one: report it interrupted
525
+ if (pendingTransitionRef.current) {
526
+ emitTransition('end', pendingTransitionRef.current, false)
527
+ pendingTransitionRef.current = null
456
528
  }
457
529
 
530
+ stopSpring()
531
+
458
532
  const animationCompleteCallback = () => {
459
533
  // a newer animateTo supersedes this one: drivers still fire the owed
460
534
  // completion callback when a new setValue replaces an in-flight one.
@@ -462,34 +536,22 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
462
536
  // this stale toValue would make the next animateTo to this position
463
537
  // no-op (at === toValue) while the dom sits somewhere else — on web
464
538
  // that leaves a reopened sheet parked offscreen at its close target.
539
+ // it would also null out the superseding move's pending transition
540
+ // and double-emit a completed end for an already-interrupted event.
465
541
  if (at.current !== toValue) return
466
542
  syncAnimatedPosition(toValue)
467
- if (opacityFallbackTimer.current) {
468
- clearTimeout(opacityFallbackTimer.current)
469
- opacityFallbackTimer.current = null
470
- }
471
- // use openRef (live) not open (stale closure) — if the sheet
472
- // was reopened before this callback fires (e.g. cancelled close
473
- // animation), we must not hide it
543
+ pendingTransitionRef.current = null
544
+ // use openRef (live) not open (stale closure) — if the sheet was
545
+ // reopened before this callback fires (e.g. cancelled close animation),
546
+ // we must not hide it
474
547
  if (!isOpenAnimation && !openRef.current) {
475
- setOpacity(0)
548
+ setIsFullyClosed(true)
476
549
  }
477
- onAnimationComplete?.({ open: isOpenAnimation })
478
- // also notify the SheetController so a parent (e.g. Dialog adapt)
479
- // can hold the sheet's children mounted until the slide-out is done
480
- controller?.onAnimationComplete?.({ open: isOpenAnimation })
550
+ emitTransition('end', event, true)
481
551
  }
482
552
 
483
- // safety fallback: if animation callback never fires, still hide the sheet
484
- if (!isOpenAnimation) {
485
- opacityFallbackTimer.current = setTimeout(() => {
486
- opacityFallbackTimer.current = null
487
- // check live open state via ref — sheet may have reopened (e.g. adapt handoff)
488
- if (!openRef.current) {
489
- setOpacity(0)
490
- }
491
- }, 1000)
492
- }
553
+ pendingTransitionRef.current = event
554
+ emitTransition('start', event)
493
555
 
494
556
  // skip animation when adapting from dialog to sheet
495
557
  if (skipAdaptAnimation.current) {
@@ -502,14 +564,32 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
502
564
  return
503
565
  }
504
566
 
505
- animatedNumber.setValue(
506
- toValue,
507
- animationOverride || {
508
- type: 'spring',
509
- ...transitionConfig,
510
- },
511
- animationCompleteCallback
512
- )
567
+ const resolvedConfig = animationOverride || {
568
+ type: 'spring',
569
+ ...transitionConfig,
570
+ }
571
+
572
+ // the sheet position spring moves hundreds of px. the spring drivers'
573
+ // default rest detection is tuned for tiny values (react-native Animated:
574
+ // 0.001px thresholds; reanimated 4: relative energyThreshold 6e-9), so for
575
+ // a sheet-sized move completion would fire 1.4-1.7s after the animation is
576
+ // visually done. these px-sized rest thresholds make close-complete prompt
577
+ // (~0.5-0.8s), which is what now drives display:none hiding and the Adapt
578
+ // presence release (no timers). user config still wins via spread order;
579
+ // each driver ignores the other driver's keys.
580
+ const springConfig =
581
+ !resolvedConfig.type || resolvedConfig.type === 'spring'
582
+ ? {
583
+ // react-native Animated (absolute px)
584
+ restDisplacementThreshold: 1,
585
+ restSpeedThreshold: 10,
586
+ // reanimated 4 (relative energy): ~0.3% of travel amplitude
587
+ energyThreshold: 1e-5,
588
+ ...resolvedConfig,
589
+ }
590
+ : resolvedConfig
591
+
592
+ animatedNumber.setValue(toValue, springConfig, animationCompleteCallback)
513
593
  })
514
594
 
515
595
  useIsomorphicLayoutEffect(() => {
@@ -833,6 +913,32 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
833
913
  }
834
914
  }, [open])
835
915
 
916
+ React.useEffect(() => {
917
+ if (!isWeb || !modal || !open || shouldHideParentSheet) return
918
+
919
+ const layer = {}
920
+ sheetEscapeLayers.push(layer)
921
+
922
+ const onKeyDown = (event: KeyboardEvent) => {
923
+ if (event.key === 'Escape') {
924
+ // only the top-most open modal sheet responds so a nested sheet
925
+ // doesn't take its parent down with it
926
+ if (sheetEscapeLayers[sheetEscapeLayers.length - 1] === layer) {
927
+ state.setOpen(false)
928
+ }
929
+ }
930
+ }
931
+
932
+ document.addEventListener('keydown', onKeyDown)
933
+ return () => {
934
+ const index = sheetEscapeLayers.indexOf(layer)
935
+ if (index > -1) {
936
+ sheetEscapeLayers.splice(index, 1)
937
+ }
938
+ document.removeEventListener('keydown', onKeyDown)
939
+ }
940
+ }, [modal, open, shouldHideParentSheet, state.setOpen])
941
+
836
942
  // gesture handler hook for RNGH-based gesture coordination
837
943
  const { panGesture, panGestureRef, gestureHandlerEnabled } = useGestureHandlerPan({
838
944
  positions: activePositions,
@@ -923,17 +1029,32 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
923
1029
 
924
1030
  const animatedStyle = useAnimatedNumberStyle(animatedNumber, getAnimatedNumberStyle)
925
1031
 
926
- // we need to set this *after* fully closed to 0, to avoid it overlapping
927
- // the page when resizing quickly on web for example
928
- const [opacity, setOpacity] = React.useState(open ? 1 : 0)
929
- if (open && opacity === 0) {
930
- setOpacity(1)
931
- // cancel any pending close fallback sheet is reopening
932
- if (opacityFallbackTimer.current) {
933
- clearTimeout(opacityFallbackTimer.current)
934
- opacityFallbackTimer.current = null
935
- }
1032
+ // a fully-closed sheet is hidden with display:none (set from the
1033
+ // close-complete transition event) so it never overlaps the page when
1034
+ // resizing quickly on web. it starts NOT hidden — the frame must be laid
1035
+ // out to measure its size (display:none has no layout box, so hiding before
1036
+ // the first measurement would leave frameSize/screenSize at 0). it un-hides
1037
+ // synchronously in render on re-open, before layout, keeping the retained
1038
+ // frame size. the closed-but-never-opened frame stays off screen via its
1039
+ // translateY, so leaving it laid out is not visible.
1040
+ const [isFullyClosed, setIsFullyClosed] = React.useState(false)
1041
+ if (open && isFullyClosed) {
1042
+ setIsFullyClosed(false)
1043
+ }
1044
+ // whether the sheet is visually active: open, or still animating out.
1045
+ // isFullyClosed only flips true from the close-animation-complete callback,
1046
+ // so it stays false for a mounted-but-never-opened sheet - track first open
1047
+ // separately so a closed sheet is inactive from mount. drives the portal
1048
+ // host's visibility (see Portal.tsx on why closed hosts must be hidden).
1049
+ const hasEverOpened = React.useRef(open)
1050
+ if (open) {
1051
+ hasEverOpened.current = true
936
1052
  }
1053
+ const isVisuallyActive = open || (hasEverOpened.current && !isFullyClosed)
1054
+ // shouldHideParentSheet (a nested sheet on native gorhom) hides the parent
1055
+ // immediately; disableHideWhenClosed opts the closed wrapper out of hiding
1056
+ // but never overrides the nested-sheet hide.
1057
+ const applyHidden = shouldHideParentSheet || (isFullyClosed && !disableHideWhenClosed)
937
1058
 
938
1059
  const forcedContentHeight = hasFit
939
1060
  ? undefined
@@ -945,12 +1066,25 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
945
1066
  const setHasScrollView = React.useCallback((val: boolean) => {
946
1067
  hasScrollView.current = val
947
1068
  }, [])
948
- // const id = useId()
949
- // const { AdaptProvider, when, children } = useAdaptParent({
950
- // scope: `${id}Sheet`,
951
- // portal: true,
952
- // })
953
1069
 
1070
+ // publish the live animated position so user code can build drag-linked
1071
+ // effects (e.g. an overlay fade) via Sheet.useAnimatedPosition(). positions
1072
+ // are the resolved px offsets matching snapPoints order; minY is topmost.
1073
+ const animatedPositionValue = React.useMemo(
1074
+ () => ({
1075
+ value: animatedNumber,
1076
+ screenSize: effScreenSize,
1077
+ frameSize,
1078
+ snapOffsets: activePositions,
1079
+ minY: activePositions[0] ?? 0,
1080
+ }),
1081
+ [animatedNumber, effScreenSize, frameSize, activePositions]
1082
+ )
1083
+
1084
+ const { overlayChildren, animatedChildren } = React.useMemo(
1085
+ () => partitionSheetChildren(props.children),
1086
+ [props.children]
1087
+ )
954
1088
  let contents = (
955
1089
  <LayoutMeasurementController disable={!open}>
956
1090
  <ParentSheetContext.Provider value={nextParentContext}>
@@ -968,66 +1102,66 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
968
1102
  panGesture={panGesture}
969
1103
  panGestureRef={panGestureRef}
970
1104
  >
971
- <AnimatePresence custom={{ open }}>
972
- {shouldHideParentSheet || !open ? null : overlayComponent}
973
- </AnimatePresence>
974
-
975
- {snapPointsMode !== 'percent' && (
976
- <View
977
- style={{
978
- opacity: 0,
979
- position: 'absolute',
980
- top: 0,
981
- left: 0,
982
- right: 0,
983
- bottom: 0,
984
- pointerEvents: 'none',
985
- }}
986
- onLayout={handleMaxContentViewLayout}
987
- />
988
- )}
989
-
990
- <AnimatedView
991
- ref={ref}
992
- onLayout={handleAnimationViewLayout}
993
- // @ts-ignore for CSS driver this is necessary to attach the transition
994
- // also motion driver at least though i suspect all drivers?
995
- transition={isDragging || disableAnimation ? null : transition}
996
- // @ts-ignore
997
- disableClassName
998
- style={[
999
- {
1000
- position: 'absolute',
1001
- zIndex,
1002
- width: '100%',
1003
- height: forcedContentHeight,
1004
- minHeight: forcedContentHeight,
1005
- opacity: shouldHideParentSheet
1006
- ? 0
1007
- : disableTransparencyHide
1008
- ? 1
1009
- : opacity,
1010
- ...((shouldHideParentSheet || !open) && {
1011
- pointerEvents: 'none',
1012
- }),
1013
- },
1014
- animatedStyle,
1015
- ]}
1016
- >
1017
- {/* wrap children with plain RN View for panResponder - tamagui views no longer handle responder events on web */}
1018
- {gestureHandlerEnabled && panGesture ? (
1019
- <GestureDetectorWrapper gesture={panGesture} style={{ flex: 1 }}>
1020
- {props.children}
1021
- </GestureDetectorWrapper>
1022
- ) : (
1105
+ <SheetAnimatedPositionContext.Provider value={animatedPositionValue}>
1106
+ <SheetOverlayLayerContext.Provider value>
1107
+ <AnimatePresence custom={{ open }}>
1108
+ {shouldHideParentSheet || !open ? null : overlayChildren}
1109
+ </AnimatePresence>
1110
+ </SheetOverlayLayerContext.Provider>
1111
+
1112
+ {snapPointsMode !== 'percent' && (
1023
1113
  <View
1024
- {...panResponder?.panHandlers}
1025
- style={{ flex: 1, width: '100%', height: '100%' }}
1026
- >
1027
- {props.children}
1028
- </View>
1114
+ style={{
1115
+ opacity: 0,
1116
+ position: 'absolute',
1117
+ top: 0,
1118
+ left: 0,
1119
+ right: 0,
1120
+ bottom: 0,
1121
+ pointerEvents: 'none',
1122
+ }}
1123
+ onLayout={handleMaxContentViewLayout}
1124
+ />
1029
1125
  )}
1030
- </AnimatedView>
1126
+
1127
+ <AnimatedView
1128
+ ref={ref}
1129
+ onLayout={handleAnimationViewLayout}
1130
+ // @ts-ignore for CSS driver this is necessary to attach the transition
1131
+ // also motion driver at least though i suspect all drivers?
1132
+ transition={isDragging || disableAnimation ? null : transition}
1133
+ // @ts-ignore
1134
+ disableClassName
1135
+ style={[
1136
+ {
1137
+ position: 'absolute',
1138
+ zIndex,
1139
+ width: '100%',
1140
+ height: forcedContentHeight,
1141
+ minHeight: forcedContentHeight,
1142
+ ...(applyHidden && { display: 'none' }),
1143
+ ...((shouldHideParentSheet || !open) && {
1144
+ pointerEvents: 'none',
1145
+ }),
1146
+ },
1147
+ animatedStyle,
1148
+ ]}
1149
+ >
1150
+ {/* wrap children with plain RN View for panResponder - tamagui views no longer handle responder events on web */}
1151
+ {gestureHandlerEnabled && panGesture ? (
1152
+ <GestureDetectorWrapper gesture={panGesture} style={{ flex: 1 }}>
1153
+ {animatedChildren}
1154
+ </GestureDetectorWrapper>
1155
+ ) : (
1156
+ <View
1157
+ {...panResponder?.panHandlers}
1158
+ style={{ flex: 1, width: '100%', height: '100%' }}
1159
+ >
1160
+ {animatedChildren}
1161
+ </View>
1162
+ )}
1163
+ </AnimatedView>
1164
+ </SheetAnimatedPositionContext.Provider>
1031
1165
  </GestureSheetProvider>
1032
1166
  </SheetProvider>
1033
1167
  </ParentSheetContext.Provider>
@@ -1035,7 +1169,6 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
1035
1169
  )
1036
1170
 
1037
1171
  if (process.env.TAMAGUI_TARGET === 'native' && needsPortalRepropagation()) {
1038
- // TODO alongside sheet scope="" need to pass scope here
1039
1172
  const adaptContext = useAdaptContext()
1040
1173
  contents = (
1041
1174
  <ProvideAdaptContext {...adaptContext}>
@@ -1051,7 +1184,7 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
1051
1184
  }
1052
1185
 
1053
1186
  // start mounted so we get an accurate measurement the first time
1054
- const shouldMountChildren = unmountChildrenWhenHidden ? !!opacity : true
1187
+ const shouldMountChildren = unmountChildrenWhenHidden ? !isFullyClosed : true
1055
1188
 
1056
1189
  if (modal) {
1057
1190
  // a modal sheet is teleported through <Portal> to the root portal host.
@@ -1071,7 +1204,7 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
1071
1204
  <ContainerComponent>{contents}</ContainerComponent>
1072
1205
  ) : null
1073
1206
  const modalContents = (
1074
- <Portal stackZIndex={zIndex} {...portalProps}>
1207
+ <Portal stackZIndex={zIndex} hidden={!isVisuallyActive} {...portalProps}>
1075
1208
  {mountedContents && RNGHRoot ? (
1076
1209
  <RNGHRoot style={open ? rnghRootStyleOpen : rnghRootStyleClosed}>
1077
1210
  {mountedContents}
@@ -1098,6 +1231,49 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
1098
1231
  }
1099
1232
  )
1100
1233
 
1234
+ type SheetPartStaticConfig = {
1235
+ [SHEET_OVERLAY_MARKER]?: boolean
1236
+ parentStaticConfig?: SheetPartStaticConfig
1237
+ }
1238
+
1239
+ export function isSheetOverlayComponent(type: unknown) {
1240
+ let staticConfig = (type as { staticConfig?: SheetPartStaticConfig } | null)
1241
+ ?.staticConfig
1242
+
1243
+ while (staticConfig) {
1244
+ if (staticConfig[SHEET_OVERLAY_MARKER]) {
1245
+ return true
1246
+ }
1247
+ staticConfig = staticConfig.parentStaticConfig
1248
+ }
1249
+
1250
+ return false
1251
+ }
1252
+
1253
+ function partitionSheetChildren(children: React.ReactNode) {
1254
+ const overlayChildren: React.ReactNode[] = []
1255
+ const animatedChildren: React.ReactNode[] = []
1256
+
1257
+ React.Children.forEach(children, (child) => {
1258
+ if (!React.isValidElement(child)) {
1259
+ animatedChildren.push(child)
1260
+ return
1261
+ }
1262
+
1263
+ if (isSheetOverlayComponent(child.type)) {
1264
+ overlayChildren.push(child)
1265
+ return
1266
+ }
1267
+
1268
+ animatedChildren.push(child)
1269
+ })
1270
+
1271
+ return {
1272
+ overlayChildren,
1273
+ animatedChildren,
1274
+ }
1275
+ }
1276
+
1101
1277
  function getYPositions(
1102
1278
  mode: SnapPointsMode,
1103
1279
  point: string | number,
@@ -1118,12 +1294,30 @@ function getYPositions(
1118
1294
  if (point.endsWith('%')) {
1119
1295
  const pct = Math.min(100, Math.max(0, Number(point.slice(0, -1)))) / 100
1120
1296
  if (Number.isNaN(pct)) {
1121
- console.warn('Invalid snapPoint percentage string')
1297
+ console.warn(
1298
+ formatDiagnostic(
1299
+ 'TAMAGUI_SHEET_SNAP_POINT',
1300
+ 'Sheet',
1301
+ 'snapPoints contains an invalid percentage string',
1302
+ 'Use "fit", a pixel number, or a percentage such as "50%"',
1303
+ 'snapPoint',
1304
+ point
1305
+ )
1306
+ )
1122
1307
  return 0
1123
1308
  }
1124
1309
  return Math.round(screenSize - pct * screenSize)
1125
1310
  }
1126
- console.warn('Invalid snapPoint unknown value')
1311
+ console.warn(
1312
+ formatDiagnostic(
1313
+ 'TAMAGUI_SHEET_SNAP_POINT',
1314
+ 'Sheet',
1315
+ 'snapPoints contains an unsupported mixed-mode value',
1316
+ 'Use "fit", a pixel number, or a percentage such as "50%"',
1317
+ 'snapPoint',
1318
+ point
1319
+ )
1320
+ )
1127
1321
  return 0
1128
1322
  }
1129
1323
 
@@ -1138,7 +1332,16 @@ function getYPositions(
1138
1332
 
1139
1333
  const pct = Math.min(100, Math.max(0, Number(point))) / 100
1140
1334
  if (Number.isNaN(pct)) {
1141
- console.warn('Invalid snapPoint percentage')
1335
+ console.warn(
1336
+ formatDiagnostic(
1337
+ 'TAMAGUI_SHEET_SNAP_POINT',
1338
+ 'Sheet',
1339
+ 'snapPoints contains a value that cannot be converted to a percentage',
1340
+ 'Use a numeric percentage such as 50',
1341
+ 'snapPoint',
1342
+ point
1343
+ )
1344
+ )
1142
1345
  return 0
1143
1346
  }
1144
1347