@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
@@ -1,10 +1,9 @@
1
1
  import { composeRefs } from '@tamagui/compose-refs'
2
- import { isWeb, View, type GetRef } from '@tamagui/core'
3
- import type { ScrollViewProps } from '@tamagui/scroll-view'
2
+ import { createStyledHOC, isWeb, View, type GetProps } from '@tamagui/core'
3
+ import type { ScrollViewRef } from '@tamagui/scroll-view'
4
4
  import { ScrollView } from '@tamagui/scroll-view'
5
5
  import { useControllableState } from '@tamagui/use-controllable-state'
6
6
  import React, { useEffect, useRef, useState } from 'react'
7
- import type { ScrollView as RNScrollView } from 'react-native'
8
7
  import { useGestureSheetContext } from './GestureSheetContext'
9
8
  import { getGestureHandlerState, isGestureHandlerEnabled } from './gestureState'
10
9
  import { useSheetContext } from './SheetContext'
@@ -20,21 +19,29 @@ import {
20
19
 
21
20
  const SHEET_SCROLL_VIEW_NAME = 'SheetScrollView'
22
21
 
23
- export const SheetScrollView = React.forwardRef<
24
- GetRef<typeof ScrollView>,
25
- ScrollViewProps
26
- >(
22
+ type SheetScrollViewBaseProps = GetProps<typeof ScrollView>
23
+
24
+ type SheetScrollViewProps = SheetScopedProps<
25
+ SheetScrollViewBaseProps & {
26
+ h?: SheetScrollViewBaseProps['height']
27
+ o?: SheetScrollViewBaseProps['opacity']
28
+ pos?: SheetScrollViewBaseProps['position']
29
+ }
30
+ >
31
+
32
+ export const SheetScrollView = createStyledHOC(
33
+ ScrollView,
27
34
  (
28
35
  {
29
- __scopeSheet,
36
+ scope,
30
37
  children,
31
38
  onScroll,
32
39
  scrollEnabled: scrollEnabledProp,
33
40
  ...props
34
- }: SheetScopedProps<ScrollViewProps>,
41
+ }: SheetScrollViewProps,
35
42
  ref
36
43
  ) => {
37
- const context = useSheetContext(SHEET_SCROLL_VIEW_NAME, __scopeSheet)
44
+ const context = useSheetContext(scope)
38
45
  const gestureContext = useGestureSheetContext()
39
46
  const { scrollBridge, setHasScrollView, hasFit, screenSize } = context
40
47
  const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0)
@@ -50,7 +57,7 @@ export const SheetScrollView = React.forwardRef<
50
57
  prop: scrollEnabledProp,
51
58
  defaultProp: true,
52
59
  })
53
- const scrollRef = React.useRef<RNScrollView | null>(null)
60
+ const scrollRef = React.useRef<ScrollViewRef | null>(null)
54
61
 
55
62
  const [hasScrollableContent, setHasScrollableContent] = useState(true)
56
63
  const parentHeight = useRef(0)
@@ -61,8 +68,8 @@ export const SheetScrollView = React.forwardRef<
61
68
  // closed), so the height now comes from the sheet, which doesn't remount.
62
69
  const frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0)
63
70
 
64
- // with snapPointsMode="fit", Frame is content-sized (flex: 0, flex-basis: auto, height: undefined).
65
- // a flex: 1 child can't grow inside a content-sized parent, so the ScrollView (and the Frame
71
+ // with snapPointsMode="fit", Container is content-sized (flex: 0, flex-basis: auto, height: undefined).
72
+ // a flex: 1 child can't grow inside a content-sized parent, so the ScrollView (and the Container
66
73
  // around it) collapse to 0 height. instead, let the ScrollView size to its content and cap it
67
74
  // at the available viewport (screenSize / maxContentSize) so scrolling kicks in for tall content.
68
75
  const fitSizingStyle = hasFit
@@ -364,5 +371,9 @@ export const SheetScrollView = React.forwardRef<
364
371
  {contentWrapper}
365
372
  </ScrollView>
366
373
  )
374
+ },
375
+ {
376
+ disableTheme: true,
377
+ displayName: SHEET_SCROLL_VIEW_NAME,
367
378
  }
368
379
  )
