@tamagui/sheet 2.0.0-rc.9 → 2.1.0

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 (469) hide show
  1. package/.turbo/turbo-build.log +2 -0
  2. package/controller/index.cjs +2 -1
  3. package/controller/index.js +2 -0
  4. package/controller/index.native.cjs +2 -0
  5. package/controller/index.native.js +2 -0
  6. package/dist/cjs/GestureDetectorWrapper.cjs +27 -21
  7. package/dist/cjs/GestureDetectorWrapper.native.js +33 -28
  8. package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -1
  9. package/dist/cjs/GestureSheetContext.cjs +14 -12
  10. package/dist/cjs/GestureSheetContext.native.js +29 -27
  11. package/dist/cjs/GestureSheetContext.native.js.map +1 -1
  12. package/dist/cjs/Sheet.cjs +88 -86
  13. package/dist/cjs/Sheet.native.js +88 -86
  14. package/dist/cjs/Sheet.native.js.map +1 -1
  15. package/dist/cjs/SheetContext.cjs +16 -14
  16. package/dist/cjs/SheetContext.native.js +16 -14
  17. package/dist/cjs/SheetContext.native.js.map +1 -1
  18. package/dist/cjs/SheetController.cjs +40 -32
  19. package/dist/cjs/SheetController.native.js +62 -54
  20. package/dist/cjs/SheetController.native.js.map +1 -1
  21. package/dist/cjs/SheetImplementationCustom.cjs +617 -429
  22. package/dist/cjs/SheetImplementationCustom.native.js +647 -474
  23. package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
  24. package/dist/cjs/SheetScrollView.cjs +198 -135
  25. package/dist/cjs/SheetScrollView.native.js +216 -163
  26. package/dist/cjs/SheetScrollView.native.js.map +1 -1
  27. package/dist/cjs/constants.cjs +16 -14
  28. package/dist/cjs/constants.native.js +16 -14
  29. package/dist/cjs/constants.native.js.map +1 -1
  30. package/dist/cjs/contexts.cjs +27 -25
  31. package/dist/cjs/contexts.native.js +29 -27
  32. package/dist/cjs/contexts.native.js.map +1 -1
  33. package/dist/cjs/controller.cjs +14 -12
  34. package/dist/cjs/controller.native.js +14 -12
  35. package/dist/cjs/controller.native.js.map +1 -1
  36. package/dist/cjs/createSheet.cjs +159 -160
  37. package/dist/cjs/createSheet.native.js +172 -180
  38. package/dist/cjs/createSheet.native.js.map +1 -1
  39. package/dist/cjs/gestureState.cjs +12 -10
  40. package/dist/cjs/gestureState.native.js +12 -10
  41. package/dist/cjs/gestureState.native.js.map +1 -1
  42. package/dist/cjs/helpers.cjs +17 -13
  43. package/dist/cjs/helpers.native.js +17 -13
  44. package/dist/cjs/helpers.native.js.map +1 -1
  45. package/dist/cjs/index.cjs +7 -5
  46. package/dist/cjs/index.native.js +7 -5
  47. package/dist/cjs/index.native.js.map +1 -1
  48. package/dist/cjs/keyboardAvoidance.cjs +42 -0
  49. package/dist/cjs/keyboardAvoidance.native.js +46 -0
  50. package/dist/cjs/keyboardAvoidance.native.js.map +1 -0
  51. package/dist/cjs/nativeSheet.cjs +68 -55
  52. package/dist/cjs/nativeSheet.native.js +77 -68
  53. package/dist/cjs/nativeSheet.native.js.map +1 -1
  54. package/dist/cjs/setupGestureHandler.cjs +24 -18
  55. package/dist/cjs/setupGestureHandler.native.js +24 -19
  56. package/dist/cjs/setupGestureHandler.native.js.map +1 -1
  57. package/dist/cjs/types.cjs +7 -5
  58. package/dist/cjs/types.native.js +7 -5
  59. package/dist/cjs/types.native.js.map +1 -1
  60. package/dist/cjs/useGestureHandlerPan.cjs +181 -111
  61. package/dist/cjs/useGestureHandlerPan.native.js +183 -115
  62. package/dist/cjs/useGestureHandlerPan.native.js.map +1 -1
  63. package/dist/cjs/useKeyboardControllerSheet.cjs +76 -18
  64. package/dist/cjs/useKeyboardControllerSheet.native.js +100 -82
  65. package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -1
  66. package/dist/cjs/useSheet.cjs +12 -10
  67. package/dist/cjs/useSheet.native.js +16 -14
  68. package/dist/cjs/useSheet.native.js.map +1 -1
  69. package/dist/cjs/useSheetController.cjs +35 -33
  70. package/dist/cjs/useSheetController.native.js +37 -35
  71. package/dist/cjs/useSheetController.native.js.map +1 -1
  72. package/dist/cjs/useSheetOffscreenSize.cjs +35 -23
  73. package/dist/cjs/useSheetOffscreenSize.native.js +36 -27
  74. package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
  75. package/dist/cjs/useSheetOpenState.cjs +28 -25
  76. package/dist/cjs/useSheetOpenState.native.js +39 -37
  77. package/dist/cjs/useSheetOpenState.native.js.map +1 -1
  78. package/dist/cjs/useSheetProviderProps.cjs +129 -81
  79. package/dist/cjs/useSheetProviderProps.native.js +165 -122
  80. package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
  81. package/dist/cjs/useSheetScrollViewGestures.cjs +129 -81
  82. package/dist/cjs/useSheetScrollViewGestures.native.js +128 -79
  83. package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -1
  84. package/dist/cjs/webViewport.cjs +50 -0
  85. package/dist/cjs/webViewport.native.js +54 -0
  86. package/dist/cjs/webViewport.native.js.map +1 -0
  87. package/dist/esm/GestureDetectorWrapper.mjs +12 -8
  88. package/dist/esm/GestureDetectorWrapper.mjs.map +1 -1
  89. package/dist/esm/GestureDetectorWrapper.native.js +18 -15
  90. package/dist/esm/GestureDetectorWrapper.native.js.map +1 -1
  91. package/dist/esm/GestureSheetContext.native.js +14 -14
  92. package/dist/esm/GestureSheetContext.native.js.map +1 -1
  93. package/dist/esm/Sheet.mjs +70 -70
  94. package/dist/esm/Sheet.mjs.map +1 -1
  95. package/dist/esm/Sheet.native.js +70 -70
  96. package/dist/esm/Sheet.native.js.map +1 -1
  97. package/dist/esm/SheetContext.mjs +2 -2
  98. package/dist/esm/SheetContext.mjs.map +1 -1
  99. package/dist/esm/SheetContext.native.js +2 -2
  100. package/dist/esm/SheetContext.native.js.map +1 -1
  101. package/dist/esm/SheetController.mjs +12 -6
  102. package/dist/esm/SheetController.mjs.map +1 -1
  103. package/dist/esm/SheetController.native.js +18 -12
  104. package/dist/esm/SheetController.native.js.map +1 -1
  105. package/dist/esm/SheetImplementationCustom.mjs +575 -389
  106. package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
  107. package/dist/esm/SheetImplementationCustom.native.js +601 -434
  108. package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
  109. package/dist/esm/SheetScrollView.mjs +165 -104
  110. package/dist/esm/SheetScrollView.mjs.map +1 -1
  111. package/dist/esm/SheetScrollView.native.js +184 -133
  112. package/dist/esm/SheetScrollView.native.js.map +1 -1
  113. package/dist/esm/constants.mjs +4 -4
  114. package/dist/esm/constants.mjs.map +1 -1
  115. package/dist/esm/constants.native.js +4 -4
  116. package/dist/esm/constants.native.js.map +1 -1
  117. package/dist/esm/contexts.mjs +3 -3
  118. package/dist/esm/contexts.mjs.map +1 -1
  119. package/dist/esm/contexts.native.js +3 -3
  120. package/dist/esm/contexts.native.js.map +1 -1
  121. package/dist/esm/createSheet.mjs +130 -133
  122. package/dist/esm/createSheet.mjs.map +1 -1
  123. package/dist/esm/createSheet.native.js +142 -152
  124. package/dist/esm/createSheet.native.js.map +1 -1
  125. package/dist/esm/helpers.mjs +5 -3
  126. package/dist/esm/helpers.mjs.map +1 -1
  127. package/dist/esm/helpers.native.js +5 -3
  128. package/dist/esm/helpers.native.js.map +1 -1
  129. package/dist/esm/index.js +11 -11
  130. package/dist/esm/index.js.map +1 -6
  131. package/dist/esm/keyboardAvoidance.mjs +17 -0
  132. package/dist/esm/keyboardAvoidance.mjs.map +1 -0
  133. package/dist/esm/keyboardAvoidance.native.js +18 -0
  134. package/dist/esm/keyboardAvoidance.native.js.map +1 -0
  135. package/dist/esm/nativeSheet.mjs +49 -38
  136. package/dist/esm/nativeSheet.mjs.map +1 -1
  137. package/dist/esm/nativeSheet.native.js +55 -48
  138. package/dist/esm/nativeSheet.native.js.map +1 -1
  139. package/dist/esm/setupGestureHandler.mjs +12 -8
  140. package/dist/esm/setupGestureHandler.mjs.map +1 -1
  141. package/dist/esm/setupGestureHandler.native.js +12 -9
  142. package/dist/esm/setupGestureHandler.native.js.map +1 -1
  143. package/dist/esm/useGestureHandlerPan.mjs +167 -99
  144. package/dist/esm/useGestureHandlerPan.mjs.map +1 -1
  145. package/dist/esm/useGestureHandlerPan.native.js +168 -102
  146. package/dist/esm/useGestureHandlerPan.native.js.map +1 -1
  147. package/dist/esm/useKeyboardControllerSheet.mjs +65 -9
  148. package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -1
  149. package/dist/esm/useKeyboardControllerSheet.native.js +85 -69
  150. package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -1
  151. package/dist/esm/useSheetController.mjs +11 -11
  152. package/dist/esm/useSheetController.mjs.map +1 -1
  153. package/dist/esm/useSheetController.native.js +11 -11
  154. package/dist/esm/useSheetController.native.js.map +1 -1
  155. package/dist/esm/useSheetOffscreenSize.mjs +23 -13
  156. package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
  157. package/dist/esm/useSheetOffscreenSize.native.js +24 -17
  158. package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
  159. package/dist/esm/useSheetOpenState.mjs +14 -13
  160. package/dist/esm/useSheetOpenState.mjs.map +1 -1
  161. package/dist/esm/useSheetOpenState.native.js +17 -17
  162. package/dist/esm/useSheetOpenState.native.js.map +1 -1
  163. package/dist/esm/useSheetProviderProps.mjs +101 -55
  164. package/dist/esm/useSheetProviderProps.mjs.map +1 -1
  165. package/dist/esm/useSheetProviderProps.native.js +137 -96
  166. package/dist/esm/useSheetProviderProps.native.js.map +1 -1
  167. package/dist/esm/useSheetScrollViewGestures.mjs +117 -71
  168. package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -1
  169. package/dist/esm/useSheetScrollViewGestures.native.js +116 -69
  170. package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -1
  171. package/dist/esm/webViewport.mjs +22 -0
  172. package/dist/esm/webViewport.mjs.map +1 -0
  173. package/dist/esm/webViewport.native.js +23 -0
  174. package/dist/esm/webViewport.native.js.map +1 -0
  175. package/dist/jsx/GestureDetectorWrapper.mjs +12 -8
  176. package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -1
  177. package/dist/jsx/GestureDetectorWrapper.native.js +33 -28
  178. package/dist/jsx/GestureDetectorWrapper.native.js.map +1 -1
  179. package/dist/jsx/GestureSheetContext.native.js +29 -27
  180. package/dist/jsx/GestureSheetContext.native.js.map +1 -1
  181. package/dist/jsx/Sheet.mjs +70 -70
  182. package/dist/jsx/Sheet.mjs.map +1 -1
  183. package/dist/jsx/Sheet.native.js +88 -86
  184. package/dist/jsx/Sheet.native.js.map +1 -1
  185. package/dist/jsx/SheetContext.mjs +2 -2
  186. package/dist/jsx/SheetContext.mjs.map +1 -1
  187. package/dist/jsx/SheetContext.native.js +16 -14
  188. package/dist/jsx/SheetContext.native.js.map +1 -1
  189. package/dist/jsx/SheetController.mjs +12 -6
  190. package/dist/jsx/SheetController.mjs.map +1 -1
  191. package/dist/jsx/SheetController.native.js +62 -54
  192. package/dist/jsx/SheetController.native.js.map +1 -1
  193. package/dist/jsx/SheetImplementationCustom.mjs +575 -389
  194. package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
  195. package/dist/jsx/SheetImplementationCustom.native.js +647 -474
  196. package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
  197. package/dist/jsx/SheetScrollView.mjs +165 -104
  198. package/dist/jsx/SheetScrollView.mjs.map +1 -1
  199. package/dist/jsx/SheetScrollView.native.js +216 -163
  200. package/dist/jsx/SheetScrollView.native.js.map +1 -1
  201. package/dist/jsx/constants.mjs +4 -4
  202. package/dist/jsx/constants.mjs.map +1 -1
  203. package/dist/jsx/constants.native.js +16 -14
  204. package/dist/jsx/constants.native.js.map +1 -1
  205. package/dist/jsx/contexts.mjs +3 -3
  206. package/dist/jsx/contexts.mjs.map +1 -1
  207. package/dist/jsx/contexts.native.js +29 -27
  208. package/dist/jsx/contexts.native.js.map +1 -1
  209. package/dist/jsx/controller.native.js +14 -12
  210. package/dist/jsx/createSheet.mjs +130 -133
  211. package/dist/jsx/createSheet.mjs.map +1 -1
  212. package/dist/jsx/createSheet.native.js +172 -180
  213. package/dist/jsx/createSheet.native.js.map +1 -1
  214. package/dist/jsx/gestureState.native.js +12 -10
  215. package/dist/jsx/gestureState.native.js.map +1 -1
  216. package/dist/jsx/helpers.mjs +5 -3
  217. package/dist/jsx/helpers.mjs.map +1 -1
  218. package/dist/jsx/helpers.native.js +17 -13
  219. package/dist/jsx/helpers.native.js.map +1 -1
  220. package/dist/jsx/index.js +11 -11
  221. package/dist/jsx/index.js.map +1 -6
  222. package/dist/jsx/index.native.js +7 -5
  223. package/dist/jsx/index.native.js.map +1 -1
  224. package/dist/jsx/keyboardAvoidance.mjs +17 -0
  225. package/dist/jsx/keyboardAvoidance.mjs.map +1 -0
  226. package/dist/jsx/keyboardAvoidance.native.js +46 -0
  227. package/dist/jsx/keyboardAvoidance.native.js.map +1 -0
  228. package/dist/jsx/nativeSheet.mjs +49 -38
  229. package/dist/jsx/nativeSheet.mjs.map +1 -1
  230. package/dist/jsx/nativeSheet.native.js +77 -68
  231. package/dist/jsx/nativeSheet.native.js.map +1 -1
  232. package/dist/jsx/setupGestureHandler.mjs +12 -8
  233. package/dist/jsx/setupGestureHandler.mjs.map +1 -1
  234. package/dist/jsx/setupGestureHandler.native.js +24 -19
  235. package/dist/jsx/setupGestureHandler.native.js.map +1 -1
  236. package/dist/jsx/types.native.js +7 -5
  237. package/dist/jsx/useGestureHandlerPan.mjs +167 -99
  238. package/dist/jsx/useGestureHandlerPan.mjs.map +1 -1
  239. package/dist/jsx/useGestureHandlerPan.native.js +183 -115
  240. package/dist/jsx/useGestureHandlerPan.native.js.map +1 -1
  241. package/dist/jsx/useKeyboardControllerSheet.mjs +65 -9
  242. package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -1
  243. package/dist/jsx/useKeyboardControllerSheet.native.js +100 -82
  244. package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -1
  245. package/dist/jsx/useSheet.native.js +16 -14
  246. package/dist/jsx/useSheetController.mjs +11 -11
  247. package/dist/jsx/useSheetController.mjs.map +1 -1
  248. package/dist/jsx/useSheetController.native.js +37 -35
  249. package/dist/jsx/useSheetController.native.js.map +1 -1
  250. package/dist/jsx/useSheetOffscreenSize.mjs +23 -13
  251. package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
  252. package/dist/jsx/useSheetOffscreenSize.native.js +36 -27
  253. package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
  254. package/dist/jsx/useSheetOpenState.mjs +14 -13
  255. package/dist/jsx/useSheetOpenState.mjs.map +1 -1
  256. package/dist/jsx/useSheetOpenState.native.js +39 -37
  257. package/dist/jsx/useSheetOpenState.native.js.map +1 -1
  258. package/dist/jsx/useSheetProviderProps.mjs +101 -55
  259. package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
  260. package/dist/jsx/useSheetProviderProps.native.js +165 -122
  261. package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
  262. package/dist/jsx/useSheetScrollViewGestures.mjs +117 -71
  263. package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -1
  264. package/dist/jsx/useSheetScrollViewGestures.native.js +128 -79
  265. package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -1
  266. package/dist/jsx/webViewport.mjs +22 -0
  267. package/dist/jsx/webViewport.mjs.map +1 -0
  268. package/dist/jsx/webViewport.native.js +54 -0
  269. package/dist/jsx/webViewport.native.js.map +1 -0
  270. package/next.md +78 -0
  271. package/package.json +29 -39
  272. package/setup-gesture-handler/index.cjs +2 -0
  273. package/setup-gesture-handler/index.js +2 -0
  274. package/setup-gesture-handler/index.native.cjs +2 -0
  275. package/setup-gesture-handler/index.native.js +2 -0
  276. package/src/GestureDetectorWrapper.tsx +0 -3
  277. package/src/SheetController.tsx +4 -1
  278. package/src/SheetImplementationCustom.tsx +414 -84
  279. package/src/SheetScrollView.tsx +74 -9
  280. package/src/keyboardAvoidance.ts +30 -0
  281. package/src/nativeSheet.tsx +9 -1
  282. package/src/types.tsx +16 -1
  283. package/src/useGestureHandlerPan.tsx +5 -15
  284. package/src/useKeyboardControllerSheet.ts +106 -10
  285. package/src/useSheetController.tsx +4 -0
  286. package/src/useSheetProviderProps.tsx +17 -0
  287. package/src/useSheetScrollViewGestures.ts +23 -2
  288. package/src/webViewport.ts +52 -0
  289. package/test/keyboardAvoidance.test.ts +53 -0
  290. package/tsconfig.json +57 -0
  291. package/types/GestureDetectorWrapper.d.ts.map +1 -1
  292. package/types/Sheet.d.ts +3 -0
  293. package/types/Sheet.d.ts.map +1 -1
  294. package/types/SheetContext.d.ts +4 -0
  295. package/types/SheetContext.d.ts.map +1 -1
  296. package/types/SheetController.d.ts +1 -1
  297. package/types/SheetController.d.ts.map +1 -1
  298. package/types/SheetImplementationCustom.d.ts +3 -0
  299. package/types/SheetImplementationCustom.d.ts.map +1 -1
  300. package/types/SheetScrollView.d.ts.map +1 -1
  301. package/types/createSheet.d.ts +3 -0
  302. package/types/createSheet.d.ts.map +1 -1
  303. package/types/keyboardAvoidance.d.ts +8 -0
  304. package/types/keyboardAvoidance.d.ts.map +1 -0
  305. package/types/nativeSheet.d.ts.map +1 -1
  306. package/types/types.d.ts +10 -1
  307. package/types/types.d.ts.map +1 -1
  308. package/types/useGestureHandlerPan.d.ts.map +1 -1
  309. package/types/useKeyboardControllerSheet.d.ts +14 -3
  310. package/types/useKeyboardControllerSheet.d.ts.map +1 -1
  311. package/types/useSheetController.d.ts +3 -0
  312. package/types/useSheetController.d.ts.map +1 -1
  313. package/types/useSheetProviderProps.d.ts +4 -0
  314. package/types/useSheetProviderProps.d.ts.map +1 -1
  315. package/types/useSheetScrollViewGestures.d.ts.map +1 -1
  316. package/types/webViewport.d.ts +30 -0
  317. package/types/webViewport.d.ts.map +1 -0
  318. package/dist/cjs/GestureDetectorWrapper.js +0 -29
  319. package/dist/cjs/GestureDetectorWrapper.js.map +0 -6
  320. package/dist/cjs/GestureSheetContext.js +0 -43
  321. package/dist/cjs/GestureSheetContext.js.map +0 -6
  322. package/dist/cjs/Sheet.js +0 -104
  323. package/dist/cjs/Sheet.js.map +0 -6
  324. package/dist/cjs/SheetContext.js +0 -28
  325. package/dist/cjs/SheetContext.js.map +0 -6
  326. package/dist/cjs/SheetController.js +0 -52
  327. package/dist/cjs/SheetController.js.map +0 -6
  328. package/dist/cjs/SheetImplementationCustom.js +0 -393
  329. package/dist/cjs/SheetImplementationCustom.js.map +0 -6
  330. package/dist/cjs/SheetScrollView.js +0 -137
  331. package/dist/cjs/SheetScrollView.js.map +0 -6
  332. package/dist/cjs/constants.js +0 -24
  333. package/dist/cjs/constants.js.map +0 -6
  334. package/dist/cjs/contexts.js +0 -33
  335. package/dist/cjs/contexts.js.map +0 -6
  336. package/dist/cjs/controller.js +0 -23
  337. package/dist/cjs/controller.js.map +0 -6
  338. package/dist/cjs/createSheet.js +0 -152
  339. package/dist/cjs/createSheet.js.map +0 -6
  340. package/dist/cjs/gestureState.js +0 -34
  341. package/dist/cjs/gestureState.js.map +0 -6
  342. package/dist/cjs/helpers.js +0 -26
  343. package/dist/cjs/helpers.js.map +0 -6
  344. package/dist/cjs/index.js +0 -25
  345. package/dist/cjs/index.js.map +0 -6
  346. package/dist/cjs/nativeSheet.js +0 -56
  347. package/dist/cjs/nativeSheet.js.map +0 -6
  348. package/dist/cjs/setupGestureHandler.js +0 -38
  349. package/dist/cjs/setupGestureHandler.js.map +0 -6
  350. package/dist/cjs/types.js +0 -14
  351. package/dist/cjs/types.js.map +0 -6
  352. package/dist/cjs/useGestureHandlerPan.js +0 -126
  353. package/dist/cjs/useGestureHandlerPan.js.map +0 -6
  354. package/dist/cjs/useKeyboardControllerSheet.js +0 -34
  355. package/dist/cjs/useKeyboardControllerSheet.js.map +0 -6
  356. package/dist/cjs/useSheet.js +0 -22
  357. package/dist/cjs/useSheet.js.map +0 -6
  358. package/dist/cjs/useSheetController.js +0 -39
  359. package/dist/cjs/useSheetController.js.map +0 -6
  360. package/dist/cjs/useSheetOffscreenSize.js +0 -43
  361. package/dist/cjs/useSheetOffscreenSize.js.map +0 -6
  362. package/dist/cjs/useSheetOpenState.js +0 -37
  363. package/dist/cjs/useSheetOpenState.js.map +0 -6
  364. package/dist/cjs/useSheetProviderProps.js +0 -130
  365. package/dist/cjs/useSheetProviderProps.js.map +0 -6
  366. package/dist/cjs/useSheetScrollViewGestures.js +0 -102
  367. package/dist/cjs/useSheetScrollViewGestures.js.map +0 -6
  368. package/dist/esm/GestureDetectorWrapper.js +0 -15
  369. package/dist/esm/GestureDetectorWrapper.js.map +0 -6
  370. package/dist/esm/GestureSheetContext.js +0 -28
  371. package/dist/esm/GestureSheetContext.js.map +0 -6
  372. package/dist/esm/Sheet.js +0 -92
  373. package/dist/esm/Sheet.js.map +0 -6
  374. package/dist/esm/SheetContext.js +0 -13
  375. package/dist/esm/SheetContext.js.map +0 -6
  376. package/dist/esm/SheetController.js +0 -31
  377. package/dist/esm/SheetController.js.map +0 -6
  378. package/dist/esm/SheetImplementationCustom.js +0 -395
  379. package/dist/esm/SheetImplementationCustom.js.map +0 -6
  380. package/dist/esm/SheetScrollView.js +0 -122
  381. package/dist/esm/SheetScrollView.js.map +0 -6
  382. package/dist/esm/constants.js +0 -8
  383. package/dist/esm/constants.js.map +0 -6
  384. package/dist/esm/contexts.js +0 -9
  385. package/dist/esm/contexts.js.map +0 -6
  386. package/dist/esm/controller.js +0 -11
  387. package/dist/esm/controller.js.map +0 -6
  388. package/dist/esm/createSheet.js +0 -153
  389. package/dist/esm/createSheet.js.map +0 -6
  390. package/dist/esm/gestureState.js +0 -18
  391. package/dist/esm/gestureState.js.map +0 -6
  392. package/dist/esm/helpers.js +0 -10
  393. package/dist/esm/helpers.js.map +0 -6
  394. package/dist/esm/nativeSheet.js +0 -46
  395. package/dist/esm/nativeSheet.js.map +0 -6
  396. package/dist/esm/setupGestureHandler.js +0 -22
  397. package/dist/esm/setupGestureHandler.js.map +0 -6
  398. package/dist/esm/types.js +0 -1
  399. package/dist/esm/types.js.map +0 -6
  400. package/dist/esm/useGestureHandlerPan.js +0 -111
  401. package/dist/esm/useGestureHandlerPan.js.map +0 -6
  402. package/dist/esm/useKeyboardControllerSheet.js +0 -18
  403. package/dist/esm/useKeyboardControllerSheet.js.map +0 -6
  404. package/dist/esm/useSheet.js +0 -6
  405. package/dist/esm/useSheet.js.map +0 -6
  406. package/dist/esm/useSheetController.js +0 -15
  407. package/dist/esm/useSheetController.js.map +0 -6
  408. package/dist/esm/useSheetOffscreenSize.js +0 -27
  409. package/dist/esm/useSheetOffscreenSize.js.map +0 -6
  410. package/dist/esm/useSheetOpenState.js +0 -22
  411. package/dist/esm/useSheetOpenState.js.map +0 -6
  412. package/dist/esm/useSheetProviderProps.js +0 -109
  413. package/dist/esm/useSheetProviderProps.js.map +0 -6
  414. package/dist/esm/useSheetScrollViewGestures.js +0 -86
  415. package/dist/esm/useSheetScrollViewGestures.js.map +0 -6
  416. package/dist/jsx/GestureDetectorWrapper.js +0 -15
  417. package/dist/jsx/GestureDetectorWrapper.js.map +0 -6
  418. package/dist/jsx/GestureSheetContext.js +0 -28
  419. package/dist/jsx/GestureSheetContext.js.map +0 -6
  420. package/dist/jsx/Sheet.js +0 -92
  421. package/dist/jsx/Sheet.js.map +0 -6
  422. package/dist/jsx/SheetContext.js +0 -13
  423. package/dist/jsx/SheetContext.js.map +0 -6
  424. package/dist/jsx/SheetController.js +0 -31
  425. package/dist/jsx/SheetController.js.map +0 -6
  426. package/dist/jsx/SheetImplementationCustom.js +0 -395
  427. package/dist/jsx/SheetImplementationCustom.js.map +0 -6
  428. package/dist/jsx/SheetScrollView.js +0 -122
  429. package/dist/jsx/SheetScrollView.js.map +0 -6
  430. package/dist/jsx/constants.js +0 -8
  431. package/dist/jsx/constants.js.map +0 -6
  432. package/dist/jsx/contexts.js +0 -9
  433. package/dist/jsx/contexts.js.map +0 -6
  434. package/dist/jsx/controller.js +0 -11
  435. package/dist/jsx/controller.js.map +0 -6
  436. package/dist/jsx/createSheet.js +0 -153
  437. package/dist/jsx/createSheet.js.map +0 -6
  438. package/dist/jsx/gestureState.js +0 -18
  439. package/dist/jsx/gestureState.js.map +0 -6
  440. package/dist/jsx/helpers.js +0 -10
  441. package/dist/jsx/helpers.js.map +0 -6
  442. package/dist/jsx/nativeSheet.js +0 -46
  443. package/dist/jsx/nativeSheet.js.map +0 -6
  444. package/dist/jsx/setupGestureHandler.js +0 -22
  445. package/dist/jsx/setupGestureHandler.js.map +0 -6
  446. package/dist/jsx/types.js +0 -1
  447. package/dist/jsx/types.js.map +0 -6
  448. package/dist/jsx/useGestureHandlerPan.js +0 -111
  449. package/dist/jsx/useGestureHandlerPan.js.map +0 -6
  450. package/dist/jsx/useKeyboardControllerSheet.js +0 -18
  451. package/dist/jsx/useKeyboardControllerSheet.js.map +0 -6
  452. package/dist/jsx/useSheet.js +0 -6
  453. package/dist/jsx/useSheet.js.map +0 -6
  454. package/dist/jsx/useSheetController.js +0 -15
  455. package/dist/jsx/useSheetController.js.map +0 -6
  456. package/dist/jsx/useSheetOffscreenSize.js +0 -27
  457. package/dist/jsx/useSheetOffscreenSize.js.map +0 -6
  458. package/dist/jsx/useSheetOpenState.js +0 -22
  459. package/dist/jsx/useSheetOpenState.js.map +0 -6
  460. package/dist/jsx/useSheetProviderProps.js +0 -109
  461. package/dist/jsx/useSheetProviderProps.js.map +0 -6
  462. package/dist/jsx/useSheetScrollViewGestures.js +0 -86
  463. package/dist/jsx/useSheetScrollViewGestures.js.map +0 -6
  464. package/types/GestureDetectorWrapper.native.d.ts +0 -14
  465. package/types/gestureState.native.d.ts +0 -12
  466. package/types/setupGestureHandler.native.d.ts +0 -41
  467. package/types/useGestureHandlerPan.native.d.ts +0 -33
  468. package/types/useSheetScrollViewGestures.web.d.ts +0 -15
  469. package/types/useSheetScrollViewGestures.web.d.ts.map +0 -1
