@hanzogui/sheet 8.3.0 → 8.3.2

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 (559) hide show
  1. package/dist/cjs/GestureDetectorWrapper.js +23 -0
  2. package/dist/cjs/GestureDetectorWrapper.js.map +1 -0
  3. package/dist/cjs/GestureSheetContext.js +21 -0
  4. package/dist/cjs/GestureSheetContext.js.map +1 -0
  5. package/dist/cjs/Sheet.js +102 -0
  6. package/dist/cjs/Sheet.js.map +1 -0
  7. package/dist/cjs/SheetContext.js +8 -0
  8. package/dist/cjs/SheetContext.js.map +1 -0
  9. package/dist/cjs/SheetController.js +33 -0
  10. package/dist/cjs/SheetController.js.map +1 -0
  11. package/dist/cjs/SheetImplementationCustom.js +866 -0
  12. package/dist/cjs/SheetImplementationCustom.js.map +1 -0
  13. package/dist/cjs/SheetScrollView.js +278 -0
  14. package/dist/cjs/SheetScrollView.js.map +1 -0
  15. package/dist/cjs/constants.js +8 -0
  16. package/dist/cjs/constants.js.map +1 -0
  17. package/dist/cjs/contexts.js +10 -0
  18. package/dist/cjs/contexts.js.map +1 -0
  19. package/dist/cjs/controller.js +11 -0
  20. package/dist/cjs/controller.js.map +1 -0
  21. package/dist/cjs/createSheet.js +153 -0
  22. package/dist/cjs/createSheet.js.map +1 -0
  23. package/dist/cjs/gestureState.js +35 -0
  24. package/dist/cjs/gestureState.js.map +1 -0
  25. package/dist/cjs/helpers.js +29 -0
  26. package/dist/cjs/helpers.js.map +1 -0
  27. package/dist/cjs/index.js +19 -0
  28. package/dist/cjs/index.js.map +1 -0
  29. package/dist/cjs/keyboardAvoidance.js +67 -0
  30. package/dist/cjs/keyboardAvoidance.js.map +1 -0
  31. package/dist/cjs/nativeSheet.js +52 -0
  32. package/dist/cjs/nativeSheet.js.map +1 -0
  33. package/dist/cjs/package.json +1 -0
  34. package/dist/cjs/setupGestureHandler.js +31 -0
  35. package/dist/cjs/setupGestureHandler.js.map +1 -0
  36. package/dist/cjs/types.js +3 -0
  37. package/dist/cjs/types.js.map +1 -0
  38. package/dist/cjs/useGestureHandlerPan.js +356 -0
  39. package/dist/cjs/useGestureHandlerPan.js.map +1 -0
  40. package/dist/cjs/useKeyboardControllerSheet.js +124 -0
  41. package/dist/cjs/useKeyboardControllerSheet.js.map +1 -0
  42. package/dist/cjs/useSafeAreaInsets.js +16 -0
  43. package/dist/cjs/useSafeAreaInsets.js.map +1 -0
  44. package/dist/cjs/useSheet.js +7 -0
  45. package/dist/cjs/useSheet.js.map +1 -0
  46. package/dist/cjs/useSheetController.js +19 -0
  47. package/dist/cjs/useSheetController.js.map +1 -0
  48. package/dist/cjs/useSheetOffscreenSize.js +40 -0
  49. package/dist/cjs/useSheetOffscreenSize.js.map +1 -0
  50. package/dist/cjs/useSheetOpenState.js +29 -0
  51. package/dist/cjs/useSheetOpenState.js.map +1 -0
  52. package/dist/cjs/useSheetProviderProps.js +169 -0
  53. package/dist/cjs/useSheetProviderProps.js.map +1 -0
  54. package/dist/cjs/useSheetScrollViewGestures.js +195 -0
  55. package/dist/cjs/useSheetScrollViewGestures.js.map +1 -0
  56. package/dist/cjs/webViewport.js +108 -0
  57. package/dist/cjs/webViewport.js.map +1 -0
  58. package/dist/esm/GestureDetectorWrapper.js +20 -0
  59. package/dist/esm/GestureDetectorWrapper.js.map +1 -0
  60. package/dist/esm/GestureSheetContext.js +17 -0
  61. package/dist/esm/GestureSheetContext.js.map +1 -0
  62. package/dist/esm/Sheet.js +97 -0
  63. package/dist/esm/Sheet.js.map +1 -0
  64. package/dist/esm/SheetContext.js +5 -0
  65. package/dist/esm/SheetContext.js.map +1 -0
  66. package/dist/esm/SheetController.js +28 -0
  67. package/dist/esm/SheetController.js.map +1 -0
  68. package/dist/esm/SheetImplementationCustom.js +862 -0
  69. package/dist/esm/SheetImplementationCustom.js.map +1 -0
  70. package/dist/esm/SheetScrollView.js +274 -0
  71. package/dist/esm/SheetScrollView.js.map +1 -0
  72. package/dist/esm/constants.js +5 -0
  73. package/dist/esm/constants.js.map +1 -0
  74. package/dist/esm/contexts.js +6 -0
  75. package/dist/esm/contexts.js.map +1 -0
  76. package/dist/esm/controller.js +5 -0
  77. package/dist/esm/controller.js.map +1 -0
  78. package/dist/esm/createSheet.js +150 -0
  79. package/dist/esm/createSheet.js.map +1 -0
  80. package/dist/esm/gestureState.js +29 -0
  81. package/dist/esm/gestureState.js.map +1 -0
  82. package/dist/esm/helpers.js +26 -0
  83. package/dist/esm/helpers.js.map +1 -0
  84. package/dist/esm/index.js +13 -14
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/keyboardAvoidance.js +62 -0
  87. package/dist/esm/keyboardAvoidance.js.map +1 -0
  88. package/dist/esm/nativeSheet.js +48 -0
  89. package/dist/esm/nativeSheet.js.map +1 -0
  90. package/dist/esm/setupGestureHandler.js +27 -0
  91. package/dist/esm/setupGestureHandler.js.map +1 -0
  92. package/dist/esm/types.js +2 -0
  93. package/dist/esm/types.js.map +1 -0
  94. package/dist/esm/useGestureHandlerPan.js +353 -0
  95. package/dist/esm/useGestureHandlerPan.js.map +1 -0
  96. package/dist/esm/useKeyboardControllerSheet.js +121 -0
  97. package/dist/esm/useKeyboardControllerSheet.js.map +1 -0
  98. package/dist/esm/useSafeAreaInsets.js +11 -0
  99. package/dist/esm/useSafeAreaInsets.js.map +1 -0
  100. package/dist/esm/useSheet.js +3 -0
  101. package/dist/esm/useSheet.js.map +1 -0
  102. package/dist/esm/useSheetController.js +14 -0
  103. package/dist/esm/useSheetController.js.map +1 -0
  104. package/dist/esm/useSheetOffscreenSize.js +36 -0
  105. package/dist/esm/useSheetOffscreenSize.js.map +1 -0
  106. package/dist/esm/useSheetOpenState.js +25 -0
  107. package/dist/esm/useSheetOpenState.js.map +1 -0
  108. package/dist/esm/useSheetProviderProps.js +165 -0
  109. package/dist/esm/useSheetProviderProps.js.map +1 -0
  110. package/dist/esm/useSheetScrollViewGestures.js +192 -0
  111. package/dist/esm/useSheetScrollViewGestures.js.map +1 -0
  112. package/dist/esm/webViewport.js +98 -0
  113. package/dist/esm/webViewport.js.map +1 -0
  114. package/dist/native/GestureDetectorWrapper.js +20 -0
  115. package/dist/native/GestureDetectorWrapper.js.map +1 -0
  116. package/dist/native/GestureSheetContext.js +17 -0
  117. package/dist/native/GestureSheetContext.js.map +1 -0
  118. package/dist/native/Sheet.js +97 -0
  119. package/dist/native/Sheet.js.map +1 -0
  120. package/dist/native/SheetContext.js +5 -0
  121. package/dist/native/SheetContext.js.map +1 -0
  122. package/dist/native/SheetController.js +28 -0
  123. package/dist/native/SheetController.js.map +1 -0
  124. package/dist/native/SheetImplementationCustom.js +862 -0
  125. package/dist/native/SheetImplementationCustom.js.map +1 -0
  126. package/dist/native/SheetScrollView.js +274 -0
  127. package/dist/native/SheetScrollView.js.map +1 -0
  128. package/dist/native/constants.js +5 -0
  129. package/dist/native/constants.js.map +1 -0
  130. package/dist/native/contexts.js +6 -0
  131. package/dist/native/contexts.js.map +1 -0
  132. package/dist/native/controller.js +5 -0
  133. package/dist/native/controller.js.map +1 -0
  134. package/dist/native/createSheet.js +150 -0
  135. package/dist/native/createSheet.js.map +1 -0
  136. package/dist/native/gestureState.js +29 -0
  137. package/dist/native/gestureState.js.map +1 -0
  138. package/dist/native/helpers.js +26 -0
  139. package/dist/native/helpers.js.map +1 -0
  140. package/dist/native/index.js +13 -0
  141. package/dist/native/index.js.map +1 -0
  142. package/dist/native/keyboardAvoidance.js +62 -0
  143. package/dist/native/keyboardAvoidance.js.map +1 -0
  144. package/dist/native/nativeSheet.js +48 -0
  145. package/dist/native/nativeSheet.js.map +1 -0
  146. package/dist/native/setupGestureHandler.js +27 -0
  147. package/dist/native/setupGestureHandler.js.map +1 -0
  148. package/dist/native/types.js +2 -0
  149. package/dist/native/types.js.map +1 -0
  150. package/dist/native/useGestureHandlerPan.js +353 -0
  151. package/dist/native/useGestureHandlerPan.js.map +1 -0
  152. package/dist/native/useKeyboardControllerSheet.js +118 -0
  153. package/dist/native/useKeyboardControllerSheet.js.map +1 -0
  154. package/dist/native/useSafeAreaInsets.js +25 -0
  155. package/dist/native/useSafeAreaInsets.js.map +1 -0
  156. package/dist/native/useSheet.js +3 -0
  157. package/dist/native/useSheet.js.map +1 -0
  158. package/dist/native/useSheetController.js +14 -0
  159. package/dist/native/useSheetController.js.map +1 -0
  160. package/dist/native/useSheetOffscreenSize.js +36 -0
  161. package/dist/native/useSheetOffscreenSize.js.map +1 -0
  162. package/dist/native/useSheetOpenState.js +25 -0
  163. package/dist/native/useSheetOpenState.js.map +1 -0
  164. package/dist/native/useSheetProviderProps.js +165 -0
  165. package/dist/native/useSheetProviderProps.js.map +1 -0
  166. package/dist/native/useSheetScrollViewGestures.js +131 -0
  167. package/dist/native/useSheetScrollViewGestures.js.map +1 -0
  168. package/dist/native/webViewport.js +98 -0
  169. package/dist/native/webViewport.js.map +1 -0
  170. package/package.json +46 -49
  171. package/src/GestureDetectorWrapper.tsx +1 -1
  172. package/src/Sheet.tsx +4 -4
  173. package/src/SheetContext.tsx +2 -2
  174. package/src/SheetController.d.ts +7 -0
  175. package/src/SheetController.d.ts.map +1 -0
  176. package/src/SheetController.js +38 -0
  177. package/src/SheetController.js.map +1 -0
  178. package/src/SheetController.tsx +2 -2
  179. package/src/SheetImplementationCustom.tsx +14 -14
  180. package/src/SheetScrollView.tsx +6 -6
  181. package/src/controller.ts +2 -2
  182. package/src/createSheet.tsx +9 -9
  183. package/src/index.ts +12 -12
  184. package/src/nativeSheet.tsx +4 -4
  185. package/src/useGestureHandlerPan.tsx +3 -3
  186. package/src/useKeyboardControllerSheet.native.ts +1 -1
  187. package/src/useKeyboardControllerSheet.ts +2 -2
  188. package/src/useSafeAreaInsets.native.ts +1 -1
  189. package/src/useSheet.tsx +1 -1
  190. package/src/useSheetController.d.ts +20 -0
  191. package/src/useSheetController.d.ts.map +1 -0
  192. package/src/useSheetController.js +14 -0
  193. package/src/useSheetController.js.map +1 -0
  194. package/src/useSheetOffscreenSize.tsx +1 -1
  195. package/src/useSheetOpenState.tsx +2 -2
  196. package/src/useSheetProviderProps.tsx +2 -2
  197. package/src/useSheetScrollViewGestures.native.ts +1 -1
  198. package/src/useSheetScrollViewGestures.ts +1 -1
  199. package/types/GestureDetectorWrapper.d.ts +1 -1
  200. package/types/GestureDetectorWrapper.d.ts.map +1 -1
  201. package/types/GestureSheetContext.d.ts +1 -1
  202. package/types/GestureSheetContext.d.ts.map +1 -1
  203. package/types/Sheet.d.ts +81 -89
  204. package/types/Sheet.d.ts.map +1 -1
  205. package/types/SheetContext.d.ts +5 -5
  206. package/types/SheetContext.d.ts.map +1 -1
  207. package/types/SheetController.d.ts +3 -2
  208. package/types/SheetController.d.ts.map +1 -1
  209. package/types/SheetImplementationCustom.d.ts +3 -3
  210. package/types/SheetImplementationCustom.d.ts.map +1 -1
  211. package/types/SheetScrollView.d.ts +6 -6
  212. package/types/controller.d.ts +2 -2
  213. package/types/controller.d.ts.map +1 -1
  214. package/types/createSheet.d.ts +85 -85
  215. package/types/createSheet.d.ts.map +1 -1
  216. package/types/index.d.ts +12 -12
  217. package/types/index.d.ts.map +1 -1
  218. package/types/nativeSheet.d.ts +1 -1
  219. package/types/nativeSheet.d.ts.map +1 -1
  220. package/types/useGestureHandlerPan.d.ts +1 -1
  221. package/types/useGestureHandlerPan.d.ts.map +1 -1
  222. package/types/useKeyboardControllerSheet.d.ts +1 -1
  223. package/types/useKeyboardControllerSheet.d.ts.map +1 -1
  224. package/types/useKeyboardControllerSheet.native.d.ts +1 -1
  225. package/types/useKeyboardControllerSheet.native.d.ts.map +1 -1
  226. package/types/useSafeAreaInsets.native.d.ts +1 -1
  227. package/types/useSafeAreaInsets.native.d.ts.map +1 -1
  228. package/types/useSheet.d.ts +1 -1
  229. package/types/useSheet.d.ts.map +1 -1
  230. package/types/useSheetOffscreenSize.d.ts +1 -1
  231. package/types/useSheetOffscreenSize.d.ts.map +1 -1
  232. package/types/useSheetOpenState.d.ts +2 -2
  233. package/types/useSheetOpenState.d.ts.map +1 -1
  234. package/types/useSheetProviderProps.d.ts +3 -3
  235. package/types/useSheetProviderProps.d.ts.map +1 -1
  236. package/types/useSheetScrollViewGestures.d.ts +1 -1
  237. package/types/useSheetScrollViewGestures.d.ts.map +1 -1
  238. package/types/useSheetScrollViewGestures.native.d.ts +1 -1
  239. package/types/useSheetScrollViewGestures.native.d.ts.map +1 -1
  240. package/controller/index.cjs +0 -2
  241. package/controller/index.d.ts +0 -5
  242. package/controller/index.js +0 -2
  243. package/controller/index.native.cjs +0 -2
  244. package/controller/index.native.js +0 -2
  245. package/dist/cjs/GestureDetectorWrapper.cjs +0 -54
  246. package/dist/cjs/GestureDetectorWrapper.native.js +0 -58
  247. package/dist/cjs/GestureDetectorWrapper.native.js.map +0 -1
  248. package/dist/cjs/GestureSheetContext.cjs +0 -54
  249. package/dist/cjs/GestureSheetContext.native.js +0 -58
  250. package/dist/cjs/GestureSheetContext.native.js.map +0 -1
  251. package/dist/cjs/Sheet.cjs +0 -119
  252. package/dist/cjs/Sheet.native.js +0 -122
  253. package/dist/cjs/Sheet.native.js.map +0 -1
  254. package/dist/cjs/SheetContext.cjs +0 -34
  255. package/dist/cjs/SheetContext.native.js +0 -37
  256. package/dist/cjs/SheetContext.native.js.map +0 -1
  257. package/dist/cjs/SheetController.cjs +0 -73
  258. package/dist/cjs/SheetController.native.js +0 -79
  259. package/dist/cjs/SheetController.native.js.map +0 -1
  260. package/dist/cjs/SheetImplementationCustom.cjs +0 -652
  261. package/dist/cjs/SheetImplementationCustom.native.js +0 -694
  262. package/dist/cjs/SheetImplementationCustom.native.js.map +0 -1
  263. package/dist/cjs/SheetScrollView.cjs +0 -337
  264. package/dist/cjs/SheetScrollView.native.js +0 -348
  265. package/dist/cjs/SheetScrollView.native.js.map +0 -1
  266. package/dist/cjs/constants.cjs +0 -34
  267. package/dist/cjs/constants.native.js +0 -37
  268. package/dist/cjs/constants.native.js.map +0 -1
  269. package/dist/cjs/contexts.cjs +0 -44
  270. package/dist/cjs/contexts.native.js +0 -47
  271. package/dist/cjs/contexts.native.js.map +0 -1
  272. package/dist/cjs/controller.cjs +0 -31
  273. package/dist/cjs/controller.native.js +0 -34
  274. package/dist/cjs/controller.native.js.map +0 -1
  275. package/dist/cjs/createSheet.cjs +0 -194
  276. package/dist/cjs/createSheet.native.js +0 -204
  277. package/dist/cjs/createSheet.native.js.map +0 -1
  278. package/dist/cjs/gestureState.cjs +0 -52
  279. package/dist/cjs/gestureState.native.js +0 -56
  280. package/dist/cjs/gestureState.native.js.map +0 -1
  281. package/dist/cjs/helpers.cjs +0 -35
  282. package/dist/cjs/helpers.native.js +0 -39
  283. package/dist/cjs/helpers.native.js.map +0 -1
  284. package/dist/cjs/index.cjs +0 -41
  285. package/dist/cjs/index.native.js +0 -44
  286. package/dist/cjs/index.native.js.map +0 -1
  287. package/dist/cjs/keyboardAvoidance.cjs +0 -93
  288. package/dist/cjs/keyboardAvoidance.native.js +0 -99
  289. package/dist/cjs/keyboardAvoidance.native.js.map +0 -1
  290. package/dist/cjs/nativeSheet.cjs +0 -99
  291. package/dist/cjs/nativeSheet.native.js +0 -109
  292. package/dist/cjs/nativeSheet.native.js.map +0 -1
  293. package/dist/cjs/setupGestureHandler.cjs +0 -55
  294. package/dist/cjs/setupGestureHandler.native.js +0 -60
  295. package/dist/cjs/setupGestureHandler.native.js.map +0 -1
  296. package/dist/cjs/types.cjs +0 -18
  297. package/dist/cjs/types.native.js +0 -21
  298. package/dist/cjs/types.native.js.map +0 -1
  299. package/dist/cjs/useGestureHandlerPan.cjs +0 -274
  300. package/dist/cjs/useGestureHandlerPan.native.js +0 -286
  301. package/dist/cjs/useGestureHandlerPan.native.js.map +0 -1
  302. package/dist/cjs/useKeyboardControllerSheet.cjs +0 -102
  303. package/dist/cjs/useKeyboardControllerSheet.native.js +0 -132
  304. package/dist/cjs/useKeyboardControllerSheet.native.js.map +0 -1
  305. package/dist/cjs/useSafeAreaInsets.cjs +0 -44
  306. package/dist/cjs/useSafeAreaInsets.native.js +0 -48
  307. package/dist/cjs/useSafeAreaInsets.native.js.map +0 -1
  308. package/dist/cjs/useSheet.cjs +0 -29
  309. package/dist/cjs/useSheet.native.js +0 -34
  310. package/dist/cjs/useSheet.native.js.map +0 -1
  311. package/dist/cjs/useSheetController.cjs +0 -52
  312. package/dist/cjs/useSheetController.native.js +0 -55
  313. package/dist/cjs/useSheetController.native.js.map +0 -1
  314. package/dist/cjs/useSheetOffscreenSize.cjs +0 -63
  315. package/dist/cjs/useSheetOffscreenSize.native.js +0 -70
  316. package/dist/cjs/useSheetOffscreenSize.native.js.map +0 -1
  317. package/dist/cjs/useSheetOpenState.cjs +0 -52
  318. package/dist/cjs/useSheetOpenState.native.js +0 -58
  319. package/dist/cjs/useSheetOpenState.native.js.map +0 -1
  320. package/dist/cjs/useSheetProviderProps.cjs +0 -181
  321. package/dist/cjs/useSheetProviderProps.native.js +0 -196
  322. package/dist/cjs/useSheetProviderProps.native.js.map +0 -1
  323. package/dist/cjs/useSheetScrollViewGestures.cjs +0 -191
  324. package/dist/cjs/useSheetScrollViewGestures.native.js +0 -163
  325. package/dist/cjs/useSheetScrollViewGestures.native.js.map +0 -1
  326. package/dist/cjs/webViewport.cjs +0 -75
  327. package/dist/cjs/webViewport.native.js +0 -81
  328. package/dist/cjs/webViewport.native.js.map +0 -1
  329. package/dist/esm/GestureDetectorWrapper.mjs +0 -29
  330. package/dist/esm/GestureDetectorWrapper.mjs.map +0 -1
  331. package/dist/esm/GestureDetectorWrapper.native.js +0 -30
  332. package/dist/esm/GestureDetectorWrapper.native.js.map +0 -1
  333. package/dist/esm/GestureSheetContext.mjs +0 -28
  334. package/dist/esm/GestureSheetContext.mjs.map +0 -1
  335. package/dist/esm/GestureSheetContext.native.js +0 -29
  336. package/dist/esm/GestureSheetContext.native.js.map +0 -1
  337. package/dist/esm/Sheet.mjs +0 -89
  338. package/dist/esm/Sheet.mjs.map +0 -1
  339. package/dist/esm/Sheet.native.js +0 -89
  340. package/dist/esm/Sheet.native.js.map +0 -1
  341. package/dist/esm/SheetContext.mjs +0 -6
  342. package/dist/esm/SheetContext.mjs.map +0 -1
  343. package/dist/esm/SheetContext.native.js +0 -6
  344. package/dist/esm/SheetContext.native.js.map +0 -1
  345. package/dist/esm/SheetController.mjs +0 -37
  346. package/dist/esm/SheetController.mjs.map +0 -1
  347. package/dist/esm/SheetController.native.js +0 -40
  348. package/dist/esm/SheetController.native.js.map +0 -1
  349. package/dist/esm/SheetImplementationCustom.mjs +0 -611
  350. package/dist/esm/SheetImplementationCustom.mjs.map +0 -1
  351. package/dist/esm/SheetImplementationCustom.native.js +0 -643
  352. package/dist/esm/SheetImplementationCustom.native.js.map +0 -1
  353. package/dist/esm/SheetScrollView.mjs +0 -301
  354. package/dist/esm/SheetScrollView.mjs.map +0 -1
  355. package/dist/esm/SheetScrollView.native.js +0 -309
  356. package/dist/esm/SheetScrollView.native.js.map +0 -1
  357. package/dist/esm/constants.mjs +0 -6
  358. package/dist/esm/constants.mjs.map +0 -1
  359. package/dist/esm/constants.native.js +0 -6
  360. package/dist/esm/constants.native.js.map +0 -1
  361. package/dist/esm/contexts.mjs +0 -7
  362. package/dist/esm/contexts.mjs.map +0 -1
  363. package/dist/esm/contexts.native.js +0 -7
  364. package/dist/esm/contexts.native.js.map +0 -1
  365. package/dist/esm/controller.mjs +0 -4
  366. package/dist/esm/controller.mjs.map +0 -1
  367. package/dist/esm/controller.native.js +0 -4
  368. package/dist/esm/controller.native.js.map +0 -1
  369. package/dist/esm/createSheet.mjs +0 -168
  370. package/dist/esm/createSheet.mjs.map +0 -1
  371. package/dist/esm/createSheet.native.js +0 -176
  372. package/dist/esm/createSheet.native.js.map +0 -1
  373. package/dist/esm/gestureState.mjs +0 -24
  374. package/dist/esm/gestureState.mjs.map +0 -1
  375. package/dist/esm/gestureState.native.js +0 -25
  376. package/dist/esm/gestureState.native.js.map +0 -1
  377. package/dist/esm/helpers.mjs +0 -10
  378. package/dist/esm/helpers.mjs.map +0 -1
  379. package/dist/esm/helpers.native.js +0 -11
  380. package/dist/esm/helpers.native.js.map +0 -1
  381. package/dist/esm/index.mjs +0 -14
  382. package/dist/esm/index.mjs.map +0 -1
  383. package/dist/esm/index.native.js +0 -14
  384. package/dist/esm/index.native.js.map +0 -1
  385. package/dist/esm/keyboardAvoidance.mjs +0 -66
  386. package/dist/esm/keyboardAvoidance.mjs.map +0 -1
  387. package/dist/esm/keyboardAvoidance.native.js +0 -69
  388. package/dist/esm/keyboardAvoidance.native.js.map +0 -1
  389. package/dist/esm/nativeSheet.mjs +0 -73
  390. package/dist/esm/nativeSheet.mjs.map +0 -1
  391. package/dist/esm/nativeSheet.native.js +0 -80
  392. package/dist/esm/nativeSheet.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 +0 -2
  398. package/dist/esm/types.mjs.map +0 -1
  399. package/dist/esm/types.native.js +0 -2
  400. package/dist/esm/types.native.js.map +0 -1
  401. package/dist/esm/useGestureHandlerPan.mjs +0 -249
  402. package/dist/esm/useGestureHandlerPan.mjs.map +0 -1
  403. package/dist/esm/useGestureHandlerPan.native.js +0 -258
  404. package/dist/esm/useGestureHandlerPan.native.js.map +0 -1
  405. package/dist/esm/useKeyboardControllerSheet.mjs +0 -77
  406. package/dist/esm/useKeyboardControllerSheet.mjs.map +0 -1
  407. package/dist/esm/useKeyboardControllerSheet.native.js +0 -104
  408. package/dist/esm/useKeyboardControllerSheet.native.js.map +0 -1
  409. package/dist/esm/useSafeAreaInsets.mjs +0 -7
  410. package/dist/esm/useSafeAreaInsets.mjs.map +0 -1
  411. package/dist/esm/useSafeAreaInsets.native.js +0 -8
  412. package/dist/esm/useSafeAreaInsets.native.js.map +0 -1
  413. package/dist/esm/useSheet.mjs +0 -4
  414. package/dist/esm/useSheet.mjs.map +0 -1
  415. package/dist/esm/useSheet.native.js +0 -6
  416. package/dist/esm/useSheet.native.js.map +0 -1
  417. package/dist/esm/useSheetController.mjs +0 -15
  418. package/dist/esm/useSheetController.mjs.map +0 -1
  419. package/dist/esm/useSheetController.native.js +0 -15
  420. package/dist/esm/useSheetController.native.js.map +0 -1
  421. package/dist/esm/useSheetOffscreenSize.mjs +0 -38
  422. package/dist/esm/useSheetOffscreenSize.mjs.map +0 -1
  423. package/dist/esm/useSheetOffscreenSize.native.js +0 -42
  424. package/dist/esm/useSheetOffscreenSize.native.js.map +0 -1
  425. package/dist/esm/useSheetOpenState.mjs +0 -27
  426. package/dist/esm/useSheetOpenState.mjs.map +0 -1
  427. package/dist/esm/useSheetOpenState.native.js +0 -30
  428. package/dist/esm/useSheetOpenState.native.js.map +0 -1
  429. package/dist/esm/useSheetProviderProps.mjs +0 -145
  430. package/dist/esm/useSheetProviderProps.mjs.map +0 -1
  431. package/dist/esm/useSheetProviderProps.native.js +0 -157
  432. package/dist/esm/useSheetProviderProps.native.js.map +0 -1
  433. package/dist/esm/useSheetScrollViewGestures.mjs +0 -166
  434. package/dist/esm/useSheetScrollViewGestures.mjs.map +0 -1
  435. package/dist/esm/useSheetScrollViewGestures.native.js +0 -135
  436. package/dist/esm/useSheetScrollViewGestures.native.js.map +0 -1
  437. package/dist/esm/webViewport.mjs +0 -43
  438. package/dist/esm/webViewport.mjs.map +0 -1
  439. package/dist/esm/webViewport.native.js +0 -46
  440. package/dist/esm/webViewport.native.js.map +0 -1
  441. package/dist/jsx/GestureDetectorWrapper.mjs +0 -29
  442. package/dist/jsx/GestureDetectorWrapper.mjs.map +0 -1
  443. package/dist/jsx/GestureDetectorWrapper.native.js +0 -58
  444. package/dist/jsx/GestureDetectorWrapper.native.js.map +0 -1
  445. package/dist/jsx/GestureSheetContext.mjs +0 -28
  446. package/dist/jsx/GestureSheetContext.mjs.map +0 -1
  447. package/dist/jsx/GestureSheetContext.native.js +0 -58
  448. package/dist/jsx/GestureSheetContext.native.js.map +0 -1
  449. package/dist/jsx/Sheet.mjs +0 -89
  450. package/dist/jsx/Sheet.mjs.map +0 -1
  451. package/dist/jsx/Sheet.native.js +0 -122
  452. package/dist/jsx/Sheet.native.js.map +0 -1
  453. package/dist/jsx/SheetContext.mjs +0 -6
  454. package/dist/jsx/SheetContext.mjs.map +0 -1
  455. package/dist/jsx/SheetContext.native.js +0 -37
  456. package/dist/jsx/SheetContext.native.js.map +0 -1
  457. package/dist/jsx/SheetController.mjs +0 -37
  458. package/dist/jsx/SheetController.mjs.map +0 -1
  459. package/dist/jsx/SheetController.native.js +0 -79
  460. package/dist/jsx/SheetController.native.js.map +0 -1
  461. package/dist/jsx/SheetImplementationCustom.mjs +0 -611
  462. package/dist/jsx/SheetImplementationCustom.mjs.map +0 -1
  463. package/dist/jsx/SheetImplementationCustom.native.js +0 -694
  464. package/dist/jsx/SheetImplementationCustom.native.js.map +0 -1
  465. package/dist/jsx/SheetScrollView.mjs +0 -301
  466. package/dist/jsx/SheetScrollView.mjs.map +0 -1
  467. package/dist/jsx/SheetScrollView.native.js +0 -348
  468. package/dist/jsx/SheetScrollView.native.js.map +0 -1
  469. package/dist/jsx/constants.mjs +0 -6
  470. package/dist/jsx/constants.mjs.map +0 -1
  471. package/dist/jsx/constants.native.js +0 -37
  472. package/dist/jsx/constants.native.js.map +0 -1
  473. package/dist/jsx/contexts.mjs +0 -7
  474. package/dist/jsx/contexts.mjs.map +0 -1
  475. package/dist/jsx/contexts.native.js +0 -47
  476. package/dist/jsx/contexts.native.js.map +0 -1
  477. package/dist/jsx/controller.mjs +0 -4
  478. package/dist/jsx/controller.mjs.map +0 -1
  479. package/dist/jsx/controller.native.js +0 -34
  480. package/dist/jsx/controller.native.js.map +0 -1
  481. package/dist/jsx/createSheet.mjs +0 -168
  482. package/dist/jsx/createSheet.mjs.map +0 -1
  483. package/dist/jsx/createSheet.native.js +0 -204
  484. package/dist/jsx/createSheet.native.js.map +0 -1
  485. package/dist/jsx/gestureState.mjs +0 -24
  486. package/dist/jsx/gestureState.mjs.map +0 -1
  487. package/dist/jsx/gestureState.native.js +0 -56
  488. package/dist/jsx/gestureState.native.js.map +0 -1
  489. package/dist/jsx/helpers.mjs +0 -10
  490. package/dist/jsx/helpers.mjs.map +0 -1
  491. package/dist/jsx/helpers.native.js +0 -39
  492. package/dist/jsx/helpers.native.js.map +0 -1
  493. package/dist/jsx/index.js +0 -14
  494. package/dist/jsx/index.js.map +0 -1
  495. package/dist/jsx/index.mjs +0 -14
  496. package/dist/jsx/index.mjs.map +0 -1
  497. package/dist/jsx/index.native.js +0 -44
  498. package/dist/jsx/index.native.js.map +0 -1
  499. package/dist/jsx/keyboardAvoidance.mjs +0 -66
  500. package/dist/jsx/keyboardAvoidance.mjs.map +0 -1
  501. package/dist/jsx/keyboardAvoidance.native.js +0 -99
  502. package/dist/jsx/keyboardAvoidance.native.js.map +0 -1
  503. package/dist/jsx/nativeSheet.mjs +0 -73
  504. package/dist/jsx/nativeSheet.mjs.map +0 -1
  505. package/dist/jsx/nativeSheet.native.js +0 -109
  506. package/dist/jsx/nativeSheet.native.js.map +0 -1
  507. package/dist/jsx/setupGestureHandler.mjs +0 -29
  508. package/dist/jsx/setupGestureHandler.mjs.map +0 -1
  509. package/dist/jsx/setupGestureHandler.native.js +0 -60
  510. package/dist/jsx/setupGestureHandler.native.js.map +0 -1
  511. package/dist/jsx/types.mjs +0 -2
  512. package/dist/jsx/types.mjs.map +0 -1
  513. package/dist/jsx/types.native.js +0 -21
  514. package/dist/jsx/types.native.js.map +0 -1
  515. package/dist/jsx/useGestureHandlerPan.mjs +0 -249
  516. package/dist/jsx/useGestureHandlerPan.mjs.map +0 -1
  517. package/dist/jsx/useGestureHandlerPan.native.js +0 -286
  518. package/dist/jsx/useGestureHandlerPan.native.js.map +0 -1
  519. package/dist/jsx/useKeyboardControllerSheet.mjs +0 -77
  520. package/dist/jsx/useKeyboardControllerSheet.mjs.map +0 -1
  521. package/dist/jsx/useKeyboardControllerSheet.native.js +0 -132
  522. package/dist/jsx/useKeyboardControllerSheet.native.js.map +0 -1
  523. package/dist/jsx/useSafeAreaInsets.mjs +0 -7
  524. package/dist/jsx/useSafeAreaInsets.mjs.map +0 -1
  525. package/dist/jsx/useSafeAreaInsets.native.js +0 -48
  526. package/dist/jsx/useSafeAreaInsets.native.js.map +0 -1
  527. package/dist/jsx/useSheet.mjs +0 -4
  528. package/dist/jsx/useSheet.mjs.map +0 -1
  529. package/dist/jsx/useSheet.native.js +0 -34
  530. package/dist/jsx/useSheet.native.js.map +0 -1
  531. package/dist/jsx/useSheetController.mjs +0 -15
  532. package/dist/jsx/useSheetController.mjs.map +0 -1
  533. package/dist/jsx/useSheetController.native.js +0 -55
  534. package/dist/jsx/useSheetController.native.js.map +0 -1
  535. package/dist/jsx/useSheetOffscreenSize.mjs +0 -38
  536. package/dist/jsx/useSheetOffscreenSize.mjs.map +0 -1
  537. package/dist/jsx/useSheetOffscreenSize.native.js +0 -70
  538. package/dist/jsx/useSheetOffscreenSize.native.js.map +0 -1
  539. package/dist/jsx/useSheetOpenState.mjs +0 -27
  540. package/dist/jsx/useSheetOpenState.mjs.map +0 -1
  541. package/dist/jsx/useSheetOpenState.native.js +0 -58
  542. package/dist/jsx/useSheetOpenState.native.js.map +0 -1
  543. package/dist/jsx/useSheetProviderProps.mjs +0 -145
  544. package/dist/jsx/useSheetProviderProps.mjs.map +0 -1
  545. package/dist/jsx/useSheetProviderProps.native.js +0 -196
  546. package/dist/jsx/useSheetProviderProps.native.js.map +0 -1
  547. package/dist/jsx/useSheetScrollViewGestures.mjs +0 -166
  548. package/dist/jsx/useSheetScrollViewGestures.mjs.map +0 -1
  549. package/dist/jsx/useSheetScrollViewGestures.native.js +0 -163
  550. package/dist/jsx/useSheetScrollViewGestures.native.js.map +0 -1
  551. package/dist/jsx/webViewport.mjs +0 -43
  552. package/dist/jsx/webViewport.mjs.map +0 -1
  553. package/dist/jsx/webViewport.native.js +0 -81
  554. package/dist/jsx/webViewport.native.js.map +0 -1
  555. package/setup-gesture-handler/index.cjs +0 -2
  556. package/setup-gesture-handler/index.js +0 -2
  557. package/setup-gesture-handler/index.native.cjs +0 -2
  558. package/setup-gesture-handler/index.native.js +0 -2
  559. package/setup-gesture-handler.cjs +0 -1