package/src/constants.tsx CHANGED
@@ -1,5 +1,5 @@
1
- export const constants = {}
2
-
3
- export const SHEET_NAME = 'Sheet'
1
+ export const SHEET_CONTAINER_NAME = 'SheetContainer'
2
+ export const SHEET_BACKGROUND_NAME = 'SheetBackground'
4
3
  export const SHEET_HANDLE_NAME = 'SheetHandle'
5
4
  export const SHEET_OVERLAY_NAME = 'SheetOverlay'
5
+ export const SHEET_OVERLAY_MARKER = Symbol('SheetOverlay')
package/src/helpers.tsx CHANGED
@@ -15,17 +15,3 @@ export function resisted(y: number, minY: number, maxOverflow = 25) {
15
15
  // Return the position with resistance applied
16
16
  return minY - resistedDistance
17
17
  }
18
-
19
- // // set all the way off screen
20
- // // + 0.1 ensures this is unique - see hasntMeasured ref
21
-
22
- // let hiddenSize: number
23
-
24
- // export function getHiddenSize() {
25
- // if (hiddenSize == undefined) {
26
- // // this trigger reflow on web avoid doing on startup
27
- // const screen = Dimensions.get('screen')
28
- // hiddenSize = Math.max(screen.height, screen.width) + 0.1
29
- // }
30
- // return hiddenSize
31
- // }
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './Sheet'
2
- export * from './useSheet'
3
- export * from './createSheet'
2
+ // public so copied skins can forward the open state into their own styled parts
3
+ // (e.g. the Handle's open-driven opacity variant).
4
+ export { useSheetContext } from './SheetContext'
4
5
  export * from './SheetController'
5
6
  export * from './useSheetController'
6
7
  export * from './useSheetOpenState'
@@ -9,7 +10,3 @@ export * from './SheetScrollView'
9
10
  export * from './nativeSheet'
10
11
  export * from './types'
11
12
  export * from './contexts'
12
- export {
13
- getGestureHandlerState as unstable_getSheetGestureHandlerState,
14
- isGestureHandlerEnabled as unstable_isSheetGestureHandlerEnabled,
15
- } from './gestureState'
@@ -2,13 +2,11 @@ import { YStack } from '@tamagui/stacks'
2
2
  import type { FunctionComponent } from 'react'
3
3
  import { useEffect, useRef } from 'react'
4
4
  import { View } from 'react-native'
5
- import { SheetProvider } from './SheetContext'
5
+ import { SheetNativeSystemContext, SheetProvider } from './SheetContext'
6
6
  import type { SheetProps } from './types'
7
7
  import { useSheetOpenState } from './useSheetOpenState'
8
8
  import { useSheetProviderProps } from './useSheetProviderProps'
9
9
 
10
- // import { useSheetSnapPoints } from './useSheetSnapPoints'
11
-
12
10
  type SheetNativePlatforms = 'ios'
13
11
 