@@ -1,15 +1,19 @@
1
+ import { ProvideAdaptContext, useAdaptContext } from "@tamagui/adapt";
1
2
  import { AnimatePresence } from "@tamagui/animate-presence";
2
3
  import { useComposedRefs } from "@tamagui/compose-refs";
3
4
  import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
4
- import { LayoutMeasurementController, View as TamaguiView, Theme, useConfiguration, useDidFinishSSR, useEvent, useThemeName } from "@tamagui/core";
5
+ import { LayoutMeasurementController, View as TamaguiView, useConfiguration, useDidFinishSSR, useEvent, useThemeName } from "@tamagui/core";
5
6
  import { getSafeArea } from "@tamagui/native";
6
7
  import { needsPortalRepropagation, Portal } from "@tamagui/portal";
7
8
  import React, { useState } from "react";
8
9
  import { Dimensions, PanResponder, View } from "react-native-web";
9
10
  import { ParentSheetContext, SheetInsideSheetContext } from "./contexts.mjs";
10
11
  import { GestureDetectorWrapper } from "./GestureDetectorWrapper.mjs";
12
+ import { getGestureHandlerState } from "./gestureState.mjs";
11
13
  import { GestureSheetProvider } from "./GestureSheetContext.mjs";
12
14
  import { resisted } from "./helpers.mjs";