@@ -0,0 +1,866 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SheetImplementationCustom = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const adapt_1 = require("@hanzogui/adapt");
7
+ const animate_presence_1 = require("@hanzogui/animate-presence");
8
+ const compose_refs_1 = require("@hanzogui/compose-refs");
9
+ const constants_1 = require("@hanzogui/constants");
10
+ const core_1 = require("@hanzogui/core");
11
+ const portal_1 = require("@hanzogui/portal");
12
+ const react_1 = tslib_1.__importStar(require("react"));
13
+ const react_native_1 = require("react-native");
14
+ const contexts_ts_1 = require("./contexts.js");
15
+ const GestureDetectorWrapper_tsx_1 = require("./GestureDetectorWrapper.js");
16
+ const gestureState_ts_1 = require("./gestureState.js");
17
+ const GestureSheetContext_tsx_1 = require("./GestureSheetContext.js");
18
+ const helpers_tsx_1 = require("./helpers.js");
19
+ const keyboardAvoidance_ts_1 = require("./keyboardAvoidance.js");
20
+ const webViewport_ts_1 = require("./webViewport.js");
21
+ const SheetContext_tsx_1 = require("./SheetContext.js");
22
+ const useGestureHandlerPan_tsx_1 = require("./useGestureHandlerPan.js");
23
+ const useKeyboardControllerSheet_ts_1 = require("./useKeyboardControllerSheet.js");
24
+ const useSafeAreaInsets_ts_1 = require("./useSafeAreaInsets.js");
25
+ const useSheetOpenState_tsx_1 = require("./useSheetOpenState.js");
26
+ const useSheetProviderProps_tsx_1 = require("./useSheetProviderProps.js");
27
+ const hiddenSize = 10000.1;
28
+ // the re-established rngh root for a modal sheet (see modal branch below).
29
+ // GestureHandlerRootView does its own native touch interception and ignores
30
+ // pointerEvents, so it would block the whole app while the sheet sits closed
31
+ // but mounted. instead it stays full-width for correct child layout/measurement
32
+ // and collapses to 0 height when closed so it has no hit area.
33
+ const rnghRootStyleOpen = { width: '100%', height: '100%' };
34
+ const rnghRootStyleClosed = { width: '100%', height: 0 };
35
+ let sheetHiddenStyleSheet = null;
36
+ // on web we are always relative to window, on to screen
37
+ const relativeDimensionTo = constants_1.isWeb ? 'window' : 'screen';
38
+ // height of the viewport the sheet positions against. on web this MUST be the
39
+ // stable layout viewport and NOT Dimensions.get('window') — react-native-web's
40
+ // Dimensions tracks visualViewport, which shrinks by the soft keyboard. capping
41
+ // frameSize / maxContentSize against that shrinking value corrupts the fit-mode
42
+ // math (translateY = screenSize - frameSize), detaching the sheet's bottom from
43
+ // the screen edge when the keyboard opens. NOTE: window.innerHeight is NOT
44
+ // stable on real iOS Safari (it shrinks with the keyboard too), so we use the
45
+ // self-correcting baseline from webViewport instead. see getStableLayoutViewportHeight.
46
+ function getStableViewportHeight() {
47
+ if (constants_1.isWeb && typeof window !== 'undefined')
48
+ return (0, webViewport_ts_1.getStableLayoutViewportHeight)();
49
+ return react_native_1.Dimensions.get(relativeDimensionTo).height;
50
+ }
51
+ exports.SheetImplementationCustom = react_1.default.forwardRef(function SheetImplementationCustom(props, forwardedRef) {
52
+ const parentSheet = react_1.default.useContext(contexts_ts_1.ParentSheetContext);
53
+ // live safe-area insets (notch / status bar). read here in the component
54
+ // body — which renders INSIDE the app's SafeAreaProvider — so it is correct
55
+ // even though a modal sheet's CONTENT is teleported out through the portal.
56
+ // the keyboard-avoidance clamp below uses the top inset so a keyboard-shifted
57
+ // sheet tops out at the notch instead of sliding under it. web has no native
58
+ // safe-area context (CSS env() handles it) and uses the visual-viewport
59
+ // offset instead.
60
+ const safeAreaInsets = (0, useSafeAreaInsets_ts_1.useSafeAreaInsets)();
61
+ const safeAreaTopInset = safeAreaInsets?.top ?? 0;
62
+ const { transition, transitionConfig: transitionConfigProp, modal = false, zIndex = parentSheet.zIndex + 1, moveOnKeyboardChange = false, unmountChildrenWhenHidden = false, disableTransparencyHide = false, portalProps, containerComponent: ContainerComponent = react_1.default.Fragment, onAnimationComplete, } = props;
63
+ const state = (0, useSheetOpenState_tsx_1.useSheetOpenState)(props);
64
+ const [overlayComponent, setOverlayComponent] = react_1.default.useState(null);
65
+ const providerProps = (0, useSheetProviderProps_tsx_1.useSheetProviderProps)(props, state, {
66
+ onOverlayComponent: setOverlayComponent,
67
+ });
68
+ const { frameSize, setFrameSize, dismissOnSnapToBottom, snapPoints, snapPointsMode, hasFit, position, setPosition, scrollBridge, screenSize, setMaxContentSize, maxSnapPoint, } = providerProps;
69
+ const { open, controller, isHidden } = state;
70
+ const openRef = react_1.default.useRef(open);
71
+ openRef.current = open;
72
+ const sheetRef = react_1.default.useRef(undefined);
73
+ const ref = (0, compose_refs_1.useComposedRefs)(forwardedRef, sheetRef, providerProps.contentRef);
74
+ // TODO this can be extracted into a helper getAnimationConfig(animationProp as array | string)
75
+ const { animationDriver } = (0, core_1.useConfiguration)();
76
+ if (!animationDriver) {
77
+ throw new Error(`Sheet requires an animation driver to be set`);
78
+ }
79
+ const transitionConfig = (() => {
80
+ // explicit transitionConfig prop always takes precedence
81
+ if (transitionConfigProp) {
82
+ return transitionConfigProp;
83
+ }
84
+ const [animationProp, animationPropConfig] = !transition
85
+ ? []
86
+ : Array.isArray(transition)
87
+ ? transition
88
+ : [transition];
89
+ // look up named animation config from driver if available
90
+ if (animationProp && animationDriver.animations?.[animationProp]) {
91
+ return {
92
+ ...animationDriver.animations[animationProp],
93
+ ...animationPropConfig,
94
+ };
95
+ }
96
+ return null;
97
+ })();
98
+ /**
99
+ * This is a hacky workaround for native:
100
+ */
101
+ const [isShowingInnerSheet, setIsShowingInnerSheet] = react_1.default.useState(false);
102
+ // when using Gorhom portal (no teleport), inner sheets need to hide parent
103
+ const shouldHideParentSheet = !constants_1.isWeb && modal && isShowingInnerSheet && (0, portal_1.needsPortalRepropagation)();
104
+ const sheetInsideSheet = react_1.default.useContext(contexts_ts_1.SheetInsideSheetContext);
105
+ const onInnerSheet = react_1.default.useCallback((hasChild) => {
106
+ setIsShowingInnerSheet(hasChild);
107
+ }, []);
108
+ // keyboard state tracking — just tracks height/visibility, no position animation.
109
+ // Position animation is handled via keyboard-adjusted positions below,
110
+ // matching the react-native-actions-sheet pattern.
111
+ const { keyboardHeight, isKeyboardVisible, dismissKeyboard, pauseKeyboardHandler, flushPendingHide, } = (0, useKeyboardControllerSheet_ts_1.useKeyboardControllerSheet)({
112
+ enabled: Boolean(moveOnKeyboardChange),
113
+ });
114
+ // FIX: Store stable frameSize to prevent recalculation during exit animation
115
+ const stableFrameSize = react_1.default.useRef(frameSize);
116
+ react_1.default.useEffect(() => {
117
+ // Only update stable size when sheet is open
118
+ if (open && frameSize) {
119
+ stableFrameSize.current = frameSize;
120
+ }
121
+ }, [open, frameSize]);
122
+ // WEB keyboard frame freeze. on real iOS Safari opening the keyboard shrinks
123
+ // the visual viewport AND innerHeight AND the measured layout, which would
124
+ // re-derive screenSize/frameSize smaller, recompute the fit positions, and
125
+ // fly the frame up then back down ("goes back down after the keyboard opens").
126
+ // so we snapshot the pre-keyboard geometry — captured every render while the
127
+ // keyboard is CLOSED, which dodges the open-transition race where a shrunk
128
+ // onLayout lands before isKeyboardVisible flips — and use it for frame-size
129
+ // math while the keyboard is open. the active snap position still shifts up
130
+ // by the keyboard height, capped at the safe-area top; the scroll view gets
131
+ // keyboardOccludedHeight padding for any tail left behind the keyboard.
132
+ // this sheet is the kind the web keyboard frame freeze is designed for — a
133
+ // fit-mode web sheet opted into keyboard handling. percent/constant sheets
134
+ // keep the live geometry (their height isn't pinned, so a frozen frame
135
+ // height would mismatch).
136
+ const isWebKbSheet = constants_1.isWeb && hasFit && moveOnKeyboardChange;
137
+ // NATIVE keyboard frame freeze. native fit sheets feed keyboardOccludedHeight
138
+ // into the ScrollView as scrollable tail padding so content can clear the
139
+ // keyboard. but that padding grows the fit content, which grows the frame,
140
+ // which grows the occluded height — a feedback loop that balloons the sheet
141
+ // to the full-screen cap. web breaks the loop by freezing geometry against
142
+ // effScreenSize; native has no such freeze, so we pin the ScrollView to the
143
+ // frame height measured while the keyboard was closed (preKeyboardFrameSize)
144
+ // via keyboardStableFrameHeight below. unlike web, the native keyboard is an
145
+ // overlay that never shrinks the measured screen, so screenSize stays live.
146
+ const isNativeKbFitSheet = !constants_1.isWeb && hasFit && Boolean(moveOnKeyboardChange);
147
+ // snapshot the fit frame height while the keyboard is closed, so the pin above
148
+ // holds the pre-keyboard viewport rather than a mid-feedback-loop value.
149
+ const preKeyboardFrameSize = react_1.default.useRef(0);
150
+ react_1.default.useEffect(() => {
151
+ if (isNativeKbFitSheet && open && !isKeyboardVisible && frameSize > 0) {
152
+ preKeyboardFrameSize.current = frameSize;
153
+ }
154
+ }, [isNativeKbFitSheet, open, isKeyboardVisible, frameSize]);
155
+ // the space the snap positions are built against. WEB: the stable layout
156
+ // viewport (document.documentElement.clientHeight), which the soft keyboard
157
+ // never shrinks (unlike the measured screenSize / visualViewport). NATIVE:
158
+ // the measured screenSize. activePositions shift up by keyboardHeight below
159
+ // so a small fit sheet keeps its natural height and moves with the keyboard;
160
+ // a tall fit sheet moves until capped at the safe-area top, leaving its tail
161
+ // behind the keyboard for the ScrollView padding to expose.
162
+ const effScreenSize = isWebKbSheet ? getStableViewportHeight() : screenSize;
163
+ // use stableFrameSize when closing to prevent position jumps during the exit
164
+ // animation; while open use the live frameSize.
165
+ const effectiveFrameSize = open ? frameSize : stableFrameSize.current || frameSize;
166
+ const positions = react_1.default.useMemo(() => snapPoints.map((point) => getYPositions(snapPointsMode, point, effScreenSize, effectiveFrameSize)), [effScreenSize, effectiveFrameSize, snapPoints, snapPointsMode]);
167
+ const [isDragging, setIsDragging_] = react_1.default.useState(false);
168
+ // synchronous dragging ref — set BEFORE async state commits.
169
+ // RNGH onBegin fires before keyboard hide event reaches JS,
170
+ // so the ref is true by the time activePositions memo re-evaluates.
171
+ // Also controls pauseKeyboardHandler to freeze keyboard state during drag.
172
+ const isDraggingRef = react_1.default.useRef(false);
173
+ const setIsDragging = react_1.default.useCallback((val) => {
174
+ isDraggingRef.current = val;
175
+ pauseKeyboardHandler.current = val;
176
+ setIsDragging_(val);
177
+ // when drag ends, flush any keyboard hide that was suppressed during drag
178
+ // so isKeyboardVisible/keyboardHeight reflect actual state
179
+ if (!val) {
180
+ flushPendingHide();
181
+ }
182
+ }, [pauseKeyboardHandler, flushPendingHide]);
183
+ // keyboard-adjusted snap positions.
184
+ //
185
+ // WEB + NATIVE: shift snap points up by keyboard height, capped at the
186
+ // safe-area top inset. web fit sheets keep their frozen pre-keyboard height
187
+ // and add bottom spacer padding when the safe-area cap leaves a hidden tail.
188
+ //
189
+ // IMPORTANT: frozen during drag to prevent gesture handler recreation —
190
+ // when a TextInput blurs mid-drag the keyboard state would otherwise revert
191
+ // and recreate the gesture useMemo, cancelling the active drag.
192
+ const activePositionsRef = react_1.default.useRef(positions);
193
+ const activePositions = react_1.default.useMemo(() => {
194
+ if (isDragging || isDraggingRef.current)
195
+ return activePositionsRef.current;
196
+ let result;
197
+ if (!isKeyboardVisible || keyboardHeight <= 0) {
198
+ result = positions;
199
+ }
200
+ else {
201
+ result = positions.map((p) => (0, keyboardAvoidance_ts_1.getKeyboardAdjustedSheetY)({
202
+ sheetY: p,
203
+ screenSize: effScreenSize,
204
+ isKeyboardVisible,
205
+ keyboardHeight,
206
+ shouldTranslate: true,
207
+ safeAreaTop: constants_1.isWeb ? (0, webViewport_ts_1.getWebVisualViewportOffsetTop)() : safeAreaTopInset,
208
+ }));
209
+ }
210
+ activePositionsRef.current = result;
211
+ return result;
212
+ }, [
213
+ positions,
214
+ isKeyboardVisible,
215
+ keyboardHeight,
216
+ effScreenSize,
217
+ isDragging,
218
+ safeAreaTopInset,
219
+ ]);
220
+ // bottom spacer for the part of the sheet hidden by the keyboard after the
221
+ // keyboard translation and safe-area clamping. if a small sheet fits above
222
+ // the keyboard this is 0; if a tall sheet is capped at the safe-area top, the
223
+ // spacer makes the remaining hidden tail scrollable.
224
+ const keyboardOccludedHeight = (0, keyboardAvoidance_ts_1.getKeyboardOccludedHeight)({
225
+ frameSize: effectiveFrameSize,
226
+ isKeyboardVisible,
227
+ keyboardHeight,
228
+ screenSize: effScreenSize,
229
+ sheetY: position >= 0 ? activePositions[position] : undefined,
230
+ });
231
+ // pin the scroll view to the held (pre-keyboard) frame height while the
232
+ // keyboard is up on web. on older iOS the consumer's window-derived maxHeight
233
+ // shrinks with the keyboard, which would clip the scroll view (and the frame)
234
+ // smaller; this override keeps it at the full height so the frame translates
235
+ // with the keyboard but never resizes. 0 = no override (use the consumer maxHeight).
236
+ const keyboardStableFrameHeight = isWebKbSheet && isKeyboardVisible && frameSize > 0
237
+ ? frameSize
238
+ : isNativeKbFitSheet && isKeyboardVisible && preKeyboardFrameSize.current > 0
239
+ ? preKeyboardFrameSize.current
240
+ : 0;
241
+ const { useAnimatedNumber, useAnimatedNumberStyle } = animationDriver;
242
+ const AnimatedView = (animationDriver.View ?? core_1.View);
243
+ (0, constants_1.useIsomorphicLayoutEffect)(() => {
244
+ if (!(sheetInsideSheet && open))
245
+ return;
246
+ sheetInsideSheet(true);
247
+ return () => {
248
+ sheetInsideSheet(false);
249
+ };
250
+ }, [sheetInsideSheet, open]);
251
+ const nextParentContext = react_1.default.useMemo(() => ({
252
+ zIndex,
253
+ }), [zIndex]);
254
+ const isMounted = (0, core_1.useDidFinishSSR)();
255
+ const startPosition = isMounted && screenSize ? screenSize : hiddenSize;
256
+ const animatedNumber = useAnimatedNumber(startPosition);
257
+ const at = react_1.default.useRef(startPosition);
258
+ const hasntMeasured = at.current === hiddenSize;
259
+ const [disableAnimation, setDisableAnimation] = (0, react_1.useState)(hasntMeasured);
260
+ // use skipNextAnimation signal from controller (set when adapt handoff occurs)
261
+ const skipAdaptAnimation = react_1.default.useRef(false);
262
+ if (controller?.skipNextAnimation) {
263
+ skipAdaptAnimation.current = true;
264
+ }
265
+ const hasScrollView = react_1.default.useRef(false);
266
+ // safety fallback timer for sheet close opacity
267
+ const opacityFallbackTimer = react_1.default.useRef(null);
268
+ const syncAnimatedPosition = (0, core_1.useEvent)((value) => {
269
+ at.current = value;
270
+ scrollBridge.paneY = value;
271
+ // update isAtTop for scroll enable/disable. activePositions[0] is the
272
+ // top snap point (keyboard-adjusted minY).
273
+ const minY = activePositions[0];
274
+ const wasAtTop = scrollBridge.isAtTop;
275
+ const nowAtTop = value <= minY + 5;
276
+ if (wasAtTop === nowAtTop)
277
+ return;
278
+ scrollBridge.isAtTop = nowAtTop;
279
+ if (nowAtTop) {
280
+ if (scrollBridge.lockScrollAtTop) {
281
+ if (scrollBridge.y > 0) {
282
+ scrollBridge.forceScrollTo?.(0);
283
+ scrollBridge.y = 0;
284
+ }
285
+ scrollBridge.scrollLockY = 0;
286
+ scrollBridge.setScrollEnabled?.(false, 0);
287
+ return;
288
+ }
289
+ // if scroll drifted during drag (e.g. fast swipe from position 1),
290
+ // reset it to 0 before enabling free scroll.
291
+ if (scrollBridge.y > 0) {
292
+ scrollBridge.forceScrollTo?.(0);
293
+ scrollBridge.y = 0;
294
+ }
295
+ scrollBridge.scrollLockY = undefined;
296
+ scrollBridge.setScrollEnabled?.(true);
297
+ }
298
+ else {
299
+ scrollBridge.scrollLockY = 0;
300
+ scrollBridge.setScrollEnabled?.(false);
301
+ }
302
+ });
303
+ const setAnimatedPositionDirect = (0, core_1.useEvent)((value) => {
304
+ syncAnimatedPosition(value);
305
+ animatedNumber.setValue(value, { type: 'direct' });
306
+ });
307
+ const getAnimatedPosition = (0, core_1.useEvent)(() => {
308
+ const value = animatedNumber.getValue();
309
+ syncAnimatedPosition(value);
310
+ return value;
311
+ });
312
+ function stopSpring() {
313
+ animatedNumber.stop();
314
+ if (scrollBridge.onFinishAnimate) {
315
+ scrollBridge.onFinishAnimate();
316
+ scrollBridge.onFinishAnimate = undefined;
317
+ }
318
+ }
319
+ const animateTo = (0, core_1.useEvent)((position, animationOverride) => {
320
+ if (frameSize === 0)
321
+ return;
322
+ // use effScreenSize (the frozen anchor space the positions were built in) for
323
+ // the off-screen/close target too, so a close while the keyboard is still up
324
+ // animates fully out instead of to a mismatched live screenSize.
325
+ //
326
+ // web: clear the maximum the viewport can ever reveal, not just the current
327
+ // layout viewport. iOS Safari retracts its chrome on scroll and exposes area
328
+ // below the current viewport, so a sheet parked at effScreenSize would peek
329
+ // back in as the page scrolls. getMaxViewportHeight floors the target past
330
+ // anything Safari can expose.
331
+ const closeTarget = constants_1.isWeb
332
+ ? Math.max(effScreenSize, (0, webViewport_ts_1.getMaxViewportHeight)())
333
+ : effScreenSize;
334
+ let toValue = isHidden || position === -1 ? closeTarget : activePositions[position];
335
+ if (at.current === toValue)
336
+ return;
337
+ at.current = toValue;
338
+ stopSpring();
339
+ const isOpenAnimation = position !== -1 && !isHidden;
340
+ // clear any pending fallback timer
341
+ if (opacityFallbackTimer.current) {
342
+ clearTimeout(opacityFallbackTimer.current);
343
+ opacityFallbackTimer.current = null;
344
+ }
345
+ const animationCompleteCallback = () => {
346
+ syncAnimatedPosition(toValue);
347
+ if (opacityFallbackTimer.current) {
348
+ clearTimeout(opacityFallbackTimer.current);
349
+ opacityFallbackTimer.current = null;
350
+ }
351
+ // use openRef (live) not open (stale closure) — if the sheet
352
+ // was reopened before this callback fires (e.g. cancelled close
353
+ // animation), we must not hide it
354
+ if (!isOpenAnimation && !openRef.current) {
355
+ setOpacity(0);
356
+ }
357
+ onAnimationComplete?.({ open: isOpenAnimation });
358
+ // also notify the SheetController so a parent (e.g. Dialog adapt)
359
+ // can hold the sheet's children mounted until the slide-out is done
360
+ controller?.onAnimationComplete?.({ open: isOpenAnimation });
361
+ };
362
+ // safety fallback: if animation callback never fires, still hide the sheet
363
+ if (!isOpenAnimation) {
364
+ opacityFallbackTimer.current = setTimeout(() => {
365
+ opacityFallbackTimer.current = null;
366
+ // check live open state via ref — sheet may have reopened (e.g. adapt handoff)
367
+ if (!openRef.current) {
368
+ setOpacity(0);
369
+ }
370
+ }, 1000);
371
+ }
372
+ // skip animation when adapting from dialog to sheet
373
+ if (skipAdaptAnimation.current) {
374
+ skipAdaptAnimation.current = false;
375
+ animatedNumber.setValue(toValue, { type: 'timing', duration: 0 }, animationCompleteCallback);
376
+ return;
377
+ }
378
+ animatedNumber.setValue(toValue, animationOverride || {
379
+ type: 'spring',
380
+ ...transitionConfig,
381
+ }, animationCompleteCallback);
382
+ });
383
+ (0, constants_1.useIsomorphicLayoutEffect)(() => {
384
+ // we need to do a *three* step process for the css driver
385
+ // first render off screen for ssr safety (hiddenSize)
386
+ // then render to bottom of screen without animation (screenSize)
387
+ // then add the animation as it animates from screenSize to position
388
+ if (hasntMeasured && screenSize && frameSize) {
389
+ at.current = screenSize;
390
+ animatedNumber.setValue(screenSize, {
391
+ type: 'timing',
392
+ duration: 0,
393
+ }, () => {
394
+ syncAnimatedPosition(screenSize);
395
+ // imperfect but struggling to render properly here
396
+ setTimeout(() => {
397
+ setDisableAnimation(false);
398
+ }, 10);
399
+ });
400
+ return;
401
+ }
402
+ if (disableAnimation) {
403
+ return;
404
+ }
405
+ // never fight an active drag: the gesture owns the animated position. on
406
+ // web the AnimatedView's onLayout re-fires with sub-pixel jitter as the
407
+ // frame translates (frameSize 499.99996 <-> 500.00003), and since frameSize
408
+ // is a dep of this effect that would re-run it mid-pull and snap the sheet
409
+ // back to its resting snap point. read the live ref so drag-end (which the
410
+ // reconcile-after-drag effect handles) isn't gated by stale deps.
411
+ if (isDraggingRef.current) {
412
+ return;
413
+ }
414
+ if (!frameSize || !screenSize || isHidden || (hasntMeasured && !open)) {
415
+ return;
416
+ }
417
+ // finally, animate
418
+ animateTo(position);
419
+ // reset scroll bridge
420
+ if (position === -1) {
421
+ scrollBridge.scrollLock = false;
422
+ scrollBridge.scrollStartY = -1;
423
+ }
424
+ // set initial isAtTop state when sheet opens
425
+ // position 0 = top snap point, so isAtTop = true
426
+ if (open && position >= 0) {
427
+ const isTopPosition = position === 0;
428
+ scrollBridge.isAtTop = isTopPosition;
429
+ if (isTopPosition) {
430
+ scrollBridge.scrollLockY = undefined;
431
+ scrollBridge.setScrollEnabled?.(true);
432
+ }
433
+ else {
434
+ scrollBridge.scrollLockY = 0;
435
+ scrollBridge.setScrollEnabled?.(false);
436
+ }
437
+ }
438
+ // NOTE: effScreenSize/effectiveFrameSize are intentionally NOT deps. With the
439
+ // spacer approach the frame's position target is frozen across keyboard
440
+ // open/close (same stable baseline), so it must NOT re-animate — keyboard
441
+ // avoidance is the bottom spacer + scroll, not a frame move.
442
+ }, [hasntMeasured, disableAnimation, isHidden, frameSize, screenSize, open, position]);
443
+ const disableDrag = props.disableDrag ?? controller?.disableDrag;
444
+ const themeName = (0, core_1.useThemeName)();
445
+ const [blockPan, setBlockPan] = react_1.default.useState(false);
446
+ const panResponder = react_1.default.useMemo(() => {
447
+ if (disableDrag)
448
+ return;
449
+ if (!frameSize)
450
+ return;
451
+ if (isShowingInnerSheet)
452
+ return;
453
+ // use keyboard-adjusted positions (matches the RNGH path): when the
454
+ // keyboard is open the sheet sits at activePositions[0], so clamping drags
455
+ // against the un-adjusted positions[0] would rubber-band the sheet down to
456
+ // near the bottom on any drag.
457
+ const minY = activePositions[0];
458
+ scrollBridge.paneMinY = minY;
459
+ let startY = at.current;
460
+ function setPanning(val) {
461
+ setIsDragging(val);
462
+ // make unselectable:
463
+ if ("web" === 'web') {
464
+ if (!sheetHiddenStyleSheet) {
465
+ sheetHiddenStyleSheet = document.createElement('style');
466
+ if (typeof document.head !== 'undefined') {
467
+ document.head.appendChild(sheetHiddenStyleSheet);
468
+ }
469
+ }
470
+ if (!val) {
471
+ sheetHiddenStyleSheet.innerText = '';
472
+ }
473
+ else {
474
+ sheetHiddenStyleSheet.innerText =
475
+ ':root * { user-select: none !important; -webkit-user-select: none !important; }';
476
+ }
477
+ }
478
+ }
479
+ const release = ({ vy }) => {
480
+ scrollBridge.setParentDragging(false);
481
+ if (scrollBridge.scrollLock) {
482
+ return;
483
+ }
484
+ isExternalDrag = false;
485
+ previouslyScrolling = false;
486
+ setPanning(false);
487
+ // use the actual current animated position rather than dragAt + startY.
488
+ // after mid-gesture handoffs (pan→scroll→pan), startY can be stale
489
+ // causing the computed position to be wildly wrong (triggering dismiss).
490
+ const currentPos = at.current;
491
+ // vy goes up to about 4 at most (+ is down, - is up)
492
+ const end = currentPos + frameSize * vy * 0.2;
493
+ const closestPoint = (0, keyboardAvoidance_ts_1.getSheetReleasePosition)({
494
+ positions: activePositions,
495
+ projectedEnd: end,
496
+ currentPosition: currentPos,
497
+ frameSize,
498
+ dismissOnSnapToBottom,
499
+ snapPointsMode,
500
+ isKeyboardVisible,
501
+ isWeb: constants_1.isWeb,
502
+ });
503
+ // have to call both because state may not change but need to snap back
504
+ setPosition(closestPoint);
505
+ animateTo(closestPoint);
506
+ };
507
+ const finish = (_e, state) => {
508
+ release({
509
+ vy: state.vy,
510
+ dragAt: state.dy,
511
+ });
512
+ };
513
+ let previouslyScrolling = false;
514
+ const onMoveShouldSet = (e, { dy }) => {
515
+ function getShouldSet() {
516
+ // if dragging handle always allow:
517
+ if (e.target === providerProps.handleRef.current) {
518
+ return true;
519
+ }
520
+ // touch is on the ScrollView node — the web scroll-view gesture hook
521
+ // owns it and drives drag/release through scrollBridge directly (it
522
+ // re-baselines via scrollBridge.startPanDrag on each pan handoff). if
523
+ // we also granted here, RNW's PanResponder would set the animated
524
+ // position from a second, differently-based offset every move and the
525
+ // sheet would jitter/jump. defer entirely to the hook.
526
+ if (scrollBridge.scrollNodeTouched) {
527
+ return false;
528
+ }
529
+ if (scrollBridge.hasScrollableContent === true) {
530
+ if (scrollBridge.scrollLock) {
531
+ return false;
532
+ }
533
+ const isScrolled = scrollBridge.y !== 0;
534
+ // Update the dragging direction
535
+ const isDraggingUp = dy < 0;
536
+ // we can treat near top instead of exactly to avoid trouble with springs
537
+ const isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
538
+ if (isScrolled) {
539
+ previouslyScrolling = true;
540
+ return false;
541
+ }
542
+ // prevent drag once at top and pulling up
543
+ if (isNearTop) {
544
+ if (hasScrollView.current && isDraggingUp) {
545
+ return false;
546
+ }
547
+ }
548
+ }
549
+ // we could do some detection of other touchables and cancel here..
550
+ return Math.abs(dy) > 10;
551
+ }
552
+ const granted = getShouldSet();
553
+ if (granted) {
554
+ scrollBridge.setParentDragging(true);
555
+ }
556
+ return granted;
557
+ };
558
+ const grant = () => {
559
+ setPanning(true);
560
+ stopSpring();
561
+ startY = getAnimatedPosition();
562
+ };
563
+ let isExternalDrag = false;
564
+ // re-baseline a pan drag to the current animated position. the web
565
+ // scroll-view hook calls this on every transition INTO pan ownership
566
+ // (including handoffs back from scroll), so its panDragOffset — which it
567
+ // resets to 0 at each pan entry — is measured from where the sheet
568
+ // actually is now, not from where the gesture first grabbed it. without
569
+ // this the sheet would jump to a stale origin on a scroll→pan handoff.
570
+ scrollBridge.startPanDrag = () => {
571
+ isExternalDrag = true;
572
+ grant();
573
+ };
574
+ scrollBridge.drag = (dy) => {
575
+ if (!isExternalDrag) {
576
+ isExternalDrag = true;
577
+ grant();
578
+ }
579
+ const to = dy + startY;
580
+ setAnimatedPositionDirect((0, helpers_tsx_1.resisted)(to, minY));
581
+ };
582
+ scrollBridge.release = release;
583
+ // direct snap to position without release calculation (for handoff cases)
584
+ scrollBridge.snapToPosition = (positionIndex) => {
585
+ isExternalDrag = false;
586
+ previouslyScrolling = false;
587
+ setPanning(false);
588
+ setPosition(positionIndex);
589
+ animateTo(positionIndex);
590
+ };
591
+ return react_native_1.PanResponder.create({
592
+ onMoveShouldSetPanResponder: onMoveShouldSet,
593
+ // once we own the drag, don't yield it to another responder
594
+ // (re-renders during the drag were cooperatively terminating it under
595
+ // load, killing the gesture mid-drag)
596
+ onPanResponderTerminationRequest: () => false,
597
+ onPanResponderGrant: grant,
598
+ onPanResponderMove: (_e, { dy }) => {
599
+ const toFull = dy + startY;
600
+ const to = (0, helpers_tsx_1.resisted)(toFull, minY);
601
+ // handles the case where you hand off back and forth more than once
602
+ const isAtTop = to <= minY;
603
+ if (isAtTop) {
604
+ scrollBridge.setParentDragging(false);
605
+ }
606
+ else {
607
+ scrollBridge.setParentDragging(true);
608
+ }
609
+ setAnimatedPositionDirect(to);
610
+ },
611
+ onPanResponderEnd: finish,
612
+ onPanResponderTerminate: finish,
613
+ onPanResponderRelease: finish,
614
+ });
615
+ }, [
616
+ disableDrag,
617
+ isShowingInnerSheet,
618
+ animateTo,
619
+ frameSize,
620
+ activePositions,
621
+ setPosition,
622
+ dismissOnSnapToBottom,
623
+ snapPointsMode,
624
+ ]);
625
+ // animate to the current keyboard-adjusted position when the keyboard state
626
+ // changes. activePositions shift the frame up by keyboardHeight, capped at
627
+ // the safe-area top; tall web fit sheets keep a frozen height and gain scroll
628
+ // padding for whatever tail remains behind the keyboard.
629
+ react_1.default.useEffect(() => {
630
+ if (isDragging || isHidden || !open || disableAnimation)
631
+ return;
632
+ if (!frameSize || !screenSize)
633
+ return;
634
+ // timing animation matches the iOS keyboard animation (~250ms)
635
+ animateTo(position, { type: 'timing', duration: 250 });
636
+ }, [isKeyboardVisible, keyboardHeight]);
637
+ // reconcile position after drag ends — if keyboard dismissed during drag
638
+ // (e.g., input blur), activePositions reverted but onEnd used frozen positions
639
+ // for snap index. This effect ensures the sheet animates to the correct
640
+ // non-keyboard-adjusted position for the chosen snap index.
641
+ const wasDragging = react_1.default.useRef(false);
642
+ react_1.default.useEffect(() => {
643
+ if (isDragging) {
644
+ wasDragging.current = true;
645
+ return;
646
+ }
647
+ if (!wasDragging.current)
648
+ return;
649
+ wasDragging.current = false;
650
+ // drag just ended — reconcile position with latest activePositions
651
+ if (!frameSize || !screenSize || isHidden || !open)
652
+ return;
653
+ animateTo(position);
654
+ }, [isDragging]);
655
+ // dismiss keyboard when sheet closes
656
+ react_1.default.useEffect(() => {
657
+ if (!open && isKeyboardVisible) {
658
+ dismissKeyboard();
659
+ // if the sheet was closed mid-drag the keyboard-hide handler was paused
660
+ // and a hide could be left pending — clear it so isKeyboardVisible can't
661
+ // stick true after the sheet is gone. (no-op for a normal close.)
662
+ pauseKeyboardHandler.current = false;
663
+ flushPendingHide();
664
+ }
665
+ }, [open]);
666
+ // gesture handler hook for RNGH-based gesture coordination
667
+ const { panGesture, panGestureRef, gestureHandlerEnabled } = (0, useGestureHandlerPan_tsx_1.useGestureHandlerPan)({
668
+ positions: activePositions,
669
+ frameSize,
670
+ setPosition,
671
+ animateTo,
672
+ stopSpring,
673
+ scrollBridge,
674
+ setIsDragging,
675
+ getCurrentPosition: getAnimatedPosition,
676
+ resisted: helpers_tsx_1.resisted,
677
+ disableDrag,
678
+ isShowingInnerSheet,
679
+ // directly set the animated value for smooth dragging
680
+ setAnimatedPosition: setAnimatedPositionDirect,
681
+ dismissOnSnapToBottom,
682
+ snapPointsMode,
683
+ isKeyboardVisible,
684
+ pauseKeyboardHandler,
685
+ });
686
+ // ignore any layout measured while the soft keyboard is up (web +
687
+ // moveOnKeyboardChange): the visual viewport (which RN's web layout follows)
688
+ // shrinks, so the height would be the collapsed sheet — keeping it would
689
+ // recompute the fit anchor and fly the frame. a LIVE DOM check, NOT the
690
+ // isKeyboardVisible React state, is required: the state lags the resize, so
691
+ // the first shrunk onLayout lands before the flag flips. holding the measured
692
+ // size keeps the fit geometry stable while the frame translates with the kb.
693
+ const ignoreLayoutForKeyboard = (0, core_1.useEvent)(() => constants_1.isWeb &&
694
+ moveOnKeyboardChange &&
695
+ (0, webViewport_ts_1.getWebKeyboardResizeHeight)() >= webViewport_ts_1.MIN_KEYBOARD_HEIGHT);
696
+ const handleAnimationViewLayout = (0, core_1.useEvent)((e) => {
697
+ // don't update frameSize during exit animation to prevent position jumps
698
+ if (!open && stableFrameSize.current !== 0) {
699
+ return;
700
+ }
701
+ const layoutHeight = e.nativeEvent?.layout.height;
702
+ // drop a layout measured while the keyboard is up: on older iOS the web
703
+ // viewport shrinks and the frame would resize. keep the pre-keyboard frame
704
+ // height so the web frame translates without resizing.
705
+ // exception: if we have no frame height yet (sheet opened with the keyboard
706
+ // already up), accept it so the sheet can appear at all.
707
+ if (ignoreLayoutForKeyboard() && frameSize > 0)
708
+ return;
709
+ // avoid bugs where it grows forever for whatever reason
710
+ // For inline mode (non-modal), don't cap at window height - use actual layout
711
+ const next = modal
712
+ ? Math.min(layoutHeight, getStableViewportHeight())
713
+ : layoutHeight;
714
+ if (!next)
715
+ return;
716
+ // round: web onLayout reports sub-pixel heights (e.g. 499.99996) that jitter
717
+ // frame to frame as the view transforms; the raw float would re-fire every
718
+ // effect that depends on frameSize on each drag move.
719
+ setFrameSize(Math.round(next));
720
+ });
721
+ const handleMaxContentViewLayout = react_1.default.useCallback((e) => {
722
+ // keep maxContentSize at the full pre-keyboard viewport: drop layouts
723
+ // measured while the keyboard is up (the shrunk viewport), unless we have
724
+ // none yet (keyboard-already-up open).
725
+ if (ignoreLayoutForKeyboard() && screenSize > 0)
726
+ return;
727
+ // avoid bugs where it grows forever for whatever reason
728
+ const next = Math.min(e.nativeEvent?.layout.height, getStableViewportHeight());
729
+ if (!next)
730
+ return;
731
+ // round to avoid sub-pixel churn re-firing size-dependent effects
732
+ setMaxContentSize(Math.round(next));
733
+ }, [ignoreLayoutForKeyboard, screenSize]);
734
+ const getAnimatedNumberStyle = react_1.default.useCallback((val) => {
735
+ 'worklet';
736
+ const translateY = frameSize === 0 ? hiddenSize : val;
737
+ return {
738
+ transform: [{ translateY }],
739
+ };
740
+ }, [frameSize]);
741
+ const animatedStyle = useAnimatedNumberStyle(animatedNumber, getAnimatedNumberStyle);
742
+ // we need to set this *after* fully closed to 0, to avoid it overlapping
743
+ // the page when resizing quickly on web for example
744
+ const [opacity, setOpacity] = react_1.default.useState(open ? 1 : 0);
745
+ if (open && opacity === 0) {
746
+ setOpacity(1);
747
+ // cancel any pending close fallback — sheet is reopening
748
+ if (opacityFallbackTimer.current) {
749
+ clearTimeout(opacityFallbackTimer.current);
750
+ opacityFallbackTimer.current = null;
751
+ }
752
+ }
753
+ const forcedContentHeight = hasFit
754
+ ? undefined
755
+ : snapPointsMode === 'percent'
756
+ ? // Use dvh for modal (viewport-relative), % for inline (container-relative)
757
+ `${maxSnapPoint}${constants_1.isWeb ? (modal ? 'dvh' : '%') : '%'}`
758
+ : maxSnapPoint;
759
+ const setHasScrollView = react_1.default.useCallback((val) => {
760
+ hasScrollView.current = val;
761
+ }, []);
762
+ // const id = useId()
763
+ // const { AdaptProvider, when, children } = useAdaptParent({
764
+ // scope: `${id}Sheet`,
765
+ // portal: true,
766
+ // })
767
+ let contents = ((0, jsx_runtime_1.jsx)(core_1.LayoutMeasurementController, { disable: !open, children: (0, jsx_runtime_1.jsx)(contexts_ts_1.ParentSheetContext.Provider, { value: nextParentContext, children: (0, jsx_runtime_1.jsx)(SheetContext_tsx_1.SheetProvider, { ...providerProps, keyboardOccludedHeight: keyboardOccludedHeight, isKeyboardVisible: isKeyboardVisible, keyboardStableFrameHeight: keyboardStableFrameHeight, setHasScrollView: setHasScrollView, children: (0, jsx_runtime_1.jsxs)(GestureSheetContext_tsx_1.GestureSheetProvider, { isDragging: isDragging, blockPan: blockPan, setBlockPan: setBlockPan, panGesture: panGesture, panGestureRef: panGestureRef, children: [(0, jsx_runtime_1.jsx)(animate_presence_1.AnimatePresence, { custom: { open }, children: shouldHideParentSheet || !open ? null : overlayComponent }), snapPointsMode !== 'percent' && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
768
+ opacity: 0,
769
+ position: 'absolute',
770
+ top: 0,
771
+ left: 0,
772
+ right: 0,
773
+ bottom: 0,
774
+ pointerEvents: 'none',
775
+ }, onLayout: handleMaxContentViewLayout })), (0, jsx_runtime_1.jsx)(AnimatedView, { ref: ref, onLayout: handleAnimationViewLayout,
776
+ // @ts-ignore for CSS driver this is necessary to attach the transition
777
+ // also motion driver at least though i suspect all drivers?
778
+ transition: isDragging || disableAnimation ? null : transition,
779
+ // @ts-ignore
780
+ disableClassName: true, style: [
781
+ {
782
+ position: 'absolute',
783
+ zIndex,
784
+ width: '100%',
785
+ height: forcedContentHeight,
786
+ minHeight: forcedContentHeight,
787
+ opacity: shouldHideParentSheet
788
+ ? 0
789
+ : disableTransparencyHide
790
+ ? 1
791
+ : opacity,
792
+ ...((shouldHideParentSheet || !open) && {
793
+ pointerEvents: 'none',
794
+ }),
795
+ },
796
+ animatedStyle,
797
+ ], children: gestureHandlerEnabled && panGesture ? ((0, jsx_runtime_1.jsx)(GestureDetectorWrapper_tsx_1.GestureDetectorWrapper, { gesture: panGesture, style: { flex: 1 }, children: props.children })) : ((0, jsx_runtime_1.jsx)(react_native_1.View, { ...panResponder?.panHandlers, style: { flex: 1, width: '100%', height: '100%' }, children: props.children })) })] }) }) }) }));
798
+ if ("web" === 'native' && (0, portal_1.needsPortalRepropagation)()) {
799
+ // TODO alongside sheet scope="" need to pass scope here
800
+ const adaptContext = (0, adapt_1.useAdaptContext)();
801
+ contents = ((0, jsx_runtime_1.jsx)(adapt_1.ProvideAdaptContext, { ...adaptContext, children: (0, jsx_runtime_1.jsx)(useSafeAreaInsets_ts_1.SafeAreaInsetsContext.Provider, { value: safeAreaInsets, children: contents }) }));
802
+ }
803
+ // start mounted so we get an accurate measurement the first time
804
+ const shouldMountChildren = unmountChildrenWhenHidden ? !!opacity : true;
805
+ if (modal) {
806
+ // a modal sheet is teleported through <Portal> to the root portal host.
807
+ // that host is mounted by GuiProvider, which may sit ABOVE the app's
808
+ // GestureHandlerRootView - so the teleported content lands outside any
809
+ // rngh root and every gesture inside the sheet (the drag pan, pressables
810
+ // on the rngh press path) silently goes dead. re-establish an rngh root
811
+ // around the teleported content so it works regardless of where the app
812
+ // mounts GestureHandlerRootView.
813
+ //
814
+ // the root stays mounted and full-width whenever the sheet content is
815
+ // (so child layout/measurement/close-animation are unaffected) and only
816
+ // collapses to 0 height while closed so it occupies no hit area - see
817
+ // rnghRootStyleOpen/Closed above for why pointerEvents can't be used.
818
+ const RNGHRoot = (0, gestureState_ts_1.getGestureHandlerState)().RootView;
819
+ const mountedContents = shouldMountChildren ? ((0, jsx_runtime_1.jsx)(ContainerComponent, { children: contents })) : null;
820
+ const modalContents = ((0, jsx_runtime_1.jsx)(portal_1.Portal, { stackZIndex: zIndex, ...portalProps, children: mountedContents && RNGHRoot ? ((0, jsx_runtime_1.jsx)(RNGHRoot, { style: open ? rnghRootStyleOpen : rnghRootStyleClosed, children: mountedContents })) : (mountedContents) }));
821
+ if (constants_1.isWeb) {
822
+ return modalContents;
823
+ }
824
+ // on native we don't support multiple modals yet... fix for now is to hide outer one
825
+ return ((0, jsx_runtime_1.jsx)(contexts_ts_1.SheetInsideSheetContext.Provider, { value: onInnerSheet, children: modalContents }));
826
+ }
827
+ return contents;
828
+ });
829
+ function getYPositions(mode, point, screenSize, frameSize) {
830
+ if (!screenSize || !frameSize) {
831
+ return 0;
832
+ }
833
+ if (mode === 'mixed') {
834
+ if (typeof point === 'number') {
835
+ return screenSize - Math.min(screenSize, Math.max(0, point));
836
+ }
837
+ if (point === 'fit') {
838
+ return screenSize - Math.min(screenSize, frameSize);
839
+ }
840
+ if (point.endsWith('%')) {
841
+ const pct = Math.min(100, Math.max(0, Number(point.slice(0, -1)))) / 100;
842
+ if (Number.isNaN(pct)) {
843
+ console.warn('Invalid snapPoint percentage string');
844
+ return 0;
845
+ }
846
+ return Math.round(screenSize - pct * screenSize);
847
+ }
848
+ console.warn('Invalid snapPoint unknown value');
849
+ return 0;
850
+ }
851
+ if (mode === 'fit') {
852
+ if (point === 0)
853
+ return screenSize;
854
+ return screenSize - Math.min(screenSize, frameSize);
855
+ }
856
+ if (mode === 'constant' && typeof point === 'number') {
857
+ return screenSize - Math.min(screenSize, Math.max(0, point));
858
+ }
859
+ const pct = Math.min(100, Math.max(0, Number(point))) / 100;
860
+ if (Number.isNaN(pct)) {
861
+ console.warn('Invalid snapPoint percentage');
862
+ return 0;
863
+ }
864
+ return Math.round(screenSize - pct * screenSize);
865
+ }
866
+ //# sourceMappingURL=SheetImplementationCustom.js.map