14
12
  const nativeSheets: Record<SheetNativePlatforms, FunctionComponent<SheetProps> | null> = {
@@ -29,8 +27,6 @@ export function setupNativeSheet(
29
27
  nativeSheets[platform] = (props: SheetProps) => {
30
28
  const state = useSheetOpenState(props)
31
29
  const providerProps = useSheetProviderProps(props, state)
32
- // const { position } = providerProps
33
- // const { positions } = useSheetSnapPoints(providerProps)
34
30
 
35
31
  const { open, setOpen } = state
36
32
  const ref = useRef<{
@@ -51,21 +47,15 @@ export function setupNativeSheet(
51
47
  setOpen(next)
52
48
  }
53
49
 
54
- // modalContentPreferredContentSize={{
55
- // mode: 'percent',
56
- // percentWidth: '100%',
57
- // percentHeight:
58
- // }}
59
-
60
50
  return (
61
- <>
51
+ <SheetNativeSystemContext.Provider value>
62
52
  <SheetProvider
63
53
  setHasScrollView={emptyFn}
64
54
  keyboardOccludedHeight={0}
65
55
  isKeyboardVisible={false}
66
56
  keyboardStableFrameHeight={0}
67
57
  {...providerProps}
68
- onlyShowFrame
58
+ onlyShowContainer
69
59
  >
70
60
  <ModalSheetView ref={ref} onModalDidDismiss={() => setOpenInternal(false)}>
71
61
  <ModalSheetViewMainContent>
@@ -77,7 +67,7 @@ export function setupNativeSheet(
77
67
  {/* so just hiding it here for now... not great... */}
78
68
  <YStack
79
69
  position="absolute"
80
- opacity={0}
70
+ display="none"
81
71
  pointerEvents="none"
82
72
  width={0}
83
73
  height={0}
@@ -85,7 +75,7 @@ export function setupNativeSheet(
85
75
  {props.children}
86
76
  </YStack>
87
77
  </SheetProvider>
88
- </>
78
+ </SheetNativeSystemContext.Provider>
89
79
  )
90
80
  }
91
81
  }
package/src/types.tsx CHANGED
@@ -1,99 +1,113 @@
1
1
  import type { AnimatedNumberStrategy, TransitionProp } from '@tamagui/core'
2
- import type { ScopedProps } from '@tamagui/create-context'
3
2
  import type { PortalProps } from '@tamagui/portal'
4
3
  import type { RemoveScroll } from '@tamagui/remove-scroll'
5
4
  import type { ReactNode } from 'react'
6
5
  import type React from 'react'
7
6
 
8
- export type SheetProps = ScopedProps<
9
- {
10
- open?: boolean
11
- defaultOpen?: boolean
12
- onOpenChange?: OpenChangeHandler
13
-
14
- /**
15
- * Control the index of the position in the `snapPoints` array
16
- */
17
- position?: number
18
-
19
- /**
20
- * Initial position from the `snapPoints` array
21
- */
22
- defaultPosition?: number
23
-
24
- /**
25
- * Array of pixels or percents the Sheet will attempt to move to when dragged.
26
- * The first is the topmost and default when first opened via open prop.
27
- */
28
- snapPoints?: (string | number)[]
29
-
30
- snapPointsMode?: SnapPointsMode
31
- onPositionChange?: PositionChangeHandler
32
- children?: ReactNode
33
- dismissOnOverlayPress?: boolean
34
- dismissOnSnapToBottom?: boolean
35
-
36
- /**
37
- * Disables the RemoveScroll behavior that prevents body scrolling while sheet is open.
38
- * By default, RemoveScroll is enabled when the sheet is open and modal.
39
- */
40
- disableRemoveScroll?: boolean
41
-
42
- /**
43
- * @deprecated Use `disableRemoveScroll` instead. This prop will be removed in a future version.
44
- * Note: `disableRemoveScroll={true}` is equivalent to `forceRemoveScrollEnabled={false}`
45
- */
46
- forceRemoveScrollEnabled?: boolean
47
-
48
- transitionConfig?: AnimatedNumberStrategy
49
-
50
- /**
51
- * By default Sheet will prefer the open prop over a parent component that is
52
- * controlling it via Adapt. In general if you want to Adapt to a sheet, you'd
53
- * leave the open prop undefined. If you'd like to have the parent override the
54
- * prop you've set manually on Sheet, set this to true.
55
- */
56
- preferAdaptParentOpenState?: boolean
57
-
58
- /**
59
- * (experimental) Remove the children while hidden (to save some performance, but can cause issues with animations)
60
- */
61
- unmountChildrenWhenHidden?: boolean
62
-
63
- /**
64
- * Keep the sheet content wrapper opaque while the sheet is hidden.
65
- * Useful for native visual effects that cannot initialize below a transparent ancestor.
66
- */
67
- disableTransparencyHide?: boolean
68
-
69
- /**
70
- * Adapts the sheet to use native sheet on the given platform (if available)
71
- */
72
- native?: 'ios'[] | boolean
73
-
74
- /**
75
- * Pass if you're using the CSS animation driver
76
- */
77
- transition?: TransitionProp
78
- handleDisableScroll?: boolean
79
- disableDrag?: boolean
80
- modal?: boolean
81
- zIndex?: number
82
- portalProps?: PortalProps
83
- /**
84
- * Makes the sheet move up when the mobile keyboard opens so the focused input remains visible.
85
- * Works on native (via keyboard events) and on mobile web (via the VisualViewport API).
86
- */
87
- moveOnKeyboardChange?: boolean
88
- containerComponent?: React.ComponentType<any>
89
-
90
- /**
91
- * Called when the sheet open/close animation completes.
92
- */
93
- onAnimationComplete?: (info: { open: boolean }) => void
94
- },
95
- 'Sheet'
96
- >
7
+ export type SheetScopes = string
8
+
9
+ export type SheetScopedProps<P> = Omit<P, 'scope'> & {
10
+ scope?: SheetScopes
11
+ }
12
+
13
+ export type SheetProps = SheetScopedProps<{
14
+ open?: boolean
15
+ defaultOpen?: boolean
16
+ onOpenChange?: OpenChangeHandler
17
+
18
+ /**
19
+ * Control the index of the position in the `snapPoints` array
20
+ */
21
+ position?: number
22
+
23
+ /**
24
+ * Initial position from the `snapPoints` array
25
+ */
26
+ defaultPosition?: number
27
+
28
+ /**
29
+ * Array of pixels or percents the Sheet will attempt to move to when dragged.
30
+ * The first is the topmost and default when first opened via open prop.
31
+ */
32
+ snapPoints?: (string | number)[]
33
+
34
+ snapPointsMode?: SnapPointsMode
35
+ onPositionChange?: PositionChangeHandler
36
+ children?: ReactNode
37
+ dismissOnOverlayPress?: boolean
38
+ dismissOnSnapToBottom?: boolean
39
+
40
+ /**
41
+ * Disables the RemoveScroll behavior that prevents body scrolling while sheet is open.
42
+ * By default, RemoveScroll is enabled when the sheet is open and modal.
43
+ */
44
+ disableRemoveScroll?: boolean
45
+
46
+ transitionConfig?: AnimatedNumberStrategy
47
+
48
+ /**
49
+ * By default Sheet will prefer the open prop over a parent component that is
50
+ * controlling it via Adapt. In general if you want to Adapt to a sheet, you'd
51
+ * leave the open prop undefined. If you'd like to have the parent override the
52
+ * prop you've set manually on Sheet, set this to true.
53
+ */
54
+ preferAdaptParentOpenState?: boolean
55
+
56
+ /**
57
+ * (experimental) Remove the children while hidden (to save some performance, but can cause issues with animations)
58
+ */
59
+ unmountChildrenWhenHidden?: boolean
60
+
61
+ /**
62
+ * By default a fully-closed sheet wrapper is hidden with `display: 'none'`.
63
+ * Set this to keep the closed wrapper laid out (e.g. for native visual effects
64
+ * that cannot initialize below a hidden ancestor). `pointerEvents` still gates
65
+ * interaction while closed.
66
+ */
67
+ disableHideWhenClosed?: boolean
68
+
69
+ /**
70
+ * Adapts the sheet to use native sheet on the given platform (if available)
71
+ * The iOS system sheet does not expose continuous position, so
72
+ * `Sheet.useAnimatedPosition` and `onTransition` are unavailable in this mode.
73
+ */
74
+ native?: 'ios'[] | boolean
75
+
76
+ /**
77
+ * Pass if you're using the CSS animation driver
78
+ */
79
+ transition?: TransitionProp
80
+ handleDisableScroll?: boolean
81
+ disableDrag?: boolean
82
+ modal?: boolean
83
+ zIndex?: number
84
+ portalProps?: PortalProps
85
+ /**
86
+ * Makes the sheet move up when the mobile keyboard opens so the focused input remains visible.
87
+ * Works on native (via keyboard events) and on mobile web (via the VisualViewport API).
88
+ */
89
+ moveOnKeyboardChange?: boolean
90
+ containerComponent?: React.ComponentType<any>
91
+
92
+ /**
93
+ * Fires at the start and end of the sheet's position transition. `cause` is
94
+ * `open` when moving from closed, `close` when moving off screen, and `snap`
95
+ * when moving between snap points while open. On the `end` phase, `finished`
96
+ * is `false` when the transition was interrupted (e.g. a close canceled by a
97
+ * re-open). `position` is the resolved translateY (px from screen top) target.
98
+ * Available on Tamagui's custom Sheet, not the native iOS system sheet.
99
+ */
100
+ onTransition?: (e: SheetTransitionEvent) => void
101
+ }>
102
+
103
+ export type SheetTransitionCause = 'open' | 'close' | 'snap'
104
+
105
+ export type SheetTransitionEvent = {
106
+ phase: 'start' | 'end'
107
+ cause: SheetTransitionCause
108
+ position: number
109
+ finished?: boolean
110
+ }
97
111
 
98
112
  export type PositionChangeHandler = (position: number) => void
99
113
 
@@ -105,8 +119,6 @@ export type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>
105
119
 
106
120
  export type SnapPointsMode = 'percent' | 'constant' | 'fit' | 'mixed'
107
121
 
108
- export type SheetScopedProps<A> = ScopedProps<A, 'Sheet'>
109
-
110
122
  export type ScrollBridge = {
111
123
  enabled: boolean
112
124
  y: number
@@ -97,10 +97,15 @@ export function useKeyboardControllerSheet(
97
97
  }
98
98
  }, [enabled, keyboardControllerEnabled])
99
99
 
100
- // fallback to basic Keyboard API when keyboard-controller not available
100
+ // basic Keyboard API listeners, always on: keyboard-controller's events only
101
+ // fire when the app mounts its KeyboardProvider, and `enabled` above only
102
+ // proves the module is linked. an app (or the detox harness, which launches
103
+ // with disableKeyboardController) that skips the provider would otherwise get
104
+ // silently dead keyboard tracking - the sheet never moves and the scroll
105
+ // occlusion padding never applies. RN's Keyboard events always fire, so they
106
+ // are the baseline; when both fire the extra setState is a same-value no-op.
101
107
  useEffect(() => {
102
108
  if (!enabled) return
103
- if (keyboardControllerEnabled) return
104
109
 
105
110
  const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'
106
111
  const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'
@@ -1,3 +1,4 @@
1
+ import { getSafeArea } from '@tamagui/native'
1
2
  import * as React from 'react'
2
3
  import { SafeAreaInsetsContext as RNSafeAreaInsetsContext } from 'react-native-safe-area-context'
3
4
 
@@ -9,21 +10,27 @@ import type { SafeAreaInsets } from './useSafeAreaInsets'
9
10
  export const SafeAreaInsetsContext =
10
11
  RNSafeAreaInsetsContext as unknown as React.Context<SafeAreaInsets | null>
11
12
 
13
+ const safeArea = getSafeArea()
14
+
15
+ function useContextInsets(): SafeAreaInsets | null {
16
+ return React.useContext(SafeAreaInsetsContext)
17
+ }
18
+
12
19
  /**
13
- * Live safe-area insets (notch / status bar / home indicator) read from the
14
- * context the app's SafeAreaProvider provides.
20
+ * live safe-area insets (notch / status bar / home indicator).
15
21
  *
16
- * Read this in a component BODY that renders inside the provider. The Sheet does
17
- * exactly that only its modal CONTENT is teleported out through the portal, so
18
- * the body still sees the real insets. This is the one read that works in real
19
- * native bundles:
20
- * - `getSafeArea()` (the @tamagui/native abstraction) is frequently NOT enabled
21
- * against the instance a component reads, so it returns 0.
22
- * - a dynamic `require('react-native-safe-area-context')` throws "Unknown named
23
- * module" in metro/rolldown bundles where the package isn't in the importing
24
- * module's graph.
25
- * A static import + context read avoids both.
22
+ * setup-safe-area installs a context-to-store feed so every store subscriber
23
+ * sees provider updates. Without that setup, keep the direct context read that
24
+ * lets Sheet work independently.
26
25
  */
27
26
  export function useSafeAreaInsets(): SafeAreaInsets | null {
28
- return React.useContext(SafeAreaInsetsContext)
27
+ const [useFeed] = React.useState(() => safeArea.state.useSafeAreaInsets)
28
+ const contextInsets = (useFeed || useContextInsets)()
29
+ const storeInsets = React.useSyncExternalStore(
30
+ safeArea.subscribe,
31
+ safeArea.getInsets,
32
+ safeArea.getInsets
33
+ )
34
+
35
+ return useFeed ? storeInsets : contextInsets
29
36
  }
@@ -1,7 +1,12 @@
1
- import React from 'react'
1
+ import type React from 'react'
2
+ import { createStyledContext, type StyledContext } from '@tamagui/core'
2
3
 
3
- export const useSheetController = () => {
4
- const controller = React.useContext(SheetControllerContext)
4
+ import type { SheetTransitionEvent } from './types'
5
+
6
+ export const useSheetController = (scope?: string) => {
7
+ const controller = SheetControllerContext.useStyledContext(
8
+ scope
9
+ ) as SheetControllerContextValue | null
5
10
  const isHidden = controller?.hidden
6
11
  const isShowingNonSheet = isHidden && controller?.open
7
12
  return {
@@ -12,8 +17,11 @@ export const useSheetController = () => {
12
17
  }
13
18
  }
14
19
 
15
- export const SheetControllerContext =
16
- React.createContext<SheetControllerContextValue | null>(null)
20
+ export const SheetControllerContext = createStyledContext<SheetControllerContextValue>(
21
+ null as any,
22
+ 'SheetController__'
23
+ ) as StyledContext<SheetControllerContextValue> &
24
+ React.Context<SheetControllerContextValue | null>
17
25
 
18
26
  export type SheetControllerContextValue = {
19
27
  id?: string
@@ -22,10 +30,10 @@ export type SheetControllerContextValue = {
22
30
  // hide without "closing" to prevent re-animation when shown again
23
31
  hidden?: boolean
24
32
  onOpenChange?: React.Dispatch<React.SetStateAction<boolean>> | ((val: boolean) => void)
25
- // fired by the sheet after its open/close animation finishes. used by
33
+ // fired by the sheet at the start/end of its position transition. used by
26
34
  // Dialog adapt to know when it's safe to tear down adapted children
27
35
  // without cutting off the slide-out mid-animation.
28
- onAnimationComplete?: (state: { open: boolean }) => void
36
+ onTransition?: (e: SheetTransitionEvent) => void
29
37
  // when true, the sheet should skip its open animation (used for adapt handoff)
30
38
  skipNextAnimation?: boolean
31
39
  }
@@ -1,19 +1,65 @@
1
+ import { useAdaptContext, useAdaptTarget } from '@tamagui/adapt'
2
+ import React from 'react'
1
3
  import { useControllableState } from '@tamagui/use-controllable-state'
2
4
 
3
5
  import type { SheetProps } from './types'
6
+ import type { SheetControllerContextValue } from './useSheetController'
4
7
  import { useSheetController } from './useSheetController'
5
8
 
6
9
  export const useSheetOpenState = (props: SheetProps) => {
7
- const { isHidden, controller } = useSheetController()
10
+ const adaptContext = useAdaptContext()
11
+ const adapt = useAdaptTarget()
12
+ const { isHidden: controllerIsHidden, controller: legacyController } =
13
+ useSheetController(props.scope)
14
+ const shouldUseAdapt = Boolean(
15
+ adaptContext.open !== undefined || adaptContext.onOpenChange
16
+ )
17
+ // Dialog no longer mounts SheetController while Adapt is inactive, so the
18
+ // hidden state must come from the Adapt parent context even before a target
19
+ // can register through useAdaptTarget().
20
+ const isHidden = shouldUseAdapt ? !adaptContext.active : controllerIsHidden
21
+ const wasHiddenRef = React.useRef(isHidden)
22
+ // when the adapt target is exiting (media flipped off while the dialog stays
23
+ // open), Adapt keeps `active` true so the sheet stays mounted, and signals
24
+ // the close through handoff.hidden: drive the sheet's open state to false so
25
+ // it plays its exit animation and reports onTransition back to Adapt
26
+ const controllerOpen = shouldUseAdapt
27
+ ? Boolean(adaptContext.open) && !adaptContext.handoff.hidden
28
+ : legacyController?.open
29
+ const localSkipNextAnimation = Boolean(
30
+ wasHiddenRef.current && !isHidden && controllerOpen
31
+ )
32
+ const skipNextAnimation =
33
+ (shouldUseAdapt ? adapt?.handoff.skipNextAnimation : undefined) ??
34
+ localSkipNextAnimation
35
+
36
+ wasHiddenRef.current = isHidden
37
+
38
+ const adaptController = React.useMemo<SheetControllerContextValue | null>(() => {
39
+ if (!adapt || !shouldUseAdapt) return null
40
+
41
+ return {
42
+ open: adaptContext.open,
43
+ hidden: isHidden,
44
+ onOpenChange: adaptContext.active ? adaptContext.onOpenChange : undefined,
45
+ onTransition: adapt?.handoff.onTransition,
46
+ skipNextAnimation,
47
+ }
48
+ }, [adapt, adaptContext, isHidden, shouldUseAdapt, skipNextAnimation])
49
+
50
+ const controller = adaptController ?? legacyController
51
+ const controllerOnOpenChange =
52
+ (shouldUseAdapt && adaptContext.active ? adaptContext.onOpenChange : undefined) ??
53
+ legacyController?.onOpenChange
8
54
 
9
55
  const onOpenChangeInternal = (val: boolean) => {
10
- controller?.onOpenChange?.(val)
56
+ controllerOnOpenChange?.(val)
11
57
  props.onOpenChange?.(val)
12
58
  }
13
59
 
14
60
  const propVal = props.preferAdaptParentOpenState
15
- ? (controller?.open ?? props.open)
16
- : (props.open ?? controller?.open)
61
+ ? (controllerOpen ?? props.open)
62
+ : (props.open ?? controllerOpen)
17
63
 
18
64
  const [open, setOpen] = useControllableState({
19
65
  prop: propVal,
@@ -22,13 +22,7 @@ export type SheetContextValue = ReturnType<typeof useSheetProviderProps> & {
22
22
  setHasScrollView: (val: boolean) => void
23
23
  }
24
24
 
25
- export function useSheetProviderProps(
26
- props: SheetProps,
27
- state: SheetOpenState,
28
- options: {
29
- onOverlayComponent?: (comp: any) => void
30
- } = {}
31
- ) {
25
+ export function useSheetProviderProps(props: SheetProps, state: SheetOpenState) {
32
26
  const handleRef = React.useRef<TamaguiElement>(null)
33
27
  const contentRef = React.useRef<TamaguiElement>(null)
34
28
  const [frameSize, setFrameSize] = React.useState<number>(0)
@@ -179,23 +173,7 @@ export function useSheetProviderProps(
179
173
  return bridge
180
174
  })
181
175
 
182
- // Handle both new disableRemoveScroll and deprecated forceRemoveScrollEnabled
183
- let disableRemoveScroll: boolean | undefined
184
- if (props.disableRemoveScroll !== undefined) {
185
- // New prop: disableRemoveScroll={true} means RemoveScroll is disabled
186
- disableRemoveScroll = props.disableRemoveScroll || !open || !props.modal
187
- } else if (props.forceRemoveScrollEnabled !== undefined) {
188
- // Deprecated prop: forceRemoveScrollEnabled can override the default
189
- if (process.env.NODE_ENV === 'development') {
190
- console.warn(
191
- '[Sheet] forceRemoveScrollEnabled is deprecated. Use disableRemoveScroll instead.'
192
- )
193
- }
194
- disableRemoveScroll = !props.forceRemoveScrollEnabled
195
- } else {
196
- // Default: disabled when not open or not modal
197
- disableRemoveScroll = !open || !props.modal
198
- }
176
+ const disableRemoveScroll = props.disableRemoveScroll || !open || !props.modal
199
177
 
200
178
  const maxSnapPoint = snapPoints[0]
201
179
  const screenSize =
@@ -218,8 +196,7 @@ export function useSheetProviderProps(
218
196
  setFrameSize,
219
197
  dismissOnOverlayPress: props.dismissOnOverlayPress ?? true,
220
198
  dismissOnSnapToBottom: props.dismissOnSnapToBottom ?? false,
221
- onOverlayComponent: options.onOverlayComponent,
222
- scope: props.__scopeSheet,
199
+ scope: props.scope ?? '',
223
200
  hasFit,
224
201
  position,
225
202
  snapPoints,
@@ -227,7 +204,7 @@ export function useSheetProviderProps(
227
204
  setMaxContentSize,
228
205
  setPosition,
229
206
  setPositionImmediate,
230
- onlyShowFrame: false,
207
+ onlyShowContainer: false,
231
208
  }
232
209
 
233
210
  return providerProps
@@ -1,5 +1,5 @@
1
+ import type { ScrollViewRef } from '@tamagui/scroll-view'
1
2
  import { useEffect, useRef } from 'react'
2
- import type { ScrollView as RNScrollView } from 'react-native'
3
3
  import type { ScrollBridge } from './types'
4
4
 
5
5
  type GestureOwner = 'none' | 'pan' | 'scroll'
@@ -15,7 +15,7 @@ interface GestureState {
15
15
  }
16
16
 
17
17
  interface UseSheetScrollViewGesturesProps {
18
- scrollRef: React.RefObject<RNScrollView | null>
18
+ scrollRef: React.RefObject<ScrollViewRef | null>
19
19
  scrollBridge: ScrollBridge
20
20
  hasScrollableContent: boolean
21
21
  scrollEnabled: boolean