15
+ import { getKeyboardOccludedHeight } from "./keyboardAvoidance.mjs";
16
+ import { getStableLayoutViewportHeight, getWebKeyboardHeight, MIN_KEYBOARD_HEIGHT } from "./webViewport.mjs";
13
17
  import { SheetProvider } from "./SheetContext.mjs";
14
18
  import { useGestureHandlerPan } from "./useGestureHandlerPan.mjs";
15
19
  import { useKeyboardControllerSheet } from "./useKeyboardControllerSheet.mjs";
@@ -17,422 +21,604 @@ import { useSheetOpenState } from "./useSheetOpenState.mjs";
17
21
  import { useSheetProviderProps } from "./useSheetProviderProps.mjs";
18
22
  import { jsx, jsxs } from "react/jsx-runtime";
19
23
  const hiddenSize = 10000.1;
24
+ const rnghRootStyleOpen = {
25
+ width: "100%",
26
+ height: "100%"
27
+ };
28
+ const rnghRootStyleClosed = {
29
+ width: "100%",
30
+ height: 0
31
+ };
20
32
  let _cachedSafeAreaTop;
21
33
  function getSafeAreaTopInset() {
22
- return _cachedSafeAreaTop !== void 0 || (_cachedSafeAreaTop = getSafeArea().getInsets().top), _cachedSafeAreaTop;
34
+ if (_cachedSafeAreaTop !== void 0) return _cachedSafeAreaTop;
35
+ _cachedSafeAreaTop = getSafeArea().getInsets().top;
36
+ return _cachedSafeAreaTop;
23
37
  }
