@tamagui/sheet 2.7.7 → 3.0.0-beta.1093.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/GestureSheetContext.cjs +28 -37
- package/dist/cjs/GestureSheetContext.native.cjs +48 -0
- package/dist/cjs/GestureSheetContext.native.js +29 -37
- package/dist/cjs/GestureSheetContext.native.js.map +1 -1
- package/dist/cjs/Sheet.cjs +220 -99
- package/dist/cjs/Sheet.native.cjs +245 -0
- package/dist/cjs/Sheet.native.js +223 -98
- package/dist/cjs/Sheet.native.js.map +1 -1
- package/dist/cjs/SheetContext.cjs +43 -22
- package/dist/cjs/SheetContext.native.cjs +57 -0
- package/dist/cjs/SheetContext.native.js +44 -22
- package/dist/cjs/SheetContext.native.js.map +1 -1
- package/dist/cjs/SheetController.cjs +49 -56
- package/dist/cjs/SheetController.native.cjs +71 -0
- package/dist/cjs/SheetController.native.js +52 -58
- package/dist/cjs/SheetController.native.js.map +1 -1
- package/dist/cjs/SheetDragSurface.cjs +50 -0
- package/dist/cjs/SheetDragSurface.native.cjs +61 -0
- package/dist/cjs/SheetDragSurface.native.js +63 -0
- package/dist/cjs/SheetDragSurface.native.js.map +1 -0
- package/dist/cjs/SheetImplementationCustom.cjs +664 -610
- package/dist/cjs/SheetImplementationCustom.native.cjs +748 -0
- package/dist/cjs/SheetImplementationCustom.native.js +704 -649
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +291 -312
- package/dist/cjs/SheetScrollView.native.cjs +326 -0
- package/dist/cjs/SheetScrollView.native.js +299 -319
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/constants.cjs +21 -21
- package/dist/cjs/constants.native.cjs +36 -0
- package/dist/cjs/constants.native.js +21 -20
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/contexts.cjs +19 -28
- package/dist/cjs/contexts.native.cjs +37 -0
- package/dist/cjs/contexts.native.js +19 -27
- package/dist/cjs/contexts.native.js.map +1 -1
- package/dist/cjs/controller.cjs +16 -18
- package/dist/cjs/controller.native.cjs +31 -0
- package/dist/cjs/controller.native.js +16 -17
- package/dist/cjs/controller.native.js.map +1 -1
- package/dist/cjs/gestureState.cjs +28 -30
- package/dist/cjs/gestureState.native.cjs +53 -0
- package/dist/cjs/gestureState.native.js +29 -30
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/helpers.cjs +20 -24
- package/dist/cjs/helpers.native.cjs +34 -0
- package/dist/cjs/helpers.native.js +21 -24
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/index.cjs +14 -21
- package/dist/cjs/index.native.cjs +36 -0
- package/dist/cjs/index.native.js +15 -21
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/keyboardAvoidance.cjs +55 -79
- package/dist/cjs/keyboardAvoidance.native.cjs +74 -0
- package/dist/cjs/keyboardAvoidance.native.js +55 -78
- package/dist/cjs/keyboardAvoidance.native.js.map +1 -1
- package/dist/cjs/nativeSheet.cjs +17 -86
- package/dist/cjs/nativeSheet.native.cjs +94 -0
- package/dist/cjs/nativeSheet.native.js +73 -86
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/stableViewportHeight.cjs +27 -0
- package/dist/cjs/stableViewportHeight.native.cjs +29 -0
- package/dist/cjs/stableViewportHeight.native.js +31 -0
- package/dist/cjs/stableViewportHeight.native.js.map +1 -0
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/types.native.js +9 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useGestureHandlerPan.cjs +244 -257
- package/dist/cjs/useGestureHandlerPan.native.cjs +272 -0
- package/dist/cjs/useGestureHandlerPan.native.js +253 -265
- package/dist/cjs/useGestureHandlerPan.native.js.map +1 -1
- package/dist/cjs/useKeyboardControllerSheet.cjs +82 -88
- package/dist/cjs/useKeyboardControllerSheet.native.cjs +92 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js +73 -111
- package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/cjs/useSafeAreaInsets.cjs +19 -26
- package/dist/cjs/useSafeAreaInsets.native.cjs +50 -0
- package/dist/cjs/useSafeAreaInsets.native.js +29 -25
- package/dist/cjs/useSafeAreaInsets.native.js.map +1 -1
- package/dist/cjs/useSheetController.cjs +26 -39
- package/dist/cjs/useSheetController.native.cjs +41 -0
- package/dist/cjs/useSheetController.native.js +27 -39
- package/dist/cjs/useSheetController.native.js.map +1 -1
- package/dist/cjs/useSheetOffscreenSize.cjs +43 -53
- package/dist/cjs/useSheetOffscreenSize.native.cjs +59 -0
- package/dist/cjs/useSheetOffscreenSize.native.js +47 -56
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/cjs/useSheetOpenState.cjs +68 -40
- package/dist/cjs/useSheetOpenState.native.cjs +87 -0
- package/dist/cjs/useSheetOpenState.native.js +73 -42
- package/dist/cjs/useSheetOpenState.native.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.cjs +145 -164
- package/dist/cjs/useSheetProviderProps.native.cjs +175 -0
- package/dist/cjs/useSheetProviderProps.native.js +155 -174
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetScrollViewGestures.cjs +171 -180
- package/dist/cjs/useSheetScrollViewGestures.native.cjs +149 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js +135 -147
- package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/cjs/webViewport.cjs +46 -48
- package/dist/cjs/webViewport.native.cjs +78 -0
- package/dist/cjs/webViewport.native.js +49 -50
- package/dist/cjs/webViewport.native.js.map +1 -1
- package/dist/esm/GestureSheetContext.mjs +15 -20
- package/dist/esm/GestureSheetContext.mjs.map +1 -1
- package/dist/esm/GestureSheetContext.native.js +17 -22
- package/dist/esm/GestureSheetContext.native.js.map +1 -1
- package/dist/esm/Sheet.mjs +207 -83
- package/dist/esm/Sheet.mjs.map +1 -1
- package/dist/esm/Sheet.native.js +210 -83
- package/dist/esm/Sheet.native.js.map +1 -1
- package/dist/esm/SheetContext.mjs +21 -5
- package/dist/esm/SheetContext.mjs.map +1 -1
- package/dist/esm/SheetContext.native.js +21 -5
- package/dist/esm/SheetContext.native.js.map +1 -1
- package/dist/esm/SheetController.mjs +34 -30
- package/dist/esm/SheetController.mjs.map +1 -1
- package/dist/esm/SheetController.native.js +38 -34
- package/dist/esm/SheetController.native.js.map +1 -1
- package/dist/esm/SheetDragSurface.mjs +25 -0
- package/dist/esm/SheetDragSurface.mjs.map +1 -0
- package/dist/esm/SheetDragSurface.native.js +34 -0
- package/dist/esm/SheetDragSurface.native.js.map +1 -0
- package/dist/esm/SheetImplementationCustom.mjs +647 -586
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +684 -618
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +278 -288
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +287 -297
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/constants.mjs +5 -3
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +5 -3
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/contexts.mjs +3 -3
- package/dist/esm/contexts.mjs.map +1 -1
- package/dist/esm/contexts.native.js +3 -3
- package/dist/esm/contexts.native.js.map +1 -1
- package/dist/esm/controller.mjs +2 -2
- package/dist/esm/controller.native.js +2 -2
- package/dist/esm/gestureState.mjs +13 -11
- package/dist/esm/gestureState.mjs.map +1 -1
- package/dist/esm/gestureState.native.js +14 -12
- package/dist/esm/gestureState.native.js.map +1 -1
- package/dist/esm/helpers.mjs +7 -6
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/helpers.native.js +8 -7
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.js +21 -14
- package/dist/esm/index.mjs +21 -14
- package/dist/esm/index.native.js +21 -14
- package/dist/esm/keyboardAvoidance.mjs +40 -61
- package/dist/esm/keyboardAvoidance.mjs.map +1 -1
- package/dist/esm/keyboardAvoidance.native.js +40 -61
- package/dist/esm/keyboardAvoidance.native.js.map +1 -1
- package/dist/esm/nativeSheet.mjs +4 -70
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +60 -70
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/stableViewportHeight.mjs +8 -0
- package/dist/esm/stableViewportHeight.mjs.map +1 -0
- package/dist/esm/stableViewportHeight.native.js +8 -0
- package/dist/esm/stableViewportHeight.native.js.map +1 -0
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/useGestureHandlerPan.mjs +232 -239
- package/dist/esm/useGestureHandlerPan.mjs.map +1 -1
- package/dist/esm/useGestureHandlerPan.native.js +241 -248
- package/dist/esm/useGestureHandlerPan.native.js.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.mjs +71 -71
- package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.native.js +66 -94
- package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/esm/useSafeAreaInsets.mjs +3 -1
- package/dist/esm/useSafeAreaInsets.mjs.map +1 -1
- package/dist/esm/useSafeAreaInsets.native.js +15 -3
- package/dist/esm/useSafeAreaInsets.native.js.map +1 -1
- package/dist/esm/useSheetController.mjs +14 -12
- package/dist/esm/useSheetController.mjs.map +1 -1
- package/dist/esm/useSheetController.native.js +14 -12
- package/dist/esm/useSheetController.native.js.map +1 -1
- package/dist/esm/useSheetOffscreenSize.mjs +30 -35
- package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/esm/useSheetOffscreenSize.native.js +34 -39
- package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/esm/useSheetOpenState.mjs +50 -22
- package/dist/esm/useSheetOpenState.mjs.map +1 -1
- package/dist/esm/useSheetOpenState.native.js +55 -25
- package/dist/esm/useSheetOpenState.native.js.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs +130 -138
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js +140 -149
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.mjs +159 -162
- package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.native.js +123 -130
- package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/esm/webViewport.mjs +26 -25
- package/dist/esm/webViewport.mjs.map +1 -1
- package/dist/esm/webViewport.native.js +29 -28
- package/dist/esm/webViewport.native.js.map +1 -1
- package/dist/jsx/GestureSheetContext.mjs +15 -20
- package/dist/jsx/GestureSheetContext.mjs.map +1 -1
- package/dist/jsx/GestureSheetContext.native.cjs +48 -0
- package/dist/jsx/GestureSheetContext.native.js +29 -37
- package/dist/jsx/GestureSheetContext.native.js.map +1 -1
- package/dist/jsx/Sheet.mjs +207 -83
- package/dist/jsx/Sheet.mjs.map +1 -1
- package/dist/jsx/Sheet.native.cjs +245 -0
- package/dist/jsx/Sheet.native.js +223 -98
- package/dist/jsx/Sheet.native.js.map +1 -1
- package/dist/jsx/SheetContext.mjs +21 -5
- package/dist/jsx/SheetContext.mjs.map +1 -1
- package/dist/jsx/SheetContext.native.cjs +57 -0
- package/dist/jsx/SheetContext.native.js +44 -22
- package/dist/jsx/SheetContext.native.js.map +1 -1
- package/dist/jsx/SheetController.mjs +34 -30
- package/dist/jsx/SheetController.mjs.map +1 -1
- package/dist/jsx/SheetController.native.cjs +71 -0
- package/dist/jsx/SheetController.native.js +52 -58
- package/dist/jsx/SheetController.native.js.map +1 -1
- package/dist/jsx/SheetDragSurface.mjs +25 -0
- package/dist/jsx/SheetDragSurface.mjs.map +1 -0
- package/dist/jsx/SheetDragSurface.native.cjs +61 -0
- package/dist/jsx/SheetDragSurface.native.js +63 -0
- package/dist/jsx/SheetDragSurface.native.js.map +1 -0
- package/dist/jsx/SheetImplementationCustom.mjs +647 -586
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.cjs +748 -0
- package/dist/jsx/SheetImplementationCustom.native.js +704 -649
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +278 -288
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.cjs +326 -0
- package/dist/jsx/SheetScrollView.native.js +299 -319
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/constants.mjs +5 -3
- package/dist/jsx/constants.mjs.map +1 -1
- package/dist/jsx/constants.native.cjs +36 -0
- package/dist/jsx/constants.native.js +21 -20
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/contexts.mjs +3 -3
- package/dist/jsx/contexts.mjs.map +1 -1
- package/dist/jsx/contexts.native.cjs +37 -0
- package/dist/jsx/contexts.native.js +19 -27
- package/dist/jsx/contexts.native.js.map +1 -1
- package/dist/jsx/controller.mjs +2 -2
- package/dist/jsx/controller.native.cjs +31 -0
- package/dist/jsx/controller.native.js +16 -17
- package/dist/jsx/controller.native.js.map +1 -1
- package/dist/jsx/gestureState.mjs +13 -11
- package/dist/jsx/gestureState.mjs.map +1 -1
- package/dist/jsx/gestureState.native.cjs +53 -0
- package/dist/jsx/gestureState.native.js +29 -30
- package/dist/jsx/gestureState.native.js.map +1 -1
- package/dist/jsx/helpers.mjs +7 -6
- package/dist/jsx/helpers.mjs.map +1 -1
- package/dist/jsx/helpers.native.cjs +34 -0
- package/dist/jsx/helpers.native.js +21 -24
- package/dist/jsx/helpers.native.js.map +1 -1
- package/dist/jsx/index.js +21 -14
- package/dist/jsx/index.mjs +21 -14
- package/dist/jsx/index.native.cjs +36 -0
- package/dist/jsx/index.native.js +15 -21
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/keyboardAvoidance.mjs +40 -61
- package/dist/jsx/keyboardAvoidance.mjs.map +1 -1
- package/dist/jsx/keyboardAvoidance.native.cjs +74 -0
- package/dist/jsx/keyboardAvoidance.native.js +55 -78
- package/dist/jsx/keyboardAvoidance.native.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +4 -70
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.cjs +94 -0
- package/dist/jsx/nativeSheet.native.js +73 -86
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/stableViewportHeight.mjs +8 -0
- package/dist/jsx/stableViewportHeight.mjs.map +1 -0
- package/dist/jsx/stableViewportHeight.native.cjs +29 -0
- package/dist/jsx/stableViewportHeight.native.js +31 -0
- package/dist/jsx/stableViewportHeight.native.js.map +1 -0
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +18 -0
- package/dist/jsx/types.native.js +9 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/dist/jsx/useGestureHandlerPan.mjs +232 -239
- package/dist/jsx/useGestureHandlerPan.mjs.map +1 -1
- package/dist/jsx/useGestureHandlerPan.native.cjs +272 -0
- package/dist/jsx/useGestureHandlerPan.native.js +253 -265
- package/dist/jsx/useGestureHandlerPan.native.js.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.mjs +71 -71
- package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.native.cjs +92 -0
- package/dist/jsx/useKeyboardControllerSheet.native.js +73 -111
- package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/jsx/useSafeAreaInsets.mjs +3 -1
- package/dist/jsx/useSafeAreaInsets.mjs.map +1 -1
- package/dist/jsx/useSafeAreaInsets.native.cjs +50 -0
- package/dist/jsx/useSafeAreaInsets.native.js +29 -25
- package/dist/jsx/useSafeAreaInsets.native.js.map +1 -1
- package/dist/jsx/useSheetController.mjs +14 -12
- package/dist/jsx/useSheetController.mjs.map +1 -1
- package/dist/jsx/useSheetController.native.cjs +41 -0
- package/dist/jsx/useSheetController.native.js +27 -39
- package/dist/jsx/useSheetController.native.js.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.mjs +30 -35
- package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.native.cjs +59 -0
- package/dist/jsx/useSheetOffscreenSize.native.js +47 -56
- package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/jsx/useSheetOpenState.mjs +50 -22
- package/dist/jsx/useSheetOpenState.mjs.map +1 -1
- package/dist/jsx/useSheetOpenState.native.cjs +87 -0
- package/dist/jsx/useSheetOpenState.native.js +73 -42
- package/dist/jsx/useSheetOpenState.native.js.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs +130 -138
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.cjs +175 -0
- package/dist/jsx/useSheetProviderProps.native.js +155 -174
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.mjs +159 -162
- package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.native.cjs +149 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js +135 -147
- package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/jsx/webViewport.mjs +26 -25
- package/dist/jsx/webViewport.mjs.map +1 -1
- package/dist/jsx/webViewport.native.cjs +78 -0
- package/dist/jsx/webViewport.native.js +49 -50
- package/dist/jsx/webViewport.native.js.map +1 -1
- package/package.json +38 -40
- package/src/Sheet.tsx +314 -77
- package/src/SheetContext.tsx +57 -7
- package/src/SheetController.tsx +7 -6
- package/src/SheetDragSurface.native.tsx +42 -0
- package/src/SheetDragSurface.tsx +40 -0
- package/src/SheetImplementationCustom.tsx +364 -181
- package/src/SheetScrollView.tsx +36 -20
- package/src/constants.tsx +3 -3
- package/src/helpers.tsx +0 -14
- package/src/index.ts +3 -6
- package/src/{nativeSheet.tsx → nativeSheet.native.tsx} +9 -20
- package/src/nativeSheet.ts +19 -0
- package/src/stableViewportHeight.native.ts +9 -0
- package/src/stableViewportHeight.ts +15 -0
- package/src/types.tsx +122 -92
- package/src/useKeyboardControllerSheet.native.ts +10 -39
- package/src/useSafeAreaInsets.native.ts +20 -13
- package/src/useSheetController.tsx +15 -7
- package/src/useSheetOpenState.tsx +50 -4
- package/src/useSheetProviderProps.tsx +4 -27
- package/src/useSheetScrollViewGestures.ts +2 -2
- package/types/GestureSheetContext.d.ts +1 -1
- package/types/GestureSheetContext.d.ts.map +1 -1
- package/types/Sheet.d.ts +247 -151
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetContext.d.ts +28 -42
- package/types/SheetContext.d.ts.map +1 -1
- package/types/SheetController.d.ts +4 -2
- package/types/SheetController.d.ts.map +1 -1
- package/types/SheetDragSurface.d.ts +11 -0
- package/types/SheetDragSurface.d.ts.map +1 -0
- package/types/SheetDragSurface.native.d.ts +11 -0
- package/types/SheetDragSurface.native.d.ts.map +1 -0
- package/types/SheetImplementationCustom.d.ts +4 -36
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +21 -38
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/constants.d.ts +3 -2
- package/types/constants.d.ts.map +1 -1
- package/types/index.d.ts +1 -3
- package/types/index.d.ts.map +1 -1
- package/types/nativeSheet.d.ts +8 -8
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/nativeSheet.native.d.ts +5 -0
- package/types/nativeSheet.native.d.ts.map +1 -0
- package/types/stableViewportHeight.d.ts +12 -0
- package/types/stableViewportHeight.d.ts.map +1 -0
- package/types/stableViewportHeight.native.d.ts +6 -0
- package/types/stableViewportHeight.native.d.ts.map +1 -0
- package/types/types.d.ts +43 -17
- package/types/types.d.ts.map +1 -1
- package/types/useKeyboardControllerSheet.native.d.ts +6 -6
- package/types/useKeyboardControllerSheet.native.d.ts.map +1 -1
- package/types/useSafeAreaInsets.native.d.ts +4 -12
- package/types/useSafeAreaInsets.native.d.ts.map +1 -1
- package/types/useSheetController.d.ts +6 -6
- package/types/useSheetController.d.ts.map +1 -1
- package/types/useSheetOffscreenSize.d.ts.map +1 -1
- package/types/useSheetOpenState.d.ts +3 -2
- package/types/useSheetOpenState.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +5 -8
- package/types/useSheetProviderProps.d.ts.map +1 -1
- package/types/useSheetScrollViewGestures.d.ts +2 -2
- package/types/useSheetScrollViewGestures.d.ts.map +1 -1
- package/.turbo/turbo-build.log +0 -2
- package/controller/index.cjs +0 -2
- package/controller/index.d.ts +0 -5
- package/controller/index.js +0 -2
- package/controller/index.native.cjs +0 -2
- package/controller/index.native.js +0 -2
- package/dist/cjs/GestureDetectorWrapper.cjs +0 -54
- package/dist/cjs/GestureDetectorWrapper.native.js +0 -58
- package/dist/cjs/GestureDetectorWrapper.native.js.map +0 -1
- package/dist/cjs/createSheet.cjs +0 -194
- package/dist/cjs/createSheet.native.js +0 -204
- package/dist/cjs/createSheet.native.js.map +0 -1
- package/dist/cjs/setupGestureHandler.cjs +0 -55
- package/dist/cjs/setupGestureHandler.native.js +0 -60
- package/dist/cjs/setupGestureHandler.native.js.map +0 -1
- package/dist/cjs/useSheet.cjs +0 -29
- package/dist/cjs/useSheet.native.js +0 -34
- package/dist/cjs/useSheet.native.js.map +0 -1
- package/dist/esm/GestureDetectorWrapper.mjs +0 -29
- package/dist/esm/GestureDetectorWrapper.mjs.map +0 -1
- package/dist/esm/GestureDetectorWrapper.native.js +0 -30
- package/dist/esm/GestureDetectorWrapper.native.js.map +0 -1
- package/dist/esm/controller.mjs.map +0 -1
- package/dist/esm/controller.native.js.map +0 -1
- package/dist/esm/createSheet.mjs +0 -168
- package/dist/esm/createSheet.mjs.map +0 -1
- package/dist/esm/createSheet.native.js +0 -176
- package/dist/esm/createSheet.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/setupGestureHandler.mjs +0 -29
- package/dist/esm/setupGestureHandler.mjs.map +0 -1
- package/dist/esm/setupGestureHandler.native.js +0 -31
- package/dist/esm/setupGestureHandler.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/useSheet.mjs +0 -4
- package/dist/esm/useSheet.mjs.map +0 -1
- package/dist/esm/useSheet.native.js +0 -6
- package/dist/esm/useSheet.native.js.map +0 -1
- package/dist/jsx/GestureDetectorWrapper.mjs +0 -29
- package/dist/jsx/GestureDetectorWrapper.mjs.map +0 -1
- package/dist/jsx/GestureDetectorWrapper.native.js +0 -58
- package/dist/jsx/GestureDetectorWrapper.native.js.map +0 -1
- package/dist/jsx/controller.mjs.map +0 -1
- package/dist/jsx/createSheet.mjs +0 -168
- package/dist/jsx/createSheet.mjs.map +0 -1
- package/dist/jsx/createSheet.native.js +0 -204
- package/dist/jsx/createSheet.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/setupGestureHandler.mjs +0 -29
- package/dist/jsx/setupGestureHandler.mjs.map +0 -1
- package/dist/jsx/setupGestureHandler.native.js +0 -60
- package/dist/jsx/setupGestureHandler.native.js.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/useSheet.mjs +0 -4
- package/dist/jsx/useSheet.mjs.map +0 -1
- package/dist/jsx/useSheet.native.js +0 -34
- package/dist/jsx/useSheet.native.js.map +0 -1
- package/next.md +0 -78
- package/setup-gesture-handler/index.cjs +0 -2
- package/setup-gesture-handler/index.js +0 -2
- package/setup-gesture-handler/index.native.cjs +0 -2
- package/setup-gesture-handler/index.native.js +0 -2
- package/setup-gesture-handler.cjs +0 -1
- package/src/GestureDetectorWrapper.tsx +0 -38
- package/src/createSheet.tsx +0 -309
- package/src/setupGestureHandler.ts +0 -43
- package/src/useSheet.tsx +0 -3
- package/test/keyboardAvoidance.test.ts +0 -269
- package/tsconfig.json +0 -57
- package/types/GestureDetectorWrapper.d.ts +0 -14
- package/types/GestureDetectorWrapper.d.ts.map +0 -1
- package/types/createSheet.d.ts +0 -195
- package/types/createSheet.d.ts.map +0 -1
- package/types/setupGestureHandler.d.ts +0 -11
- package/types/setupGestureHandler.d.ts.map +0 -1
- package/types/useSheet.d.ts +0 -2
- package/types/useSheet.d.ts.map +0 -1
package/src/SheetScrollView.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { composeRefs } from '@tamagui/compose-refs'
|
|
2
|
-
import { isWeb, View, type
|
|
3
|
-
import type {
|
|
2
|
+
import { createStyledHOC, isWeb, style, View, type GetProps } from '@tamagui/core'
|
|
3
|
+
import type { ScrollViewRef } from '@tamagui/scroll-view'
|
|
4
4
|
import { ScrollView } from '@tamagui/scroll-view'
|
|
5
5
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
6
6
|
import React, { useEffect, useRef, useState } from 'react'
|
|
7
|
-
import type { ScrollView as RNScrollView } from 'react-native'
|
|
8
7
|
import { useGestureSheetContext } from './GestureSheetContext'
|
|
9
8
|
import { getGestureHandlerState, isGestureHandlerEnabled } from './gestureState'
|
|
10
9
|
import { useSheetContext } from './SheetContext'
|
|
@@ -19,22 +18,32 @@ import {
|
|
|
19
18
|
} from './webViewport'
|
|
20
19
|
|
|
21
20
|
const SHEET_SCROLL_VIEW_NAME = 'SheetScrollView'
|
|
21
|
+
const sheetContentStyle = style({ minHeight: '100%' })
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
type SheetScrollViewBaseProps = GetProps<typeof ScrollView>
|
|
24
|
+
|
|
25
|
+
type SheetScrollViewProps = SheetScopedProps<
|
|
26
|
+
SheetScrollViewBaseProps & {
|
|
27
|
+
h?: SheetScrollViewBaseProps['height']
|
|
28
|
+
o?: SheetScrollViewBaseProps['opacity']
|
|
29
|
+
pos?: SheetScrollViewBaseProps['position']
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
|
|
33
|
+
export const SheetScrollView = createStyledHOC(
|
|
34
|
+
ScrollView,
|
|
27
35
|
(
|
|
28
36
|
{
|
|
29
|
-
|
|
37
|
+
scope,
|
|
30
38
|
children,
|
|
31
39
|
onScroll,
|
|
32
40
|
scrollEnabled: scrollEnabledProp,
|
|
41
|
+
style,
|
|
33
42
|
...props
|
|
34
|
-
}:
|
|
43
|
+
}: SheetScrollViewProps,
|
|
35
44
|
ref
|
|
36
45
|
) => {
|
|
37
|
-
const context = useSheetContext(
|
|
46
|
+
const context = useSheetContext(scope)
|
|
38
47
|
const gestureContext = useGestureSheetContext()
|
|
39
48
|
const { scrollBridge, setHasScrollView, hasFit, screenSize } = context
|
|
40
49
|
const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0)
|
|
@@ -50,7 +59,7 @@ export const SheetScrollView = React.forwardRef<
|
|
|
50
59
|
prop: scrollEnabledProp,
|
|
51
60
|
defaultProp: true,
|
|
52
61
|
})
|
|
53
|
-
const scrollRef = React.useRef<
|
|
62
|
+
const scrollRef = React.useRef<ScrollViewRef | null>(null)
|
|
54
63
|
|
|
55
64
|
const [hasScrollableContent, setHasScrollableContent] = useState(true)
|
|
56
65
|
const parentHeight = useRef(0)
|
|
@@ -61,29 +70,33 @@ export const SheetScrollView = React.forwardRef<
|
|
|
61
70
|
// closed), so the height now comes from the sheet, which doesn't remount.
|
|
62
71
|
const frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0)
|
|
63
72
|
|
|
64
|
-
// with snapPointsMode="fit",
|
|
65
|
-
// a flex: 1 child can't grow inside a content-sized parent, so the ScrollView (and the
|
|
73
|
+
// with snapPointsMode="fit", Container is content-sized (flex: 0, flex-basis: auto, height: undefined).
|
|
74
|
+
// a flex: 1 child can't grow inside a content-sized parent, so the ScrollView (and the Container
|
|
66
75
|
// around it) collapse to 0 height. instead, let the ScrollView size to its content and cap it
|
|
67
76
|
// at the available viewport (screenSize / maxContentSize) so scrolling kicks in for tall content.
|
|
68
|
-
const
|
|
77
|
+
const fitSizingProps = hasFit
|
|
69
78
|
? {
|
|
70
79
|
flex: undefined as undefined,
|
|
71
80
|
height: undefined as undefined,
|
|
72
81
|
maxHeight: screenSize || undefined,
|
|
73
82
|
}
|
|
74
83
|
: { flex: 1 }
|
|
75
|
-
const contentContainerStyle = hasFit ? undefined :
|
|
84
|
+
const contentContainerStyle = hasFit ? undefined : sheetContentStyle
|
|
76
85
|
|
|
77
86
|
// when the keyboard is open, pin the scroll view to the sheet's pre-keyboard
|
|
78
87
|
// frame height (frozenFrameHeight), overriding any consumer maxHeight. on web
|
|
79
88
|
// that maxHeight is often tied to useWindowDimensions, which SHRINKS when the
|
|
80
89
|
// keyboard opens and would otherwise collapse the sheet. holding the height
|
|
81
90
|
// constant means the web frame can translate without resizing. applied
|
|
82
|
-
//
|
|
91
|
+
// last in the ordered style array so it wins.
|
|
83
92
|
const keyboardFrozenOverride =
|
|
84
93
|
hasFit && isKeyboardVisible && frozenFrameHeight > 0
|
|
85
94
|
? { height: frozenFrameHeight, maxHeight: frozenFrameHeight }
|
|
86
95
|
: null
|
|
96
|
+
const scrollViewStyle = [
|
|
97
|
+
...(Array.isArray(style) ? style : [style]),
|
|
98
|
+
keyboardFrozenOverride,
|
|
99
|
+
]
|
|
87
100
|
|
|
88
101
|
const panGestureRef = gestureContext?.panGestureRef
|
|
89
102
|
const { ScrollView: RNGHScrollView } = getGestureHandlerState()
|
|
@@ -281,7 +294,7 @@ export const SheetScrollView = React.forwardRef<
|
|
|
281
294
|
return (
|
|
282
295
|
<RNGHComponent
|
|
283
296
|
ref={composeRefs(scrollRef as any, ref)}
|
|
284
|
-
style={
|
|
297
|
+
style={[fitSizingProps, ...scrollViewStyle]}
|
|
285
298
|
scrollEventThrottle={1}
|
|
286
299
|
scrollEnabled={scrollEnabled}
|
|
287
300
|
simultaneousHandlers={[panGestureRef]}
|
|
@@ -329,7 +342,6 @@ export const SheetScrollView = React.forwardRef<
|
|
|
329
342
|
keyboardShouldPersistTaps="always"
|
|
330
343
|
keyboardDismissMode="none"
|
|
331
344
|
{...props}
|
|
332
|
-
{...keyboardFrozenOverride}
|
|
333
345
|
>
|
|
334
346
|
{contentWrapper}
|
|
335
347
|
</RNGHComponent>
|
|
@@ -339,12 +351,12 @@ export const SheetScrollView = React.forwardRef<
|
|
|
339
351
|
// fallback ScrollView with platform-specific gesture props
|
|
340
352
|
return (
|
|
341
353
|
<ScrollView
|
|
354
|
+
{...fitSizingProps}
|
|
342
355
|
onLayout={(e) => {
|
|
343
356
|
recordFitHeight(Math.ceil(e.nativeEvent.layout.height))
|
|
344
357
|
updateScrollable()
|
|
345
358
|
}}
|
|
346
359
|
ref={composeRefs(scrollRef as any, ref)}
|
|
347
|
-
{...fitSizingStyle}
|
|
348
360
|
scrollEventThrottle={1}
|
|
349
361
|
className="_ovs-contain"
|
|
350
362
|
scrollEnabled={scrollEnabled}
|
|
@@ -359,10 +371,14 @@ export const SheetScrollView = React.forwardRef<
|
|
|
359
371
|
contentContainerStyle={contentContainerStyle}
|
|
360
372
|
{...gestureProps}
|
|
361
373
|
{...props}
|
|
362
|
-
{
|
|
374
|
+
style={scrollViewStyle}
|
|
363
375
|
>
|
|
364
376
|
{contentWrapper}
|
|
365
377
|
</ScrollView>
|
|
366
378
|
)
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
disableTheme: true,
|
|
382
|
+
displayName: SHEET_SCROLL_VIEW_NAME,
|
|
367
383
|
}
|
|
368
384
|
)
|
package/src/constants.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
export const SHEET_NAME = 'Sheet'
|
|
1
|
+
export const SHEET_CONTAINER_NAME = 'SheetContainer'
|
|
2
|
+
export const SHEET_BACKGROUND_NAME = 'SheetBackground'
|
|
4
3
|
export const SHEET_HANDLE_NAME = 'SheetHandle'
|
|
5
4
|
export const SHEET_OVERLAY_NAME = 'SheetOverlay'
|
|
5
|
+
export const SHEET_OVERLAY_MARKER = Symbol('SheetOverlay')
|
package/src/helpers.tsx
CHANGED
|
@@ -15,17 +15,3 @@ export function resisted(y: number, minY: number, maxOverflow = 25) {
|
|
|
15
15
|
// Return the position with resistance applied
|
|
16
16
|
return minY - resistedDistance
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
// // set all the way off screen
|
|
20
|
-
// // + 0.1 ensures this is unique - see hasntMeasured ref
|
|
21
|
-
|
|
22
|
-
// let hiddenSize: number
|
|
23
|
-
|
|
24
|
-
// export function getHiddenSize() {
|
|
25
|
-
// if (hiddenSize == undefined) {
|
|
26
|
-
// // this trigger reflow on web avoid doing on startup
|
|
27
|
-
// const screen = Dimensions.get('screen')
|
|
28
|
-
// hiddenSize = Math.max(screen.height, screen.width) + 0.1
|
|
29
|
-
// }
|
|
30
|
-
// return hiddenSize
|
|
31
|
-
// }
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './Sheet'
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// public so copied skins can forward the open state into their own styled parts
|
|
3
|
+
// (e.g. the Handle's open-driven opacity variant).
|
|
4
|
+
export { useSheetContext } from './SheetContext'
|
|
4
5
|
export * from './SheetController'
|
|
5
6
|
export * from './useSheetController'
|
|
6
7
|
export * from './useSheetOpenState'
|
|
@@ -9,7 +10,3 @@ export * from './SheetScrollView'
|
|
|
9
10
|
export * from './nativeSheet'
|
|
10
11
|
export * from './types'
|
|
11
12
|
export * from './contexts'
|
|
12
|
-
export {
|
|
13
|
-
getGestureHandlerState as unstable_getSheetGestureHandlerState,
|
|
14
|
-
isGestureHandlerEnabled as unstable_isSheetGestureHandlerEnabled,
|
|
15
|
-
} from './gestureState'
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { YStack } from '@tamagui/stacks'
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
3
|
import { useEffect, useRef } from 'react'
|
|
4
|
-
import { View } from 'react-native'
|
|
5
|
-
import { SheetProvider } from './SheetContext'
|
|
6
|
-
import type { SheetProps } from './types'
|
|
4
|
+
import { Platform, View } from 'react-native'
|
|
5
|
+
import { SheetNativeSystemContext, SheetProvider } from './SheetContext'
|
|
6
|
+
import type { SheetNativeModal, SheetNativePlatforms, SheetProps } from './types'
|
|
7
7
|
import { useSheetOpenState } from './useSheetOpenState'
|
|
8
8
|
import { useSheetProviderProps } from './useSheetProviderProps'
|
|
9
9
|
|
|
10
|
-
// import { useSheetSnapPoints } from './useSheetSnapPoints'
|
|
11
|
-
|
|
12
|
-
type SheetNativePlatforms = 'ios'
|
|
13
|
-
|
|
14
10
|
const nativeSheets: Record<SheetNativePlatforms, FunctionComponent<SheetProps> | null> = {
|
|
15
11
|
ios: null,
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
export function getNativeSheet(platform: SheetNativePlatforms) {
|
|
15
|
+
if (Platform.OS !== platform) return null
|
|
19
16
|
return nativeSheets[platform]
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
export function setupNativeSheet(
|
|
23
20
|
platform: SheetNativePlatforms,
|
|
24
|
-
RNIOSModal:
|
|
21
|
+
RNIOSModal: SheetNativeModal
|
|
25
22
|
) {
|
|
26
23
|
const { ModalSheetView, ModalSheetViewMainContent } = RNIOSModal
|
|
27
24
|
|
|
@@ -29,8 +26,6 @@ export function setupNativeSheet(
|
|
|
29
26
|
nativeSheets[platform] = (props: SheetProps) => {
|
|
30
27
|
const state = useSheetOpenState(props)
|
|
31
28
|
const providerProps = useSheetProviderProps(props, state)
|
|
32
|
-
// const { position } = providerProps
|
|
33
|
-
// const { positions } = useSheetSnapPoints(providerProps)
|
|
34
29
|
|
|
35
30
|
const { open, setOpen } = state
|
|
36
31
|
const ref = useRef<{
|
|
@@ -51,21 +46,15 @@ export function setupNativeSheet(
|
|
|
51
46
|
setOpen(next)
|
|
52
47
|
}
|
|
53
48
|
|
|
54
|
-
// modalContentPreferredContentSize={{
|
|
55
|
-
// mode: 'percent',
|
|
56
|
-
// percentWidth: '100%',
|
|
57
|
-
// percentHeight:
|
|
58
|
-
// }}
|
|
59
|
-
|
|
60
49
|
return (
|
|
61
|
-
|
|
50
|
+
<SheetNativeSystemContext.Provider value>
|
|
62
51
|
<SheetProvider
|
|
63
52
|
setHasScrollView={emptyFn}
|
|
64
53
|
keyboardOccludedHeight={0}
|
|
65
54
|
isKeyboardVisible={false}
|
|
66
55
|
keyboardStableFrameHeight={0}
|
|
67
56
|
{...providerProps}
|
|
68
|
-
|
|
57
|
+
onlyShowContainer
|
|
69
58
|
>
|
|
70
59
|
<ModalSheetView ref={ref} onModalDidDismiss={() => setOpenInternal(false)}>
|
|
71
60
|
<ModalSheetViewMainContent>
|
|
@@ -77,7 +66,7 @@ export function setupNativeSheet(
|
|
|
77
66
|
{/* so just hiding it here for now... not great... */}
|
|
78
67
|
<YStack
|
|
79
68
|
position="absolute"
|
|
80
|
-
|
|
69
|
+
display="none"
|
|
81
70
|
pointerEvents="none"
|
|
82
71
|
width={0}
|
|
83
72
|
height={0}
|
|
@@ -85,7 +74,7 @@ export function setupNativeSheet(
|
|
|
85
74
|
{props.children}
|
|
86
75
|
</YStack>
|
|
87
76
|
</SheetProvider>
|
|
88
|
-
|
|
77
|
+
</SheetNativeSystemContext.Provider>
|
|
89
78
|
)
|
|
90
79
|
}
|
|
91
80
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { SheetNativeModal, SheetNativePlatforms, SheetProps } from './types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `native` asks for the platform's own sheet, which is a UIKit modal, so there
|
|
7
|
+
* is nothing to register or hand back on web and the sheet always falls through
|
|
8
|
+
* to its own implementation. The native sibling holds the real registry.
|
|
9
|
+
*/
|
|
10
|
+
export function getNativeSheet(
|
|
11
|
+
_platform: SheetNativePlatforms
|
|
12
|
+
): FunctionComponent<SheetProps> | null {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function setupNativeSheet(
|
|
17
|
+
_platform: SheetNativePlatforms,
|
|
18
|
+
_RNIOSModal: SheetNativeModal
|
|
19
|
+
) {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dimensions } from 'react-native'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Height of the viewport the sheet positions against. Native measures against
|
|
5
|
+
* the screen rather than the window, so it does not move with the keyboard.
|
|
6
|
+
*/
|
|
7
|
+
export function getStableViewportHeight(): number {
|
|
8
|
+
return Dimensions.get('screen').height
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getStableLayoutViewportHeight } from './webViewport'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Height of the viewport the sheet positions against.
|
|
5
|
+
*
|
|
6
|
+
* This MUST be the stable layout viewport: the visual viewport shrinks by the
|
|
7
|
+
* soft keyboard, and capping frameSize / maxContentSize against a shrinking
|
|
8
|
+
* value corrupts the fit-mode math (translateY = screenSize - frameSize),
|
|
9
|
+
* detaching the sheet's bottom from the screen edge when the keyboard opens.
|
|
10
|
+
* NOTE: window.innerHeight is NOT stable on real iOS Safari (it shrinks with
|
|
11
|
+
* the keyboard too), hence the self-correcting baseline in webViewport.
|
|
12
|
+
*/
|
|
13
|
+
export function getStableViewportHeight(): number {
|
|
14
|
+
return getStableLayoutViewportHeight()
|
|
15
|
+
}
|
package/src/types.tsx
CHANGED
|
@@ -1,99 +1,114 @@
|
|
|
1
1
|
import type { AnimatedNumberStrategy, TransitionProp } from '@tamagui/core'
|
|
2
|
-
import type { ScopedProps } from '@tamagui/create-context'
|
|
3
2
|
import type { PortalProps } from '@tamagui/portal'
|
|
3
|
+
import type { PanResponderConfig } from '@tamagui/react-native-pan-responder'
|
|
4
4
|
import type { RemoveScroll } from '@tamagui/remove-scroll'
|
|
5
5
|
import type { ReactNode } from 'react'
|
|
6
6
|
import type React from 'react'
|
|
7
7
|
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
8
|
+
export type SheetScopes = string
|
|
9
|
+
|
|
10
|
+
export type SheetScopedProps<P> = Omit<P, 'scope'> & {
|
|
11
|
+
scope?: SheetScopes
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SheetProps = SheetScopedProps<{
|
|
15
|
+
open?: boolean
|
|
16
|
+
defaultOpen?: boolean
|
|
17
|
+
onOpenChange?: OpenChangeHandler
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Control the index of the position in the `snapPoints` array
|
|
21
|
+
*/
|
|
22
|
+
position?: number
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Initial position from the `snapPoints` array
|
|
26
|
+
*/
|
|
27
|
+
defaultPosition?: number
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Array of pixels or percents the Sheet will attempt to move to when dragged.
|
|
31
|
+
* The first is the topmost and default when first opened via open prop.
|
|
32
|
+
*/
|
|
33
|
+
snapPoints?: (string | number)[]
|
|
34
|
+
|
|
35
|
+
snapPointsMode?: SnapPointsMode
|
|
36
|
+
onPositionChange?: PositionChangeHandler
|
|
37
|
+
children?: ReactNode
|
|
38
|
+
dismissOnOverlayPress?: boolean
|
|
39
|
+
dismissOnSnapToBottom?: boolean
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Disables the RemoveScroll behavior that prevents body scrolling while sheet is open.
|
|
43
|
+
* By default, RemoveScroll is enabled when the sheet is open and modal.
|
|
44
|
+
*/
|
|
45
|
+
disableRemoveScroll?: boolean
|
|
46
|
+
|
|
47
|
+
transitionConfig?: AnimatedNumberStrategy
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* By default Sheet will prefer the open prop over a parent component that is
|
|
51
|
+
* controlling it via Adapt. In general if you want to Adapt to a sheet, you'd
|
|
52
|
+
* leave the open prop undefined. If you'd like to have the parent override the
|
|
53
|
+
* prop you've set manually on Sheet, set this to true.
|
|
54
|
+
*/
|
|
55
|
+
preferAdaptParentOpenState?: boolean
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* (experimental) Remove the children while hidden (to save some performance, but can cause issues with animations)
|
|
59
|
+
*/
|
|
60
|
+
unmountChildrenWhenHidden?: boolean
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* By default a fully-closed sheet wrapper is hidden with `display: 'none'`.
|
|
64
|
+
* Set this to keep the closed wrapper laid out (e.g. for native visual effects
|
|
65
|
+
* that cannot initialize below a hidden ancestor). `pointerEvents` still gates
|
|
66
|
+
* interaction while closed.
|
|
67
|
+
*/
|
|
68
|
+
disableHideWhenClosed?: boolean
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Adapts the sheet to use native sheet on the given platform (if available)
|
|
72
|
+
* The iOS system sheet does not expose continuous position, so
|
|
73
|
+
* `Sheet.useAnimatedPosition` and `onTransition` are unavailable in this mode.
|
|
74
|
+
*/
|
|
75
|
+
native?: 'ios'[] | boolean
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Pass if you're using the CSS animation driver
|
|
79
|
+
*/
|
|
80
|
+
transition?: TransitionProp
|
|
81
|
+
handleDisableScroll?: boolean
|
|
82
|
+
disableDrag?: boolean
|
|
83
|
+
modal?: boolean
|
|
84
|
+
zIndex?: number
|
|
85
|
+
portalProps?: PortalProps
|
|
86
|
+
/**
|
|
87
|
+
* Makes the sheet move up when the mobile keyboard opens so the focused input remains visible.
|
|
88
|
+
* Works on native (via keyboard events) and on mobile web (via the VisualViewport API).
|
|
89
|
+
*/
|
|
90
|
+
moveOnKeyboardChange?: boolean
|
|
91
|
+
containerComponent?: React.ComponentType<any>
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fires at the start and end of the sheet's position transition. `cause` is
|
|
95
|
+
* `open` when moving from closed, `close` when moving off screen, and `snap`
|
|
96
|
+
* when moving between snap points while open. On the `end` phase, `finished`
|
|
97
|
+
* is `false` when the transition was interrupted (e.g. a close canceled by a
|
|
98
|
+
* re-open). `position` is the resolved translateY (px from screen top) target.
|
|
99
|
+
* Available on Tamagui's custom Sheet, not the native iOS system sheet.
|
|
100
|
+
*/
|
|
101
|
+
onTransition?: (e: SheetTransitionEvent) => void
|
|
102
|
+
}>
|
|
103
|
+
|
|
104
|
+
export type SheetTransitionCause = 'open' | 'close' | 'snap'
|
|
105
|
+
|
|
106
|
+
export type SheetTransitionEvent = {
|
|
107
|
+
phase: 'start' | 'end'
|
|
108
|
+
cause: SheetTransitionCause
|
|
109
|
+
position: number
|
|
110
|
+
finished?: boolean
|
|
111
|
+
}
|
|
97
112
|
|
|
98
113
|
export type PositionChangeHandler = (position: number) => void
|
|
99
114
|
|
|
@@ -105,8 +120,6 @@ export type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>
|
|
|
105
120
|
|
|
106
121
|
export type SnapPointsMode = 'percent' | 'constant' | 'fit' | 'mixed'
|
|
107
122
|
|
|
108
|
-
export type SheetScopedProps<A> = ScopedProps<A, 'Sheet'>
|
|
109
|
-
|
|
110
123
|
export type ScrollBridge = {
|
|
111
124
|
enabled: boolean
|
|
112
125
|
y: number
|
|
@@ -198,3 +211,20 @@ export interface KeyboardControllerSheetResult {
|
|
|
198
211
|
*/
|
|
199
212
|
flushPendingHide: () => void
|
|
200
213
|
}
|
|
214
|
+
|
|
215
|
+
export type SheetDragSurfaceProps = {
|
|
216
|
+
/** react-native-gesture-handler is set up and owns the drag (native only) */
|
|
217
|
+
gestureHandlerEnabled: boolean
|
|
218
|
+
/** the `Gesture.Pan` to attach when gesture handler owns the drag */
|
|
219
|
+
panGesture: any
|
|
220
|
+
/** the PanResponder config to drive the drag with otherwise, null when dragging is off */
|
|
221
|
+
panConfig: PanResponderConfig | null
|
|
222
|
+
children?: ReactNode
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export type SheetNativePlatforms = 'ios'
|
|
226
|
+
|
|
227
|
+
export type SheetNativeModal = {
|
|
228
|
+
ModalSheetView: any
|
|
229
|
+
ModalSheetViewMainContent: any
|
|
230
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* native implementation of keyboard controller sheet hook.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* keyboard-adjusted positions
|
|
4
|
+
* simplified to just track keyboard state (height, visibility).
|
|
5
|
+
* position animation is handled by SheetImplementationCustom via
|
|
6
|
+
* keyboard-adjusted positions, matching the react-native-actions-sheet pattern.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* uses React Native keyboard events for state. The optional keyboard-controller
|
|
9
|
+
* integration is only used for imperative dismissal.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
@@ -67,40 +67,11 @@ export function useKeyboardControllerSheet(
|
|
|
67
67
|
}
|
|
68
68
|
}, [])
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const { KeyboardEvents } = getKeyboardControllerState()
|
|
75
|
-
if (!KeyboardEvents?.addListener) return
|
|
76
|
-
|
|
77
|
-
const showSub = KeyboardEvents.addListener('keyboardWillShow', (e: any) => {
|
|
78
|
-
const height = e?.height ?? 0
|
|
79
|
-
if (height > 0) {
|
|
80
|
-
setKeyboardHeight(height)
|
|
81
|
-
}
|
|
82
|
-
setIsKeyboardVisible(true)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const hideSub = KeyboardEvents.addListener('keyboardWillHide', () => {
|
|
86
|
-
if (pauseKeyboardHandler.current) {
|
|
87
|
-
pendingHide.current = true
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
setIsKeyboardVisible(false)
|
|
91
|
-
setKeyboardHeight(0)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
return () => {
|
|
95
|
-
showSub?.remove?.()
|
|
96
|
-
hideSub?.remove?.()
|
|
97
|
-
}
|
|
98
|
-
}, [enabled, keyboardControllerEnabled])
|
|
99
|
-
|
|
100
|
-
// fallback to basic Keyboard API when keyboard-controller not available
|
|
70
|
+
// module availability does not prove that KeyboardProvider is mounted. Its
|
|
71
|
+
// event emitter is silent without the provider, while React Native's keyboard
|
|
72
|
+
// notifications are available in both configurations.
|
|
101
73
|
useEffect(() => {
|
|
102
74
|
if (!enabled) return
|
|
103
|
-
if (keyboardControllerEnabled) return
|
|
104
75
|
|
|
105
76
|
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'
|
|
106
77
|
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'
|
|
@@ -123,7 +94,7 @@ export function useKeyboardControllerSheet(
|
|
|
123
94
|
showListener.remove()
|
|
124
95
|
hideListener.remove()
|
|
125
96
|
}
|
|
126
|
-
}, [enabled
|
|
97
|
+
}, [enabled])
|
|
127
98
|
|
|
128
99
|
return {
|
|
129
100
|
keyboardControllerEnabled,
|