24
38
  let sheetHiddenStyleSheet = null;
25
- const relativeDimensionTo = isWeb ? "window" : "screen",
26
- SheetImplementationCustom = React.forwardRef(function (props, forwardedRef) {
27
- const parentSheet = React.useContext(ParentSheetContext),
28
- {
29
- transition,
30
- transitionConfig: transitionConfigProp,
31
- modal = !1,
32
- zIndex = parentSheet.zIndex + 1,
33
- moveOnKeyboardChange = !1,
34
- unmountChildrenWhenHidden = !1,
35
- portalProps,
36
- containerComponent: ContainerComponent = React.Fragment
37
- } = props,
38
- state = useSheetOpenState(props),
39
- [overlayComponent, setOverlayComponent] = React.useState(null),
40
- providerProps = useSheetProviderProps(props, state, {
41
- onOverlayComponent: setOverlayComponent
42
- }),
43
- {
44
- frameSize,
45
- setFrameSize,
46
- snapPoints,
47
- snapPointsMode,
48
- hasFit,
49
- position,
50
- setPosition,
51
- scrollBridge,
52
- screenSize,
53
- setMaxContentSize,
54
- maxSnapPoint
55
- } = providerProps,
56
- {
57
- open,
58
- controller,
59
- isHidden
60
- } = state,
61
- sheetRef = React.useRef(void 0),
62
- ref = useComposedRefs(forwardedRef, sheetRef, providerProps.contentRef),
63
- {
64
- animationDriver
65
- } = useConfiguration();
66
- if (!animationDriver) throw new Error("Sheet requires an animation driver to be set");
67
- const transitionConfig = (() => {
68
- if (transitionConfigProp) return transitionConfigProp;
69
- const [animationProp, animationPropConfig] = transition ? Array.isArray(transition) ? transition : [transition] : [];
70
- return animationProp && animationDriver.animations?.[animationProp] ? {
71
- ...animationDriver.animations[animationProp],
72
- ...animationPropConfig
73
- } : null;
74
- })(),
75
- [isShowingInnerSheet, setIsShowingInnerSheet] = React.useState(!1),
76
- shouldHideParentSheet = !isWeb && modal && isShowingInnerSheet && needsPortalRepropagation(),
77
- sheetInsideSheet = React.useContext(SheetInsideSheetContext),
78
- onInnerSheet = React.useCallback(hasChild => {
79
- setIsShowingInnerSheet(hasChild);
80
- }, []),
81
- stableFrameSize = React.useRef(frameSize);
82
- React.useEffect(() => {
83
- open && frameSize && (stableFrameSize.current = frameSize);
84
- }, [open, frameSize]);
85
- const effectiveFrameSize = open ? frameSize : stableFrameSize.current || frameSize,
86
- positions = React.useMemo(() => snapPoints.map(point => getYPositions(snapPointsMode, point, screenSize, effectiveFrameSize)), [screenSize, effectiveFrameSize, snapPoints, snapPointsMode]),
87
- {
88
- keyboardHeight,
89
- isKeyboardVisible,
90
- dismissKeyboard,
91
- pauseKeyboardHandler,
92
- flushPendingHide
93
- } = useKeyboardControllerSheet({
94
- enabled: !isWeb && !!moveOnKeyboardChange
95
- }),
96
- [isDragging, setIsDragging_] = React.useState(!1),
97
- isDraggingRef = React.useRef(!1),
98
- setIsDragging = React.useCallback(val => {
99
- isDraggingRef.current = val, pauseKeyboardHandler.current = val, setIsDragging_(val), val || flushPendingHide();
100
- }, [pauseKeyboardHandler, flushPendingHide]),
101
- activePositionsRef = React.useRef(positions),
102
- activePositions = React.useMemo(() => {
103
- if (isDragging || isDraggingRef.current) return activePositionsRef.current;
104
- let result;
105
- if (!isKeyboardVisible || keyboardHeight <= 0) result = positions;else {
106
- const safeAreaTop = isWeb ? 0 : getSafeAreaTopInset();
107
- result = positions.map(p => screenSize && p >= screenSize ? p : Math.max(safeAreaTop, p - keyboardHeight));
108
- }
109
- return activePositionsRef.current = result, result;
110
- }, [positions, isKeyboardVisible, keyboardHeight, screenSize, isDragging]),
111
- {
112
- useAnimatedNumber,
113
- useAnimatedNumberStyle,
114
- useAnimatedNumberReaction
115
- } = animationDriver,
116
- AnimatedView = animationDriver.View ?? TamaguiView;
117
- useIsomorphicLayoutEffect(() => {
118
- if (sheetInsideSheet && open) return sheetInsideSheet(!0), () => {
119
- sheetInsideSheet(!1);
120
- };
121
- }, [sheetInsideSheet, open]);
122
- const nextParentContext = React.useMemo(() => ({
123
- zIndex
124
- }), [zIndex]),
125
- startPosition = useDidFinishSSR() && screenSize ? screenSize : hiddenSize,
126
- animatedNumber = useAnimatedNumber(startPosition),
127
- at = React.useRef(startPosition),
128
- hasntMeasured = at.current === hiddenSize,
129
- [disableAnimation, setDisableAnimation] = useState(hasntMeasured),
130
- skipAdaptAnimation = React.useRef(!1);
131
- controller?.skipNextAnimation && (skipAdaptAnimation.current = !0);
132
- const hasScrollView = React.useRef(!1);
133
- useAnimatedNumberReaction({
134
- value: animatedNumber,
135
- hostRef: sheetRef
136
- }, React.useCallback(value => {
137
- at.current = value, scrollBridge.paneY = value;
138
- const minY = activePositions[0],
139
- wasAtTop = scrollBridge.isAtTop,
140
- nowAtTop = value <= minY + 5;
141
- wasAtTop !== nowAtTop && (scrollBridge.isAtTop = nowAtTop, nowAtTop ? (scrollBridge.scrollLockY = void 0, scrollBridge.setScrollEnabled?.(!0)) : (scrollBridge.scrollLockY = 0, scrollBridge.setScrollEnabled?.(!1)));
142
- }, [animationDriver, activePositions]));
143
- function stopSpring() {
144
- animatedNumber.stop(), scrollBridge.onFinishAnimate && (scrollBridge.onFinishAnimate(), scrollBridge.onFinishAnimate = void 0);
39
+ const relativeDimensionTo = isWeb ? "window" : "screen";
40
+ function getStableViewportHeight() {
41
+ if (isWeb && typeof window !== "undefined") return getStableLayoutViewportHeight();
42
+ return Dimensions.get(relativeDimensionTo).height;
43
+ }
44
+ const SheetImplementationCustom = React.forwardRef(function SheetImplementationCustom2(props, forwardedRef) {
45
+ const parentSheet = React.useContext(ParentSheetContext);
46
+ const {
47
+ transition,
48
+ transitionConfig: transitionConfigProp,
49
+ modal = false,
50
+ zIndex = parentSheet.zIndex + 1,
51
+ moveOnKeyboardChange = false,
52
+ unmountChildrenWhenHidden = false,
53
+ portalProps,
54
+ containerComponent: ContainerComponent = React.Fragment,
55
+ onAnimationComplete
56
+ } = props;
57
+ const state = useSheetOpenState(props);
58
+ const [overlayComponent, setOverlayComponent] = React.useState(null);
59
+ const providerProps = useSheetProviderProps(props, state, {
60
+ onOverlayComponent: setOverlayComponent
61
+ });
62
+ const {
63
+ frameSize,
64
+ setFrameSize,
65
+ snapPoints,
66
+ snapPointsMode,
67
+ hasFit,
68
+ position,
69
+ setPosition,
70
+ scrollBridge,
71
+ screenSize,
72
+ setMaxContentSize,
73
+ maxSnapPoint
74
+ } = providerProps;
75
+ const {
76
+ open,
77
+ controller,
78
+ isHidden
79
+ } = state;
80
+ const openRef = React.useRef(open);
81
+ openRef.current = open;
82
+ const sheetRef = React.useRef(void 0);
83
+ const ref = useComposedRefs(forwardedRef, sheetRef, providerProps.contentRef);
84
+ const {
85
+ animationDriver
86
+ } = useConfiguration();
87
+ if (!animationDriver) throw new Error(`Sheet requires an animation driver to be set`);
88
+ const transitionConfig = (() => {
89
+ if (transitionConfigProp) return transitionConfigProp;
90
+ const [animationProp, animationPropConfig] = !transition ? [] : Array.isArray(transition) ? transition : [transition];
91
+ if (animationProp && animationDriver.animations?.[animationProp]) return {
92
+ ...animationDriver.animations[animationProp],
93
+ ...animationPropConfig
94
+ };
95
+ return null;
96
+ })();
97
+ const [isShowingInnerSheet, setIsShowingInnerSheet] = React.useState(false);
98
+ const shouldHideParentSheet = !isWeb && modal && isShowingInnerSheet && needsPortalRepropagation();
99
+ const sheetInsideSheet = React.useContext(SheetInsideSheetContext);
100
+ const onInnerSheet = React.useCallback(hasChild => {
101
+ setIsShowingInnerSheet(hasChild);
102
+ }, []);
103
+ const {
104
+ keyboardHeight,
105
+ isKeyboardVisible,
106
+ dismissKeyboard,
107
+ pauseKeyboardHandler,
108
+ flushPendingHide
109
+ } = useKeyboardControllerSheet({
110
+ enabled: Boolean(moveOnKeyboardChange)
111
+ });
112
+ const stableFrameSize = React.useRef(frameSize);
113
+ React.useEffect(() => {
114
+ if (open && frameSize) stableFrameSize.current = frameSize;
115
+ }, [open, frameSize]);
116
+ const isWebKbSheet = isWeb && hasFit && moveOnKeyboardChange;
117
+ const hasCleanKbBaseline = React.useRef(false);
118
+ const seedSettled = React.useRef(false);
119
+ const stableKbGeom = React.useRef({
120
+ frame: 0,
121
+ screen: 0
122
+ });
123
+ if ((!isWeb || !isKeyboardVisible) && frameSize > 0 && screenSize > 0) {
124
+ stableKbGeom.current.frame = frameSize;
125
+ stableKbGeom.current.screen = screenSize;
126
+ hasCleanKbBaseline.current = true;
127
+ } else if (isWebKbSheet && isKeyboardVisible && !hasCleanKbBaseline.current && screenSize > 0) stableKbGeom.current.screen = Math.max(stableKbGeom.current.screen, screenSize);
128
+ const seedingKbBaseline = isWebKbSheet && isKeyboardVisible && !hasCleanKbBaseline.current && !seedSettled.current;
129
+ const freezeForKb = isWebKbSheet && isKeyboardVisible && stableKbGeom.current.frame > 0;
130
+ const effScreenSize = freezeForKb ? stableKbGeom.current.screen : screenSize;
131
+ const effectiveFrameSize = freezeForKb ? stableKbGeom.current.frame : open ? frameSize : stableFrameSize.current || frameSize;
132
+ const positions = React.useMemo(() => snapPoints.map(point => getYPositions(snapPointsMode, point, effScreenSize, effectiveFrameSize)), [effScreenSize, effectiveFrameSize, snapPoints, snapPointsMode]);
133
+ const [isDragging, setIsDragging_] = React.useState(false);
134
+ const isDraggingRef = React.useRef(false);
135
+ const setIsDragging = React.useCallback(val => {
136
+ isDraggingRef.current = val;
137
+ pauseKeyboardHandler.current = val;
138
+ setIsDragging_(val);
139
+ if (!val) flushPendingHide();
140
+ }, [pauseKeyboardHandler, flushPendingHide]);
141
+ const activePositionsRef = React.useRef(positions);
142
+ const activePositions = React.useMemo(() => {
143
+ if (isDragging || isDraggingRef.current) return activePositionsRef.current;
144
+ let result;
145
+ if (isWeb || !isKeyboardVisible || keyboardHeight <= 0) result = positions;else {
146
+ const safeAreaTop = getSafeAreaTopInset();
147
+ result = positions.map(p => {
148
+ if (screenSize && p >= screenSize) return p;
149
+ return Math.max(safeAreaTop, p - keyboardHeight);
150
+ });
145
151
  }
146
- const animateTo = useEvent((position2, animationOverride) => {
147
- if (frameSize === 0) return;
148
- let toValue = isHidden || position2 === -1 ? screenSize : activePositions[position2];
149
- if (at.current !== toValue) {
150
- if (at.current = toValue, stopSpring(), skipAdaptAnimation.current) {
151
- skipAdaptAnimation.current = !1, animatedNumber.setValue(toValue, {
152
- type: "timing",
153
- duration: 0
154
- });
155
- return;
152
+ activePositionsRef.current = result;
153
+ return result;
154
+ }, [positions, isKeyboardVisible, keyboardHeight, screenSize, isDragging]);
155
+ const keyboardOccludedHeight = seedingKbBaseline ? 0 : getKeyboardOccludedHeight({
156
+ frameSize: effectiveFrameSize,
157
+ isKeyboardVisible,
158
+ keyboardHeight,
159
+ screenSize: effScreenSize,
160
+ sheetY: position >= 0 ? activePositions[position] : void 0
161
+ });
162
+ const keyboardStableFrameHeight = !isWebKbSheet ? 0 : seedingKbBaseline ? stableKbGeom.current.screen || screenSize : stableKbGeom.current.frame > 0 ? stableKbGeom.current.frame : 0;
163
+ const {
164
+ useAnimatedNumber,
165
+ useAnimatedNumberStyle,
166
+ useAnimatedNumberReaction
167
+ } = animationDriver;
168
+ const AnimatedView = animationDriver.View ?? TamaguiView;
169
+ useIsomorphicLayoutEffect(() => {
170
+ if (!(sheetInsideSheet && open)) return;
171
+ sheetInsideSheet(true);
172
+ return () => {
173
+ sheetInsideSheet(false);
174
+ };
175
+ }, [sheetInsideSheet, open]);
176
+ const nextParentContext = React.useMemo(() => ({
177
+ zIndex
178
+ }), [zIndex]);
179
+ const startPosition = useDidFinishSSR() && screenSize ? screenSize : hiddenSize;
180
+ const animatedNumber = useAnimatedNumber(startPosition);
181
+ const at = React.useRef(startPosition);
182
+ const hasntMeasured = at.current === hiddenSize;
183
+ const [disableAnimation, setDisableAnimation] = useState(hasntMeasured);
184
+ const skipAdaptAnimation = React.useRef(false);
185
+ if (controller?.skipNextAnimation) skipAdaptAnimation.current = true;
186
+ const hasScrollView = React.useRef(false);
187
+ const opacityFallbackTimer = React.useRef(null);
188
+ useAnimatedNumberReaction({
189
+ value: animatedNumber,
190
+ hostRef: sheetRef
191
+ }, React.useCallback(value => {
192
+ at.current = value;
193
+ scrollBridge.paneY = value;
194
+ const minY = activePositions[0];
195
+ const wasAtTop = scrollBridge.isAtTop;
196
+ const nowAtTop = value <= minY + 5;
197
+ if (wasAtTop !== nowAtTop) {
198
+ scrollBridge.isAtTop = nowAtTop;
199
+ if (nowAtTop) {
200
+ if (scrollBridge.y > 0) {
201
+ scrollBridge.forceScrollTo?.(0);
202
+ scrollBridge.y = 0;
156
203
  }
157
- animatedNumber.setValue(toValue, animationOverride || {
158
- type: "spring",
159
- ...transitionConfig
160
- });
204
+ scrollBridge.scrollLockY = void 0;
205
+ scrollBridge.setScrollEnabled?.(true);
206
+ } else {
207
+ scrollBridge.scrollLockY = 0;
208
+ scrollBridge.setScrollEnabled?.(false);
161
209
  }
162
- });
163
- useIsomorphicLayoutEffect(() => {
164
- if (hasntMeasured && screenSize && frameSize) {
165
- at.current = screenSize, animatedNumber.setValue(screenSize, {
166
- type: "timing",
167
- duration: 0
168
- }, () => {
169
- setTimeout(() => {
170
- setDisableAnimation(!1);
171
- }, 10);
172
- });
173
- return;
210
+ }
211
+ }, [animationDriver, activePositions]));
212
+ function stopSpring() {
213
+ animatedNumber.stop();
214
+ if (scrollBridge.onFinishAnimate) {
215
+ scrollBridge.onFinishAnimate();
216
+ scrollBridge.onFinishAnimate = void 0;
217
+ }
218
+ }
219
+ const animateTo = useEvent((position2, animationOverride) => {
220
+ if (frameSize === 0) return;
221
+ let toValue = isHidden || position2 === -1 ? effScreenSize : activePositions[position2];
222
+ if (at.current === toValue) return;
223
+ at.current = toValue;
224
+ stopSpring();
225
+ const isOpenAnimation = position2 !== -1 && !isHidden;
226
+ if (opacityFallbackTimer.current) {
227
+ clearTimeout(opacityFallbackTimer.current);
228
+ opacityFallbackTimer.current = null;
229
+ }
230
+ const animationCompleteCallback = () => {
231
+ if (opacityFallbackTimer.current) {
232
+ clearTimeout(opacityFallbackTimer.current);
233
+ opacityFallbackTimer.current = null;
174
234
  }
175
- if (!disableAnimation && !(!frameSize || !screenSize || isHidden || hasntMeasured && !open) && (animateTo(position), position === -1 && (scrollBridge.scrollLock = !1, scrollBridge.scrollStartY = -1), open && position >= 0)) {
176
- const isTopPosition = position === 0;
177
- scrollBridge.isAtTop = isTopPosition, isTopPosition ? (scrollBridge.scrollLockY = void 0, scrollBridge.setScrollEnabled?.(!0)) : (scrollBridge.scrollLockY = 0, scrollBridge.setScrollEnabled?.(!1));
235
+ if (!isOpenAnimation && !openRef.current) setOpacity(0);
236
+ onAnimationComplete?.({
237
+ open: isOpenAnimation
238
+ });
239
+ controller?.onAnimationComplete?.({
240
+ open: isOpenAnimation
241
+ });
242
+ };
243
+ if (!isOpenAnimation) opacityFallbackTimer.current = setTimeout(() => {
244
+ opacityFallbackTimer.current = null;
245
+ if (!openRef.current) setOpacity(0);
246
+ }, 1e3);
247
+ if (skipAdaptAnimation.current) {
248
+ skipAdaptAnimation.current = false;
249
+ animatedNumber.setValue(toValue, {
250
+ type: "timing",
251
+ duration: 0
252
+ }, animationCompleteCallback);
253
+ return;
254
+ }
255
+ animatedNumber.setValue(toValue, animationOverride || {
256
+ type: "spring",
257
+ ...transitionConfig
258
+ }, animationCompleteCallback);
259
+ });
260
+ useIsomorphicLayoutEffect(() => {
261
+ if (hasntMeasured && screenSize && frameSize) {
262
+ at.current = screenSize;
263
+ animatedNumber.setValue(screenSize, {
264
+ type: "timing",
265
+ duration: 0
266
+ }, () => {
267
+ setTimeout(() => {
268
+ setDisableAnimation(false);
269
+ }, 10);
270
+ });
271
+ return;
272
+ }
273
+ if (disableAnimation) return;
274
+ if (isDraggingRef.current) return;
275
+ if (!frameSize || !screenSize || isHidden || hasntMeasured && !open) return;
276
+ animateTo(position);
277
+ if (position === -1) {
278
+ scrollBridge.scrollLock = false;
279
+ scrollBridge.scrollStartY = -1;
280
+ }
281
+ if (open && position >= 0) {
282
+ const isTopPosition = position === 0;
283
+ scrollBridge.isAtTop = isTopPosition;
284
+ if (isTopPosition) {
285
+ scrollBridge.scrollLockY = void 0;
286
+ scrollBridge.setScrollEnabled?.(true);
287
+ } else {
288
+ scrollBridge.scrollLockY = 0;
289
+ scrollBridge.setScrollEnabled?.(false);
290
+ }
291
+ }
292
+ }, [hasntMeasured, disableAnimation, isHidden, frameSize, screenSize, open, position]);
293
+ const disableDrag = props.disableDrag ?? controller?.disableDrag;
294
+ useThemeName();
295
+ const [blockPan, setBlockPan] = React.useState(false);
296
+ const panResponder = React.useMemo(() => {
297
+ if (disableDrag) return;
298
+ if (!frameSize) return;
299
+ if (isShowingInnerSheet) return;
300
+ const minY = activePositions[0];
301
+ scrollBridge.paneMinY = minY;
302
+ let startY = at.current;
303
+ function setPanning(val) {
304
+ setIsDragging(val);
305
+ if (!sheetHiddenStyleSheet) {
306
+ sheetHiddenStyleSheet = document.createElement("style");
307
+ if (typeof document.head !== "undefined") document.head.appendChild(sheetHiddenStyleSheet);
178
308
  }
179
- }, [hasntMeasured, disableAnimation, isHidden, frameSize, screenSize, open, position]);
180
- const disableDrag = props.disableDrag ?? controller?.disableDrag,
181
- themeName = useThemeName(),
182
- [blockPan, setBlockPan] = React.useState(!1),
183
- panResponder = React.useMemo(() => {
184
- if (disableDrag || !frameSize || isShowingInnerSheet) return;
185
- const minY = positions[0];
186
- scrollBridge.paneMinY = minY;
187
- let startY = at.current;
188
- function setPanning(val) {
189
- setIsDragging(val), sheetHiddenStyleSheet || (sheetHiddenStyleSheet = document.createElement("style"), typeof document.head < "u" && document.head.appendChild(sheetHiddenStyleSheet)), val ? sheetHiddenStyleSheet.innerText = ":root * { user-select: none !important; -webkit-user-select: none !important; }" : sheetHiddenStyleSheet.innerText = "";
309
+ if (!val) sheetHiddenStyleSheet.innerText = "";else sheetHiddenStyleSheet.innerText = ":root * { user-select: none !important; -webkit-user-select: none !important; }";
310
+ }
311
+ const release = ({
312
+ vy
313
+ }) => {
314
+ scrollBridge.setParentDragging(false);
315
+ if (scrollBridge.scrollLock) return;
316
+ isExternalDrag = false;
317
+ previouslyScrolling = false;
318
+ setPanning(false);
319
+ const end = at.current + frameSize * vy * .2;
320
+ let closestPoint = 0;
321
+ let dist = Number.POSITIVE_INFINITY;
322
+ for (let i = 0; i < activePositions.length; i++) {
323
+ const position2 = activePositions[i];
324
+ const curDist = end > position2 ? end - position2 : position2 - end;
325
+ if (curDist < dist) {
326
+ dist = curDist;
327
+ closestPoint = i;
190
328
  }
191
- const release = ({
192
- vy
193
- }) => {
194
- if (scrollBridge.setParentDragging(!1), scrollBridge.scrollLock) return;
195
- isExternalDrag = !1, previouslyScrolling = !1, setPanning(!1);
196
- const end = at.current + frameSize * vy * 0.2;
197
- let closestPoint = 0,
198
- dist = Number.POSITIVE_INFINITY;
199
- for (let i = 0; i < positions.length; i++) {
200
- const position2 = positions[i],
201
- curDist = end > position2 ? end - position2 : position2 - end;
202
- curDist < dist && (dist = curDist, closestPoint = i);
203
- }
204
- setPosition(closestPoint), animateTo(closestPoint);
205
- },
206
- finish = (_e, state2) => {
207
- release({
208
- vy: state2.vy,
209
- dragAt: state2.dy
210
- });
211
- };
212
- let previouslyScrolling = !1;
213
- const onMoveShouldSet = (e, {
214
- dy
215
- }) => {
216
- function getShouldSet() {
217
- if (e.target === providerProps.handleRef.current) return !0;
218
- if (scrollBridge.hasScrollableContent === !0) {
219
- if (scrollBridge.scrollLock) return !1;
220
- const isScrolled = scrollBridge.y !== 0,
221
- isDraggingUp = dy < 0,
222
- isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
223
- if (isScrolled) return previouslyScrolling = !0, !1;
224
- if (isNearTop && hasScrollView.current && isDraggingUp) return !1;
225
- }
226
- return Math.abs(dy) > 10;
227
- }
228
- const granted = getShouldSet();
229
- return granted && scrollBridge.setParentDragging(!0), granted;
230
- },
231
- grant = () => {
232
- setPanning(!0), stopSpring(), startY = at.current;
233
- };
234
- let isExternalDrag = !1;
235
- return scrollBridge.drag = dy => {
236
- isExternalDrag || (isExternalDrag = !0, grant());
237
- const to = dy + startY;
238
- animatedNumber.setValue(resisted(to, minY), {
239
- type: "direct"
240
- });
241
- }, scrollBridge.release = release, scrollBridge.snapToPosition = positionIndex => {
242
- isExternalDrag = !1, previouslyScrolling = !1, setPanning(!1), setPosition(positionIndex), animateTo(positionIndex);
243
- }, PanResponder.create({
244
- onMoveShouldSetPanResponder: onMoveShouldSet,
245
- onPanResponderGrant: grant,
246
- onPanResponderMove: (_e, {
247
- dy
248
- }) => {
249
- const toFull = dy + startY,
250
- to = resisted(toFull, minY);
251
- to <= minY ? scrollBridge.setParentDragging(!1) : scrollBridge.setParentDragging(!0), animatedNumber.setValue(to, {
252
- type: "direct"
253
- });
254
- },
255
- onPanResponderEnd: finish,
256
- onPanResponderTerminate: finish,
257
- onPanResponderRelease: finish
258
- });
259
- }, [disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition]);
260
- React.useEffect(() => {
261
- isDragging || isHidden || !open || disableAnimation || !frameSize || !screenSize || animateTo(position, {
262
- type: "timing",
263
- duration: 250
329
+ }
330
+ setPosition(closestPoint);
331
+ animateTo(closestPoint);
332
+ };
333
+ const finish = (_e, state2) => {
334
+ release({
335
+ vy: state2.vy,
336
+ dragAt: state2.dy
264
337
  });
265
- }, [isKeyboardVisible, keyboardHeight]);
266
- const wasDragging = React.useRef(!1);
267
- React.useEffect(() => {
268
- if (isDragging) {
269
- wasDragging.current = !0;
270
- return;
338
+ };
339
+ let previouslyScrolling = false;
340
+ const onMoveShouldSet = (e, {
341
+ dy
342
+ }) => {
343
+ function getShouldSet() {
344
+ if (e.target === providerProps.handleRef.current) return true;
345
+ if (scrollBridge.scrollNodeTouched) return false;
346
+ if (scrollBridge.hasScrollableContent === true) {
347
+ if (scrollBridge.scrollLock) return false;
348
+ const isScrolled = scrollBridge.y !== 0;
349
+ const isDraggingUp = dy < 0;
350
+ const isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
351
+ if (isScrolled) return false;
352
+ if (isNearTop) {
353
+ if (hasScrollView.current && isDraggingUp) return false;
354
+ }
355
+ }
356
+ return Math.abs(dy) > 10;
271
357
  }
272
- wasDragging.current && (wasDragging.current = !1, !(!frameSize || !screenSize || isHidden || !open) && animateTo(position));
273
- }, [isDragging]), React.useEffect(() => {
274
- !open && isKeyboardVisible && dismissKeyboard();
275
- }, [open]);
276
- const {
277
- panGesture,
278
- panGestureRef,
279
- gestureHandlerEnabled
280
- } = useGestureHandlerPan({
281
- positions: activePositions,
282
- frameSize,
283
- setPosition,
284
- animateTo,
285
- stopSpring,
286
- scrollBridge,
287
- setIsDragging,
288
- getCurrentPosition: () => at.current,
289
- resisted,
290
- disableDrag,
291
- isShowingInnerSheet,
292
- setAnimatedPosition: val => {
293
- at.current = val, animatedNumber.setValue(val, {
294
- type: "direct"
295
- });
296
- },
297
- pauseKeyboardHandler
298
- }),
299
- handleAnimationViewLayout = React.useCallback(e => {
300
- if (!open && stableFrameSize.current !== 0) return;
301
- const layoutHeight = e.nativeEvent?.layout.height,
302
- next = modal ? Math.min(layoutHeight, Dimensions.get(relativeDimensionTo).height) : layoutHeight;
303
- next && setFrameSize(next);
304
- }, [open, modal]),
305
- handleMaxContentViewLayout = React.useCallback(e => {
306
- const next = Math.min(e.nativeEvent?.layout.height, Dimensions.get(relativeDimensionTo).height);
307
- next && setMaxContentSize(next);
308
- }, []),
309
- animatedStyle = useAnimatedNumberStyle(animatedNumber, val => {
310
- "worklet";
311
-
312
- return {
313
- transform: [{
314
- translateY: frameSize === 0 ? hiddenSize : val
315
- }]
316
- };
317
- }),
318
- [opacity, setOpacity] = React.useState(open ? 1 : 0);
319
- open && opacity === 0 && setOpacity(1), React.useEffect(() => {
320
- if (!open) {
321
- const tm = setTimeout(() => {
322
- setOpacity(0);
323
- }, 400);
324
- return () => {
325
- clearTimeout(tm);
326
- };
358
+ const granted = getShouldSet();
359
+ if (granted) scrollBridge.setParentDragging(true);
360
+ return granted;
361
+ };
362
+ const grant = () => {
363
+ setPanning(true);
364
+ stopSpring();
365
+ startY = at.current;
366
+ };
367
+ let isExternalDrag = false;
368
+ scrollBridge.startPanDrag = () => {
369
+ isExternalDrag = true;
370
+ grant();
371
+ };
372
+ scrollBridge.drag = dy => {
373
+ if (!isExternalDrag) {
374
+ isExternalDrag = true;
375
+ grant();
327
376
  }
328
- }, [open]);
329
- const forcedContentHeight = hasFit ? void 0 : snapPointsMode === "percent" ?
330
- // Use dvh for modal (viewport-relative), % for inline (container-relative)
331
- `${maxSnapPoint}${isWeb && modal ? "dvh" : "%"}` : maxSnapPoint,
332
- setHasScrollView = React.useCallback(val => {
333
- hasScrollView.current = val;
334
- }, []);
335
- let contents = /* @__PURE__ */jsx(LayoutMeasurementController, {
336
- disable: !open,
337
- children: /* @__PURE__ */jsx(ParentSheetContext.Provider, {
338
- value: nextParentContext,
339
- children: /* @__PURE__ */jsx(SheetProvider, {
340
- ...providerProps,
341
- setHasScrollView,
342
- children: /* @__PURE__ */jsxs(GestureSheetProvider, {
343
- isDragging,
344
- blockPan,
345
- setBlockPan,
346
- panGesture,
347
- panGestureRef,
348
- children: [/* @__PURE__ */jsx(AnimatePresence, {
349
- custom: {
350
- open
351
- },
352
- children: shouldHideParentSheet || !open ? null : overlayComponent
353
- }), snapPointsMode !== "percent" && /* @__PURE__ */jsx(View, {
354
- style: {
355
- opacity: 0,
356
- position: "absolute",
357
- top: 0,
358
- left: 0,
359
- right: 0,
360
- bottom: 0,
377
+ const to = dy + startY;
378
+ animatedNumber.setValue(resisted(to, minY), {
379
+ type: "direct"
380
+ });
381
+ };
382
+ scrollBridge.release = release;
383
+ scrollBridge.snapToPosition = positionIndex => {
384
+ isExternalDrag = false;
385
+ setPanning(false);
386
+ setPosition(positionIndex);
387
+ animateTo(positionIndex);
388
+ };
389
+ return PanResponder.create({
390
+ onMoveShouldSetPanResponder: onMoveShouldSet,
391
+ onPanResponderGrant: grant,
392
+ onPanResponderMove: (_e, {
393
+ dy
394
+ }) => {
395
+ const to = resisted(dy + startY, minY);
396
+ if (to <= minY) scrollBridge.setParentDragging(false);else scrollBridge.setParentDragging(true);
397
+ animatedNumber.setValue(to, {
398
+ type: "direct"
399
+ });
400
+ },
401
+ onPanResponderEnd: finish,
402
+ onPanResponderTerminate: finish,
403
+ onPanResponderRelease: finish
404
+ });
405
+ }, [disableDrag, isShowingInnerSheet, animateTo, frameSize, activePositions, setPosition]);
406
+ React.useEffect(() => {
407
+ if (isWeb) return;
408
+ if (isDragging || isHidden || !open || disableAnimation) return;
409
+ if (!frameSize || !screenSize) return;
410
+ animateTo(position, {
411
+ type: "timing",
412
+ duration: 250
413
+ });
414
+ }, [isKeyboardVisible, keyboardHeight]);
415
+ const wasDragging = React.useRef(false);
416
+ React.useEffect(() => {
417
+ if (isDragging) {
418
+ wasDragging.current = true;
419
+ return;
420
+ }
421
+ if (!wasDragging.current) return;
422
+ wasDragging.current = false;
423
+ if (!frameSize || !screenSize || isHidden || !open) return;
424
+ animateTo(position);
425
+ }, [isDragging]);
426
+ React.useEffect(() => {
427
+ if (!open && isKeyboardVisible) {
428
+ dismissKeyboard();
429
+ pauseKeyboardHandler.current = false;
430
+ flushPendingHide();
431
+ }
432
+ }, [open]);
433
+ const {
434
+ panGesture,
435
+ panGestureRef,
436
+ gestureHandlerEnabled
437
+ } = useGestureHandlerPan({
438
+ positions: activePositions,
439
+ frameSize,
440
+ setPosition,
441
+ animateTo,
442
+ stopSpring,
443
+ scrollBridge,
444
+ setIsDragging,
445
+ getCurrentPosition: () => at.current,
446
+ resisted,
447
+ disableDrag,
448
+ isShowingInnerSheet,
449
+ setAnimatedPosition: val => {
450
+ at.current = val;
451
+ animatedNumber.setValue(val, {
452
+ type: "direct"
453
+ });
454
+ },
455
+ pauseKeyboardHandler
456
+ });
457
+ const ignoreLayoutForKeyboard = useEvent(() => isWeb && moveOnKeyboardChange && getWebKeyboardHeight() >= MIN_KEYBOARD_HEIGHT);
458
+ const shouldSeedKbFrame = useEvent(() => isWebKbSheet && !hasCleanKbBaseline.current && !seedSettled.current && ignoreLayoutForKeyboard());
459
+ const shouldSeedKbScreen = useEvent(() => isWebKbSheet && !hasCleanKbBaseline.current && ignoreLayoutForKeyboard());
460
+ const handleAnimationViewLayout = useEvent(e => {
461
+ if (!open && stableFrameSize.current !== 0) return;
462
+ const seeding = shouldSeedKbFrame();
463
+ if (!seeding && ignoreLayoutForKeyboard()) return;
464
+ const layoutHeight = e.nativeEvent?.layout.height;
465
+ const next = modal || seeding ? Math.min(layoutHeight, getStableViewportHeight()) : layoutHeight;
466
+ if (!next) return;
467
+ const rounded = Math.round(next);
468
+ if (seeding) {
469
+ if (rounded > stableKbGeom.current.frame) stableKbGeom.current.frame = rounded;else if (stableKbGeom.current.frame > 0) seedSettled.current = true;
470
+ }
471
+ setFrameSize(rounded);
472
+ });
473
+ const handleMaxContentViewLayout = React.useCallback(e => {
474
+ if (shouldSeedKbScreen()) {
475
+ setMaxContentSize(Math.round(getStableViewportHeight()));
476
+ return;
477
+ }
478
+ if (ignoreLayoutForKeyboard()) return;
479
+ const next = Math.min(e.nativeEvent?.layout.height, getStableViewportHeight());
480
+ if (!next) return;
481
+ setMaxContentSize(Math.round(next));
482
+ }, [ignoreLayoutForKeyboard, shouldSeedKbScreen]);
483
+ const animatedStyle = useAnimatedNumberStyle(animatedNumber, React.useCallback(val => {
484
+ "worklet";
485
+
486
+ return {
487
+ transform: [{
488
+ translateY: frameSize === 0 ? hiddenSize : val
489
+ }]
490
+ };
491
+ }, [frameSize]));
492
+ const [opacity, setOpacity] = React.useState(open ? 1 : 0);
493
+ if (open && opacity === 0) {
494
+ setOpacity(1);
495
+ if (opacityFallbackTimer.current) {
496
+ clearTimeout(opacityFallbackTimer.current);
497
+ opacityFallbackTimer.current = null;
498
+ }
499
+ }
500
+ const forcedContentHeight = hasFit ? void 0 : snapPointsMode === "percent" ? `${maxSnapPoint}${isWeb ? modal ? "dvh" : "%" : "%"}` : maxSnapPoint;
501
+ const setHasScrollView = React.useCallback(val => {
502
+ hasScrollView.current = val;
503
+ }, []);
504
+ let contents = /* @__PURE__ */jsx(LayoutMeasurementController, {
505
+ disable: !open,
506
+ children: /* @__PURE__ */jsx(ParentSheetContext.Provider, {
507
+ value: nextParentContext,
508
+ children: /* @__PURE__ */jsx(SheetProvider, {
509
+ ...providerProps,
510
+ keyboardOccludedHeight,
511
+ isKeyboardVisible,
512
+ keyboardStableFrameHeight,
513
+ isKeyboardSeeding: seedingKbBaseline,
514
+ setHasScrollView,
515
+ children: /* @__PURE__ */jsxs(GestureSheetProvider, {
516
+ isDragging,
517
+ blockPan,
518
+ setBlockPan,
519
+ panGesture,
520
+ panGestureRef,
521
+ children: [/* @__PURE__ */jsx(AnimatePresence, {
522
+ custom: {
523
+ open
524
+ },
525
+ children: shouldHideParentSheet || !open ? null : overlayComponent
526
+ }), snapPointsMode !== "percent" && /* @__PURE__ */jsx(View, {
527
+ style: {
528
+ opacity: 0,
529
+ position: "absolute",
530
+ top: 0,
531
+ left: 0,
532
+ right: 0,
533
+ bottom: 0,
534
+ pointerEvents: "none"
535
+ },
536
+ onLayout: handleMaxContentViewLayout
537
+ }), /* @__PURE__ */jsx(AnimatedView, {
538
+ ref,
539
+ onLayout: handleAnimationViewLayout,
540
+ transition: isDragging || disableAnimation ? null : transition,
541
+ disableClassName: true,
542
+ style: [{
543
+ position: "absolute",
544
+ zIndex,
545
+ width: "100%",
546
+ height: forcedContentHeight,
547
+ minHeight: forcedContentHeight,
548
+ opacity: !shouldHideParentSheet ? opacity : 0,
549
+ ...((shouldHideParentSheet || !open) && {
361
550
  pointerEvents: "none"
551
+ })
552
+ }, animatedStyle],
553
+ children: gestureHandlerEnabled && panGesture ? /* @__PURE__ */jsx(GestureDetectorWrapper, {
554
+ gesture: panGesture,
555
+ style: {
556
+ flex: 1
362
557
  },
363
- onLayout: handleMaxContentViewLayout
364
- }), /* @__PURE__ */jsx(AnimatedView, {
365
- ref,
366
- onLayout: handleAnimationViewLayout,
367
- transition: isDragging || disableAnimation ? null : transition,
368
- disableClassName: !0,
369
- style: [{
370
- position: "absolute",
371
- zIndex,
558
+ children: props.children
559
+ }) : /* @__PURE__ */jsx(View, {
560
+ ...panResponder?.panHandlers,
561
+ style: {
562
+ flex: 1,
372
563
  width: "100%",
373
- height: forcedContentHeight,
374
- minHeight: forcedContentHeight,
375
- opacity: shouldHideParentSheet ? 0 : opacity,
376
- ...((shouldHideParentSheet || !open) && {
377
- pointerEvents: "none"
378
- })
379
- }, animatedStyle],
380
- children: gestureHandlerEnabled && panGesture ? /* @__PURE__ */jsx(GestureDetectorWrapper, {
381
- gesture: panGesture,
382
- style: {
383
- flex: 1
384
- },
385
- children: props.children
386
- }) : /* @__PURE__ */jsx(View, {
387
- ...panResponder?.panHandlers,
388
- style: {
389
- flex: 1,
390
- width: "100%",
391
- height: "100%"
392
- },
393
- children: props.children
394
- })
395
- })]
396
- })
564
+ height: "100%"
565
+ },
566
+ children: props.children
567
+ })
568
+ })]
397
569
  })
398
570
  })
399
- });
400
- const shouldMountChildren = unmountChildrenWhenHidden ? !!opacity : !0;
401
- if (modal) {
402
- const modalContents = /* @__PURE__ */jsx(Portal, {
403
- stackZIndex: zIndex,
404
- ...portalProps,
405
- children: shouldMountChildren && /* @__PURE__ */jsx(ContainerComponent, {
406
- children: /* @__PURE__ */jsx(Theme, {
407
- contain: !0,
408
- forceClassName: !0,
409
- name: themeName,
410
- children: contents
411
- })
412
- })
413
- });
414
- return isWeb ? modalContents : /* @__PURE__ */jsx(SheetInsideSheetContext.Provider, {
415
- value: onInnerSheet,
416
- children: modalContents
417
- });
418
- }
419
- return contents;
571
+ })
420
572
  });
573
+ const shouldMountChildren = unmountChildrenWhenHidden ? !!opacity : true;
574
+ if (modal) {
575
+ const RNGHRoot = getGestureHandlerState().RootView;
576
+ const mountedContents = shouldMountChildren ? /* @__PURE__ */jsx(ContainerComponent, {
577
+ children: contents
578
+ }) : null;
579
+ const modalContents = /* @__PURE__ */jsx(Portal, {
580
+ stackZIndex: zIndex,
581
+ ...portalProps,
582
+ children: mountedContents && RNGHRoot ? /* @__PURE__ */jsx(RNGHRoot, {
583
+ style: open ? rnghRootStyleOpen : rnghRootStyleClosed,
584
+ children: mountedContents
585
+ }) : mountedContents
586
+ });
587
+ if (isWeb) return modalContents;
588
+ return /* @__PURE__ */jsx(SheetInsideSheetContext.Provider, {
589
+ value: onInnerSheet,
590
+ children: modalContents
591
+ });
592
+ }
593
+ return contents;
594
+ });
421
595
  function getYPositions(mode, point, screenSize, frameSize) {
422
596
  if (!screenSize || !frameSize) return 0;
423
597
  if (mode === "mixed") {
424
- if (typeof point == "number") return screenSize - Math.min(screenSize, Math.max(0, point));
598
+ if (typeof point === "number") return screenSize - Math.min(screenSize, Math.max(0, point));
425
599
  if (point === "fit") return screenSize - Math.min(screenSize, frameSize);
426
600
  if (point.endsWith("%")) {
427
601
  const pct2 = Math.min(100, Math.max(0, Number(point.slice(0, -1)))) / 100;
428
- return Number.isNaN(pct2) ? (console.warn("Invalid snapPoint percentage string"), 0) : Math.round(screenSize - pct2 * screenSize);
602
+ if (Number.isNaN(pct2)) {
603
+ console.warn("Invalid snapPoint percentage string");
604
+ return 0;
605
+ }
606
+ return Math.round(screenSize - pct2 * screenSize);
429
607
  }
430
- return console.warn("Invalid snapPoint unknown value"), 0;
608
+ console.warn("Invalid snapPoint unknown value");
609
+ return 0;
431
610
  }
432
- if (mode === "fit") return point === 0 ? screenSize : screenSize - Math.min(screenSize, frameSize);
433
- if (mode === "constant" && typeof point == "number") return screenSize - Math.min(screenSize, Math.max(0, point));
611
+ if (mode === "fit") {
612
+ if (point === 0) return screenSize;
613
+ return screenSize - Math.min(screenSize, frameSize);
614
+ }
615
+ if (mode === "constant" && typeof point === "number") return screenSize - Math.min(screenSize, Math.max(0, point));
434
616
  const pct = Math.min(100, Math.max(0, Number(point))) / 100;
435
- return Number.isNaN(pct) ? (console.warn("Invalid snapPoint percentage"), 0) : Math.round(screenSize - pct * screenSize);
617
+ if (Number.isNaN(pct)) {
618
+ console.warn("Invalid snapPoint percentage");
619
+ return 0;
620
+ }
621
+ return Math.round(screenSize - pct * screenSize);
436
622
  }
437
623
  export { SheetImplementationCustom };
438
624
  //# sourceMappingURL=SheetImplementationCustom.mjs.map