@hanzogui/sheet 2.0.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.
- package/LICENSE +21 -0
- package/controller/index.cjs +2 -0
- package/controller/index.d.ts +5 -0
- package/controller/index.js +2 -0
- package/controller/index.native.cjs +2 -0
- package/controller/index.native.js +2 -0
- package/dist/cjs/GestureDetectorWrapper.cjs +48 -0
- package/dist/cjs/GestureDetectorWrapper.native.js +53 -0
- package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -0
- package/dist/cjs/GestureSheetContext.cjs +52 -0
- package/dist/cjs/GestureSheetContext.native.js +56 -0
- package/dist/cjs/GestureSheetContext.native.js.map +1 -0
- package/dist/cjs/Sheet.cjs +117 -0
- package/dist/cjs/Sheet.native.js +120 -0
- package/dist/cjs/Sheet.native.js.map +1 -0
- package/dist/cjs/SheetContext.cjs +32 -0
- package/dist/cjs/SheetContext.native.js +35 -0
- package/dist/cjs/SheetContext.native.js.map +1 -0
- package/dist/cjs/SheetController.cjs +65 -0
- package/dist/cjs/SheetController.native.js +71 -0
- package/dist/cjs/SheetController.native.js.map +1 -0
- package/dist/cjs/SheetImplementationCustom.cjs +472 -0
- package/dist/cjs/SheetImplementationCustom.native.js +524 -0
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -0
- package/dist/cjs/SheetScrollView.cjs +180 -0
- package/dist/cjs/SheetScrollView.native.js +197 -0
- package/dist/cjs/SheetScrollView.native.js.map +1 -0
- package/dist/cjs/constants.cjs +32 -0
- package/dist/cjs/constants.native.js +35 -0
- package/dist/cjs/constants.native.js.map +1 -0
- package/dist/cjs/contexts.cjs +42 -0
- package/dist/cjs/contexts.native.js +45 -0
- package/dist/cjs/contexts.native.js.map +1 -0
- package/dist/cjs/controller.cjs +29 -0
- package/dist/cjs/controller.native.js +32 -0
- package/dist/cjs/controller.native.js.map +1 -0
- package/dist/cjs/createSheet.cjs +191 -0
- package/dist/cjs/createSheet.native.js +208 -0
- package/dist/cjs/createSheet.native.js.map +1 -0
- package/dist/cjs/gestureState.cjs +39 -0
- package/dist/cjs/gestureState.native.js +42 -0
- package/dist/cjs/gestureState.native.js.map +1 -0
- package/dist/cjs/helpers.cjs +31 -0
- package/dist/cjs/helpers.native.js +35 -0
- package/dist/cjs/helpers.native.js.map +1 -0
- package/dist/cjs/index.cjs +28 -0
- package/dist/cjs/index.native.js +31 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/nativeSheet.cjs +87 -0
- package/dist/cjs/nativeSheet.native.js +101 -0
- package/dist/cjs/nativeSheet.native.js.map +1 -0
- package/dist/cjs/setupGestureHandler.cjs +46 -0
- package/dist/cjs/setupGestureHandler.native.js +50 -0
- package/dist/cjs/setupGestureHandler.native.js.map +1 -0
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/types.native.js +19 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/useGestureHandlerPan.cjs +136 -0
- package/dist/cjs/useGestureHandlerPan.native.js +145 -0
- package/dist/cjs/useGestureHandlerPan.native.js.map +1 -0
- package/dist/cjs/useKeyboardControllerSheet.cjs +38 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js +114 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -0
- package/dist/cjs/useSheet.cjs +27 -0
- package/dist/cjs/useSheet.native.js +32 -0
- package/dist/cjs/useSheet.native.js.map +1 -0
- package/dist/cjs/useSheetController.cjs +50 -0
- package/dist/cjs/useSheetController.native.js +53 -0
- package/dist/cjs/useSheetController.native.js.map +1 -0
- package/dist/cjs/useSheetOffscreenSize.cjs +51 -0
- package/dist/cjs/useSheetOffscreenSize.native.js +61 -0
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -0
- package/dist/cjs/useSheetOpenState.cjs +49 -0
- package/dist/cjs/useSheetOpenState.native.js +56 -0
- package/dist/cjs/useSheetOpenState.native.js.map +1 -0
- package/dist/cjs/useSheetProviderProps.cjs +133 -0
- package/dist/cjs/useSheetProviderProps.native.js +153 -0
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -0
- package/dist/cjs/useSheetScrollViewGestures.cjs +123 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js +110 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -0
- package/dist/esm/GestureDetectorWrapper.mjs +25 -0
- package/dist/esm/GestureDetectorWrapper.mjs.map +1 -0
- package/dist/esm/GestureDetectorWrapper.native.js +27 -0
- package/dist/esm/GestureDetectorWrapper.native.js.map +1 -0
- package/dist/esm/GestureSheetContext.mjs +28 -0
- package/dist/esm/GestureSheetContext.mjs.map +1 -0
- package/dist/esm/GestureSheetContext.native.js +29 -0
- package/dist/esm/GestureSheetContext.native.js.map +1 -0
- package/dist/esm/Sheet.mjs +89 -0
- package/dist/esm/Sheet.mjs.map +1 -0
- package/dist/esm/Sheet.native.js +89 -0
- package/dist/esm/Sheet.native.js.map +1 -0
- package/dist/esm/SheetContext.mjs +6 -0
- package/dist/esm/SheetContext.mjs.map +1 -0
- package/dist/esm/SheetContext.native.js +6 -0
- package/dist/esm/SheetContext.native.js.map +1 -0
- package/dist/esm/SheetController.mjs +31 -0
- package/dist/esm/SheetController.mjs.map +1 -0
- package/dist/esm/SheetController.native.js +34 -0
- package/dist/esm/SheetController.native.js.map +1 -0
- package/dist/esm/SheetImplementationCustom.mjs +437 -0
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -0
- package/dist/esm/SheetImplementationCustom.native.js +487 -0
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -0
- package/dist/esm/SheetScrollView.mjs +146 -0
- package/dist/esm/SheetScrollView.mjs.map +1 -0
- package/dist/esm/SheetScrollView.native.js +160 -0
- package/dist/esm/SheetScrollView.native.js.map +1 -0
- package/dist/esm/constants.mjs +6 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/constants.native.js +6 -0
- package/dist/esm/constants.native.js.map +1 -0
- package/dist/esm/contexts.mjs +7 -0
- package/dist/esm/contexts.mjs.map +1 -0
- package/dist/esm/contexts.native.js +7 -0
- package/dist/esm/contexts.native.js.map +1 -0
- package/dist/esm/controller.mjs +4 -0
- package/dist/esm/controller.mjs.map +1 -0
- package/dist/esm/controller.native.js +4 -0
- package/dist/esm/controller.native.js.map +1 -0
- package/dist/esm/createSheet.mjs +168 -0
- package/dist/esm/createSheet.mjs.map +1 -0
- package/dist/esm/createSheet.native.js +182 -0
- package/dist/esm/createSheet.native.js.map +1 -0
- package/dist/esm/gestureState.mjs +13 -0
- package/dist/esm/gestureState.mjs.map +1 -0
- package/dist/esm/gestureState.native.js +13 -0
- package/dist/esm/gestureState.native.js.map +1 -0
- package/dist/esm/helpers.mjs +8 -0
- package/dist/esm/helpers.mjs.map +1 -0
- package/dist/esm/helpers.native.js +9 -0
- package/dist/esm/helpers.native.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +12 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +12 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/nativeSheet.mjs +63 -0
- package/dist/esm/nativeSheet.mjs.map +1 -0
- package/dist/esm/nativeSheet.native.js +74 -0
- package/dist/esm/nativeSheet.native.js.map +1 -0
- package/dist/esm/setupGestureHandler.mjs +22 -0
- package/dist/esm/setupGestureHandler.mjs.map +1 -0
- package/dist/esm/setupGestureHandler.native.js +23 -0
- package/dist/esm/setupGestureHandler.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/esm/useGestureHandlerPan.mjs +113 -0
- package/dist/esm/useGestureHandlerPan.mjs.map +1 -0
- package/dist/esm/useGestureHandlerPan.native.js +119 -0
- package/dist/esm/useGestureHandlerPan.native.js.map +1 -0
- package/dist/esm/useKeyboardControllerSheet.mjs +15 -0
- package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -0
- package/dist/esm/useKeyboardControllerSheet.native.js +88 -0
- package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -0
- package/dist/esm/useSheet.mjs +4 -0
- package/dist/esm/useSheet.mjs.map +1 -0
- package/dist/esm/useSheet.native.js +6 -0
- package/dist/esm/useSheet.native.js.map +1 -0
- package/dist/esm/useSheetController.mjs +15 -0
- package/dist/esm/useSheetController.mjs.map +1 -0
- package/dist/esm/useSheetController.native.js +15 -0
- package/dist/esm/useSheetController.native.js.map +1 -0
- package/dist/esm/useSheetOffscreenSize.mjs +28 -0
- package/dist/esm/useSheetOffscreenSize.mjs.map +1 -0
- package/dist/esm/useSheetOffscreenSize.native.js +35 -0
- package/dist/esm/useSheetOffscreenSize.native.js.map +1 -0
- package/dist/esm/useSheetOpenState.mjs +26 -0
- package/dist/esm/useSheetOpenState.mjs.map +1 -0
- package/dist/esm/useSheetOpenState.native.js +30 -0
- package/dist/esm/useSheetOpenState.native.js.map +1 -0
- package/dist/esm/useSheetProviderProps.mjs +99 -0
- package/dist/esm/useSheetProviderProps.mjs.map +1 -0
- package/dist/esm/useSheetProviderProps.native.js +116 -0
- package/dist/esm/useSheetProviderProps.native.js.map +1 -0
- package/dist/esm/useSheetScrollViewGestures.mjs +100 -0
- package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -0
- package/dist/esm/useSheetScrollViewGestures.native.js +84 -0
- package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -0
- package/dist/jsx/GestureDetectorWrapper.mjs +25 -0
- package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -0
- package/dist/jsx/GestureDetectorWrapper.native.js +53 -0
- package/dist/jsx/GestureDetectorWrapper.native.js.map +1 -0
- package/dist/jsx/GestureSheetContext.mjs +28 -0
- package/dist/jsx/GestureSheetContext.mjs.map +1 -0
- package/dist/jsx/GestureSheetContext.native.js +56 -0
- package/dist/jsx/GestureSheetContext.native.js.map +1 -0
- package/dist/jsx/Sheet.mjs +89 -0
- package/dist/jsx/Sheet.mjs.map +1 -0
- package/dist/jsx/Sheet.native.js +120 -0
- package/dist/jsx/Sheet.native.js.map +1 -0
- package/dist/jsx/SheetContext.mjs +6 -0
- package/dist/jsx/SheetContext.mjs.map +1 -0
- package/dist/jsx/SheetContext.native.js +35 -0
- package/dist/jsx/SheetContext.native.js.map +1 -0
- package/dist/jsx/SheetController.mjs +31 -0
- package/dist/jsx/SheetController.mjs.map +1 -0
- package/dist/jsx/SheetController.native.js +71 -0
- package/dist/jsx/SheetController.native.js.map +1 -0
- package/dist/jsx/SheetImplementationCustom.mjs +437 -0
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -0
- package/dist/jsx/SheetImplementationCustom.native.js +524 -0
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -0
- package/dist/jsx/SheetScrollView.mjs +146 -0
- package/dist/jsx/SheetScrollView.mjs.map +1 -0
- package/dist/jsx/SheetScrollView.native.js +197 -0
- package/dist/jsx/SheetScrollView.native.js.map +1 -0
- package/dist/jsx/constants.mjs +6 -0
- package/dist/jsx/constants.mjs.map +1 -0
- package/dist/jsx/constants.native.js +35 -0
- package/dist/jsx/constants.native.js.map +1 -0
- package/dist/jsx/contexts.mjs +7 -0
- package/dist/jsx/contexts.mjs.map +1 -0
- package/dist/jsx/contexts.native.js +45 -0
- package/dist/jsx/contexts.native.js.map +1 -0
- package/dist/jsx/controller.mjs +4 -0
- package/dist/jsx/controller.mjs.map +1 -0
- package/dist/jsx/controller.native.js +32 -0
- package/dist/jsx/controller.native.js.map +1 -0
- package/dist/jsx/createSheet.mjs +168 -0
- package/dist/jsx/createSheet.mjs.map +1 -0
- package/dist/jsx/createSheet.native.js +208 -0
- package/dist/jsx/createSheet.native.js.map +1 -0
- package/dist/jsx/gestureState.mjs +13 -0
- package/dist/jsx/gestureState.mjs.map +1 -0
- package/dist/jsx/gestureState.native.js +42 -0
- package/dist/jsx/gestureState.native.js.map +1 -0
- package/dist/jsx/helpers.mjs +8 -0
- package/dist/jsx/helpers.mjs.map +1 -0
- package/dist/jsx/helpers.native.js +35 -0
- package/dist/jsx/helpers.native.js.map +1 -0
- package/dist/jsx/index.js +12 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +12 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +31 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/dist/jsx/nativeSheet.mjs +63 -0
- package/dist/jsx/nativeSheet.mjs.map +1 -0
- package/dist/jsx/nativeSheet.native.js +101 -0
- package/dist/jsx/nativeSheet.native.js.map +1 -0
- package/dist/jsx/setupGestureHandler.mjs +22 -0
- package/dist/jsx/setupGestureHandler.mjs.map +1 -0
- package/dist/jsx/setupGestureHandler.native.js +50 -0
- package/dist/jsx/setupGestureHandler.native.js.map +1 -0
- package/dist/jsx/types.mjs +2 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/dist/jsx/types.native.js +19 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/dist/jsx/useGestureHandlerPan.mjs +113 -0
- package/dist/jsx/useGestureHandlerPan.mjs.map +1 -0
- package/dist/jsx/useGestureHandlerPan.native.js +145 -0
- package/dist/jsx/useGestureHandlerPan.native.js.map +1 -0
- package/dist/jsx/useKeyboardControllerSheet.mjs +15 -0
- package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -0
- package/dist/jsx/useKeyboardControllerSheet.native.js +114 -0
- package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -0
- package/dist/jsx/useSheet.mjs +4 -0
- package/dist/jsx/useSheet.mjs.map +1 -0
- package/dist/jsx/useSheet.native.js +32 -0
- package/dist/jsx/useSheet.native.js.map +1 -0
- package/dist/jsx/useSheetController.mjs +15 -0
- package/dist/jsx/useSheetController.mjs.map +1 -0
- package/dist/jsx/useSheetController.native.js +53 -0
- package/dist/jsx/useSheetController.native.js.map +1 -0
- package/dist/jsx/useSheetOffscreenSize.mjs +28 -0
- package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -0
- package/dist/jsx/useSheetOffscreenSize.native.js +61 -0
- package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -0
- package/dist/jsx/useSheetOpenState.mjs +26 -0
- package/dist/jsx/useSheetOpenState.mjs.map +1 -0
- package/dist/jsx/useSheetOpenState.native.js +56 -0
- package/dist/jsx/useSheetOpenState.native.js.map +1 -0
- package/dist/jsx/useSheetProviderProps.mjs +99 -0
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -0
- package/dist/jsx/useSheetProviderProps.native.js +153 -0
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -0
- package/dist/jsx/useSheetScrollViewGestures.mjs +100 -0
- package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js +110 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -0
- package/next.md +78 -0
- package/package.json +96 -0
- package/setup-gesture-handler/index.cjs +2 -0
- package/setup-gesture-handler/index.js +2 -0
- package/setup-gesture-handler/index.native.cjs +2 -0
- package/setup-gesture-handler/index.native.js +2 -0
- package/setup-gesture-handler.cjs +1 -0
- package/src/GestureDetectorWrapper.tsx +41 -0
- package/src/GestureSheetContext.tsx +62 -0
- package/src/Sheet.tsx +114 -0
- package/src/SheetContext.tsx +11 -0
- package/src/SheetController.tsx +44 -0
- package/src/SheetImplementationCustom.tsx +868 -0
- package/src/SheetScrollView.tsx +195 -0
- package/src/constants.tsx +5 -0
- package/src/contexts.ts +9 -0
- package/src/controller.ts +9 -0
- package/src/createSheet.tsx +296 -0
- package/src/gestureState.ts +24 -0
- package/src/helpers.tsx +31 -0
- package/src/index.ts +11 -0
- package/src/nativeSheet.tsx +89 -0
- package/src/setupGestureHandler.ts +34 -0
- package/src/types.tsx +181 -0
- package/src/useGestureHandlerPan.tsx +364 -0
- package/src/useKeyboardControllerSheet.native.ts +136 -0
- package/src/useKeyboardControllerSheet.ts +26 -0
- package/src/useSheet.tsx +3 -0
- package/src/useSheetController.tsx +27 -0
- package/src/useSheetOffscreenSize.tsx +49 -0
- package/src/useSheetOpenState.tsx +33 -0
- package/src/useSheetProviderProps.tsx +223 -0
- package/src/useSheetScrollViewGestures.native.ts +163 -0
- package/src/useSheetScrollViewGestures.ts +194 -0
- package/tsconfig.json +56 -0
- package/types/GestureDetectorWrapper.d.ts +14 -0
- package/types/GestureSheetContext.d.ts +36 -0
- package/types/Sheet.d.ts +183 -0
- package/types/SheetContext.d.ts +43 -0
- package/types/SheetController.d.ts +6 -0
- package/types/SheetImplementationCustom.d.ts +36 -0
- package/types/SheetScrollView.d.ts +40 -0
- package/types/constants.d.ts +5 -0
- package/types/contexts.d.ts +6 -0
- package/types/controller.d.ts +3 -0
- package/types/createSheet.d.ts +194 -0
- package/types/gestureState.d.ts +11 -0
- package/types/helpers.d.ts +2 -0
- package/types/index.d.ts +12 -0
- package/types/nativeSheet.d.ts +10 -0
- package/types/setupGestureHandler.d.ts +11 -0
- package/types/types.d.ts +147 -0
- package/types/useGestureHandlerPan.d.ts +44 -0
- package/types/useKeyboardControllerSheet.d.ts +7 -0
- package/types/useKeyboardControllerSheet.native.d.ts +13 -0
- package/types/useSheet.d.ts +2 -0
- package/types/useSheetController.d.ts +17 -0
- package/types/useSheetOffscreenSize.d.ts +3 -0
- package/types/useSheetOpenState.d.ts +9 -0
- package/types/useSheetProviderProps.d.ts +36 -0
- package/types/useSheetScrollViewGestures.d.ts +12 -0
- package/types/useSheetScrollViewGestures.native.d.ts +21 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
import type { ScrollView as RNScrollView } from 'react-native'
|
|
3
|
+
import type { ScrollBridge } from './types'
|
|
4
|
+
|
|
5
|
+
type GestureOwner = 'none' | 'pan' | 'scroll'
|
|
6
|
+
|
|
7
|
+
interface GestureState {
|
|
8
|
+
startY: number
|
|
9
|
+
lastY: number
|
|
10
|
+
owner: GestureOwner
|
|
11
|
+
panDragOffset: number
|
|
12
|
+
dys: number[]
|
|
13
|
+
scrollYAtGestureStart: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface UseSheetScrollViewGesturesProps {
|
|
17
|
+
scrollRef: React.RefObject<RNScrollView | null>
|
|
18
|
+
scrollBridge: ScrollBridge
|
|
19
|
+
hasScrollableContent: boolean
|
|
20
|
+
scrollEnabled: boolean
|
|
21
|
+
setScrollEnabled: (enabled: boolean, lockTo?: number) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useSheetScrollViewGestures({
|
|
25
|
+
scrollRef,
|
|
26
|
+
scrollBridge,
|
|
27
|
+
hasScrollableContent,
|
|
28
|
+
}: UseSheetScrollViewGesturesProps) {
|
|
29
|
+
const state = useRef<GestureState>({
|
|
30
|
+
startY: 0,
|
|
31
|
+
lastY: 0,
|
|
32
|
+
owner: 'none',
|
|
33
|
+
panDragOffset: 0,
|
|
34
|
+
dys: [],
|
|
35
|
+
scrollYAtGestureStart: 0,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!scrollRef.current) return
|
|
40
|
+
|
|
41
|
+
const controller = new AbortController()
|
|
42
|
+
const node = scrollRef.current?.getScrollableNode() as HTMLElement | undefined
|
|
43
|
+
|
|
44
|
+
if (!node) return
|
|
45
|
+
|
|
46
|
+
node.style.overscrollBehavior = 'contain'
|
|
47
|
+
|
|
48
|
+
// track original overflow to restore later
|
|
49
|
+
let originalOverflow = ''
|
|
50
|
+
|
|
51
|
+
const disableScroll = () => {
|
|
52
|
+
if (node.style.overflowY !== 'hidden') {
|
|
53
|
+
originalOverflow = node.style.overflowY
|
|
54
|
+
node.style.overflowY = 'hidden'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const enableScroll = () => {
|
|
59
|
+
node.style.overflowY = originalOverflow
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const handleTouchStart = (e: TouchEvent) => {
|
|
63
|
+
const touch = e.touches[0]
|
|
64
|
+
if (!touch) return
|
|
65
|
+
|
|
66
|
+
const currentScrollY = node.scrollTop
|
|
67
|
+
|
|
68
|
+
state.current = {
|
|
69
|
+
startY: touch.pageY,
|
|
70
|
+
lastY: touch.pageY,
|
|
71
|
+
owner: 'none',
|
|
72
|
+
panDragOffset: 0,
|
|
73
|
+
dys: [],
|
|
74
|
+
scrollYAtGestureStart: currentScrollY,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
scrollBridge.scrollStartY = touch.pageY
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const handleTouchMove = (e: TouchEvent) => {
|
|
81
|
+
const touch = e.touches[0]
|
|
82
|
+
if (!touch) return
|
|
83
|
+
|
|
84
|
+
const { current: s } = state
|
|
85
|
+
const pageY = touch.pageY
|
|
86
|
+
const dy = pageY - s.lastY
|
|
87
|
+
s.lastY = pageY
|
|
88
|
+
|
|
89
|
+
if (dy === 0) return
|
|
90
|
+
|
|
91
|
+
const isDraggingDown = dy > 0
|
|
92
|
+
const currentScrollY = node.scrollTop
|
|
93
|
+
const isPaneAtTop = scrollBridge.paneY <= scrollBridge.paneMinY + 5
|
|
94
|
+
|
|
95
|
+
scrollBridge.y = currentScrollY
|
|
96
|
+
|
|
97
|
+
// simple ownership rules:
|
|
98
|
+
// - pan owns when: sheet not at top, OR (sheet at top AND scrollY=0 AND dragging down)
|
|
99
|
+
// - scroll owns otherwise
|
|
100
|
+
|
|
101
|
+
let shouldPanOwn = false
|
|
102
|
+
|
|
103
|
+
if (!isPaneAtTop) {
|
|
104
|
+
// sheet not at top - pan always owns
|
|
105
|
+
shouldPanOwn = true
|
|
106
|
+
} else if (currentScrollY <= 0 && isDraggingDown) {
|
|
107
|
+
// at top, scroll at 0, dragging down - pan owns (pull sheet down)
|
|
108
|
+
shouldPanOwn = true
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const newOwner: GestureOwner = shouldPanOwn ? 'pan' : 'scroll'
|
|
112
|
+
|
|
113
|
+
// handle transitions
|
|
114
|
+
if (newOwner !== s.owner) {
|
|
115
|
+
if (newOwner === 'pan') {
|
|
116
|
+
s.panDragOffset = 0
|
|
117
|
+
s.dys = []
|
|
118
|
+
scrollBridge.setParentDragging(true)
|
|
119
|
+
disableScroll()
|
|
120
|
+
} else {
|
|
121
|
+
scrollBridge.setParentDragging(false)
|
|
122
|
+
scrollBridge.scrollLock = false
|
|
123
|
+
enableScroll()
|
|
124
|
+
}
|
|
125
|
+
s.owner = newOwner
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (s.owner === 'pan') {
|
|
129
|
+
if (e.cancelable) e.preventDefault()
|
|
130
|
+
|
|
131
|
+
s.panDragOffset += dy
|
|
132
|
+
scrollBridge.drag(s.panDragOffset)
|
|
133
|
+
|
|
134
|
+
s.dys.push(dy)
|
|
135
|
+
if (s.dys.length > 100) s.dys = s.dys.slice(-10)
|
|
136
|
+
} else if (s.owner === 'scroll') {
|
|
137
|
+
// programmatic scroll for synthetic events
|
|
138
|
+
const scrollDelta = -dy
|
|
139
|
+
const maxScrollY = node.scrollHeight - node.clientHeight
|
|
140
|
+
const newScrollY = Math.max(0, Math.min(maxScrollY, currentScrollY + scrollDelta))
|
|
141
|
+
if (newScrollY !== currentScrollY) {
|
|
142
|
+
node.scrollTop = newScrollY
|
|
143
|
+
scrollBridge.y = newScrollY
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const handleTouchEnd = () => {
|
|
149
|
+
const { current: s } = state
|
|
150
|
+
|
|
151
|
+
if (s.owner === 'pan') {
|
|
152
|
+
scrollBridge.setParentDragging(false)
|
|
153
|
+
|
|
154
|
+
let vy = 0
|
|
155
|
+
if (s.dys.length) {
|
|
156
|
+
const recentDys = s.dys.slice(-10)
|
|
157
|
+
const dist = recentDys.reduce((a, b) => a + b, 0)
|
|
158
|
+
vy = (dist / recentDys.length) * 0.04
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
scrollBridge.release({ dragAt: s.panDragOffset, vy })
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
enableScroll()
|
|
165
|
+
s.owner = 'none'
|
|
166
|
+
s.panDragOffset = 0
|
|
167
|
+
s.dys = []
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
node.addEventListener('touchstart', handleTouchStart, {
|
|
171
|
+
signal: controller.signal,
|
|
172
|
+
passive: true,
|
|
173
|
+
})
|
|
174
|
+
node.addEventListener('touchmove', handleTouchMove, {
|
|
175
|
+
signal: controller.signal,
|
|
176
|
+
passive: false,
|
|
177
|
+
})
|
|
178
|
+
node.addEventListener('touchend', handleTouchEnd, {
|
|
179
|
+
signal: controller.signal,
|
|
180
|
+
passive: true,
|
|
181
|
+
})
|
|
182
|
+
node.addEventListener('touchcancel', handleTouchEnd, {
|
|
183
|
+
signal: controller.signal,
|
|
184
|
+
passive: true,
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
return () => {
|
|
188
|
+
enableScroll()
|
|
189
|
+
controller.abort()
|
|
190
|
+
}
|
|
191
|
+
}, [scrollRef, scrollBridge, hasScrollableContent])
|
|
192
|
+
|
|
193
|
+
return {}
|
|
194
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"strict": true
|
|
6
|
+
},
|
|
7
|
+
"references": [
|
|
8
|
+
{
|
|
9
|
+
"path": "../../core/animations-react-native"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "../../core/compose-refs"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "../../core/constants"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "../../core/core"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "../../core/create-context"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../core/helpers"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../core/use-constant"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../core/use-controllable-state"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../core/use-keyboard-visible"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../animate-presence"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../portal"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../remove-scroll"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../scroll-view"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../stacks"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"exclude": [
|
|
52
|
+
"types",
|
|
53
|
+
"dist",
|
|
54
|
+
"**/__tests__"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type ViewStyle } from 'react-native';
|
|
3
|
+
interface GestureDetectorWrapperProps {
|
|
4
|
+
gesture: any;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Conditionally wraps children with GestureDetector when RNGH is available.
|
|
10
|
+
* Uses a plain View wrapper that GestureDetector can attach gesture handlers to.
|
|
11
|
+
*/
|
|
12
|
+
export declare function GestureDetectorWrapper({ gesture, children, style, }: GestureDetectorWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=GestureDetectorWrapper.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type RefObject } from 'react';
|
|
3
|
+
export interface GestureSheetContextValue {
|
|
4
|
+
/**
|
|
5
|
+
* The sheet's pan gesture object, used for simultaneousHandlers
|
|
6
|
+
* in ScrollView to coordinate gestures
|
|
7
|
+
*/
|
|
8
|
+
panGesture: any | null;
|
|
9
|
+
/**
|
|
10
|
+
* Ref to the pan gesture for simultaneousHandlers prop
|
|
11
|
+
*/
|
|
12
|
+
panGestureRef: RefObject<any> | null;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the sheet is currently being dragged by the user
|
|
15
|
+
*/
|
|
16
|
+
isDragging: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Set whether panning should be blocked (e.g., when scrolling)
|
|
19
|
+
*/
|
|
20
|
+
setBlockPan: (blocked: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Whether pan gesture is currently blocked
|
|
23
|
+
*/
|
|
24
|
+
blockPan: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function useGestureSheetContext(): GestureSheetContextValue | null;
|
|
27
|
+
export interface GestureSheetProviderProps {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
isDragging: boolean;
|
|
30
|
+
blockPan: boolean;
|
|
31
|
+
setBlockPan: (blocked: boolean) => void;
|
|
32
|
+
panGesture: any | null;
|
|
33
|
+
panGestureRef: RefObject<any> | null;
|
|
34
|
+
}
|
|
35
|
+
export declare function GestureSheetProvider({ children, isDragging, blockPan, setBlockPan, panGesture, panGestureRef, }: GestureSheetProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=GestureSheetContext.d.ts.map
|
package/types/Sheet.d.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
export { createSheetScope } from './SheetContext';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export declare const Handle: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
4
|
+
open?: boolean | undefined;
|
|
5
|
+
unstyled?: boolean | undefined;
|
|
6
|
+
elevation?: number | import("@gui/core").SizeTokens | undefined;
|
|
7
|
+
fullscreen?: boolean | undefined;
|
|
8
|
+
}, import("@gui/core").StaticConfigPublic>;
|
|
9
|
+
export declare const Overlay: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
10
|
+
open?: boolean | undefined;
|
|
11
|
+
unstyled?: boolean | undefined;
|
|
12
|
+
elevation?: number | import("@gui/core").SizeTokens | undefined;
|
|
13
|
+
fullscreen?: boolean | undefined;
|
|
14
|
+
}, import("@gui/core").StaticConfigPublic>;
|
|
15
|
+
export declare const Frame: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
16
|
+
unstyled?: boolean | undefined;
|
|
17
|
+
elevation?: number | import("@gui/core").SizeTokens | undefined;
|
|
18
|
+
fullscreen?: boolean | undefined;
|
|
19
|
+
}, import("@gui/core").StaticConfigPublic>;
|
|
20
|
+
export declare const Sheet: import("react").ForwardRefExoticComponent<{
|
|
21
|
+
open?: boolean;
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
onOpenChange?: import("react").Dispatch<import("react").SetStateAction<boolean>> | ((open: boolean) => void);
|
|
24
|
+
position?: number;
|
|
25
|
+
defaultPosition?: number;
|
|
26
|
+
snapPoints?: (string | number)[];
|
|
27
|
+
snapPointsMode?: import("./types").SnapPointsMode;
|
|
28
|
+
onPositionChange?: import("./types").PositionChangeHandler;
|
|
29
|
+
children?: import("react").ReactNode;
|
|
30
|
+
dismissOnOverlayPress?: boolean;
|
|
31
|
+
dismissOnSnapToBottom?: boolean;
|
|
32
|
+
disableRemoveScroll?: boolean;
|
|
33
|
+
forceRemoveScrollEnabled?: boolean;
|
|
34
|
+
transitionConfig?: import("@gui/core").AnimatedNumberStrategy;
|
|
35
|
+
preferAdaptParentOpenState?: boolean;
|
|
36
|
+
unmountChildrenWhenHidden?: boolean;
|
|
37
|
+
native?: "ios"[] | boolean;
|
|
38
|
+
transition?: import("@gui/core").TransitionProp;
|
|
39
|
+
handleDisableScroll?: boolean;
|
|
40
|
+
disableDrag?: boolean;
|
|
41
|
+
modal?: boolean;
|
|
42
|
+
zIndex?: number;
|
|
43
|
+
portalProps?: import("@gui/portal").PortalProps;
|
|
44
|
+
moveOnKeyboardChange?: boolean;
|
|
45
|
+
containerComponent?: React.ComponentType<any>;
|
|
46
|
+
onAnimationComplete?: (info: {
|
|
47
|
+
open: boolean;
|
|
48
|
+
}) => void;
|
|
49
|
+
} & {
|
|
50
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
51
|
+
} & import("react").RefAttributes<import("react-native").View>> & {
|
|
52
|
+
Controlled: import("react").FunctionComponent<Omit<import("./types").SheetProps, "open" | "onOpenChange"> & import("react").RefAttributes<import("react-native").View>> & {
|
|
53
|
+
Frame: import("react").ForwardRefExoticComponent<import("./types").SheetScopedProps<Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
54
|
+
unstyled?: boolean | undefined;
|
|
55
|
+
elevation?: number | import("@gui/core").SizeTokens | undefined;
|
|
56
|
+
fullscreen?: boolean | undefined;
|
|
57
|
+
}>, keyof {
|
|
58
|
+
disableHideBottomOverflow?: boolean;
|
|
59
|
+
adjustPaddingForOffscreenContent?: boolean;
|
|
60
|
+
}> & {
|
|
61
|
+
disableHideBottomOverflow?: boolean;
|
|
62
|
+
adjustPaddingForOffscreenContent?: boolean;
|
|
63
|
+
}>>;
|
|
64
|
+
Overlay: import("@gui/core").GuiComponent<Omit<import("@gui/core").StackNonStyleProps & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase, {}>> & {
|
|
65
|
+
open?: boolean;
|
|
66
|
+
}, "__scopeSheet"> & {
|
|
67
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
68
|
+
}, any, any, any, {
|
|
69
|
+
open?: boolean;
|
|
70
|
+
}, {}> | import("@gui/core").GuiComponent<Omit<import("@gui/core").StackNonStyleProps & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase, {}>> & {
|
|
71
|
+
open?: boolean;
|
|
72
|
+
}, "__scopeSheet"> & {
|
|
73
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
74
|
+
}, any, {
|
|
75
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
76
|
+
}, {}, {}, {}>;
|
|
77
|
+
Handle: import("@gui/core").GuiComponent<any, any, any, any, {
|
|
78
|
+
open?: boolean;
|
|
79
|
+
}, {}> | import("@gui/core").GuiComponent<any, any, any, {}, {}, {}>;
|
|
80
|
+
ScrollView: import("react").ForwardRefExoticComponent<Omit<import("@gui/core").GuiComponentPropsBaseBase & import("react-native").ScrollViewProps, keyof import("@gui/core").StackStyleBase | "fullscreen" | "contentContainerStyle"> & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
81
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
82
|
+
accept: {
|
|
83
|
+
readonly contentContainerStyle: "style";
|
|
84
|
+
};
|
|
85
|
+
}>> | undefined;
|
|
86
|
+
}> & {
|
|
87
|
+
fullscreen?: boolean | undefined;
|
|
88
|
+
} & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
89
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
90
|
+
accept: {
|
|
91
|
+
readonly contentContainerStyle: "style";
|
|
92
|
+
};
|
|
93
|
+
}>> | undefined;
|
|
94
|
+
}>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
95
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
96
|
+
accept: {
|
|
97
|
+
readonly contentContainerStyle: "style";
|
|
98
|
+
};
|
|
99
|
+
}>> | undefined;
|
|
100
|
+
}> & {
|
|
101
|
+
fullscreen?: boolean | undefined;
|
|
102
|
+
} & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
103
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
104
|
+
accept: {
|
|
105
|
+
readonly contentContainerStyle: "style";
|
|
106
|
+
};
|
|
107
|
+
}>> | undefined;
|
|
108
|
+
}>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase & {
|
|
109
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
110
|
+
accept: {
|
|
111
|
+
readonly contentContainerStyle: "style";
|
|
112
|
+
};
|
|
113
|
+
}>> | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
fullscreen?: boolean | undefined;
|
|
116
|
+
}>> & import("react").RefAttributes<import("react-native").ScrollView>>;
|
|
117
|
+
};
|
|
118
|
+
Frame: import("react").ForwardRefExoticComponent<import("./types").SheetScopedProps<Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
119
|
+
unstyled?: boolean | undefined;
|
|
120
|
+
elevation?: number | import("@gui/core").SizeTokens | undefined;
|
|
121
|
+
fullscreen?: boolean | undefined;
|
|
122
|
+
}>, keyof {
|
|
123
|
+
disableHideBottomOverflow?: boolean;
|
|
124
|
+
adjustPaddingForOffscreenContent?: boolean;
|
|
125
|
+
}> & {
|
|
126
|
+
disableHideBottomOverflow?: boolean;
|
|
127
|
+
adjustPaddingForOffscreenContent?: boolean;
|
|
128
|
+
}>>;
|
|
129
|
+
Overlay: import("@gui/core").GuiComponent<Omit<import("@gui/core").StackNonStyleProps & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase, {}>> & {
|
|
130
|
+
open?: boolean;
|
|
131
|
+
}, "__scopeSheet"> & {
|
|
132
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
133
|
+
}, any, any, any, {
|
|
134
|
+
open?: boolean;
|
|
135
|
+
}, {}> | import("@gui/core").GuiComponent<Omit<import("@gui/core").StackNonStyleProps & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase, {}>> & {
|
|
136
|
+
open?: boolean;
|
|
137
|
+
}, "__scopeSheet"> & {
|
|
138
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
139
|
+
}, any, {
|
|
140
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
141
|
+
}, {}, {}, {}>;
|
|
142
|
+
Handle: import("@gui/core").GuiComponent<any, any, any, any, {
|
|
143
|
+
open?: boolean;
|
|
144
|
+
}, {}> | import("@gui/core").GuiComponent<any, any, any, {}, {}, {}>;
|
|
145
|
+
ScrollView: import("react").ForwardRefExoticComponent<Omit<import("@gui/core").GuiComponentPropsBaseBase & import("react-native").ScrollViewProps, keyof import("@gui/core").StackStyleBase | "fullscreen" | "contentContainerStyle"> & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
146
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
147
|
+
accept: {
|
|
148
|
+
readonly contentContainerStyle: "style";
|
|
149
|
+
};
|
|
150
|
+
}>> | undefined;
|
|
151
|
+
}> & {
|
|
152
|
+
fullscreen?: boolean | undefined;
|
|
153
|
+
} & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
154
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
155
|
+
accept: {
|
|
156
|
+
readonly contentContainerStyle: "style";
|
|
157
|
+
};
|
|
158
|
+
}>> | undefined;
|
|
159
|
+
}>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
160
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
161
|
+
accept: {
|
|
162
|
+
readonly contentContainerStyle: "style";
|
|
163
|
+
};
|
|
164
|
+
}>> | undefined;
|
|
165
|
+
}> & {
|
|
166
|
+
fullscreen?: boolean | undefined;
|
|
167
|
+
} & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
168
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
169
|
+
accept: {
|
|
170
|
+
readonly contentContainerStyle: "style";
|
|
171
|
+
};
|
|
172
|
+
}>> | undefined;
|
|
173
|
+
}>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase & {
|
|
174
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof import("react-native").ScrollView, {
|
|
175
|
+
accept: {
|
|
176
|
+
readonly contentContainerStyle: "style";
|
|
177
|
+
};
|
|
178
|
+
}>> | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
fullscreen?: boolean | undefined;
|
|
181
|
+
}>> & import("react").RefAttributes<import("react-native").ScrollView>>;
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=Sheet.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SheetContextValue } from './useSheetProviderProps';
|
|
2
|
+
export declare const createSheetContext: <ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType) => readonly [(props: ContextValueType & {
|
|
3
|
+
scope: import("@gui/create-context").Scope<ContextValueType>;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element, (consumerName: string, scope: import("@gui/create-context").Scope<ContextValueType | undefined>, options?: {
|
|
6
|
+
warn?: boolean;
|
|
7
|
+
fallback?: Partial<ContextValueType>;
|
|
8
|
+
}) => ContextValueType], createSheetScope: import("@gui/create-context").CreateScope;
|
|
9
|
+
export declare const SheetProvider: (props: {
|
|
10
|
+
screenSize: number;
|
|
11
|
+
maxSnapPoint: string | number;
|
|
12
|
+
disableRemoveScroll: boolean;
|
|
13
|
+
scrollBridge: import("./types").ScrollBridge;
|
|
14
|
+
modal: boolean;
|
|
15
|
+
open: boolean;
|
|
16
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
17
|
+
hidden: boolean;
|
|
18
|
+
contentRef: import("react").RefObject<import("@gui/web").GuiElement | null>;
|
|
19
|
+
handleRef: import("react").RefObject<import("@gui/web").GuiElement | null>;
|
|
20
|
+
frameSize: number;
|
|
21
|
+
setFrameSize: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
22
|
+
dismissOnOverlayPress: boolean;
|
|
23
|
+
dismissOnSnapToBottom: boolean;
|
|
24
|
+
onOverlayComponent: ((comp: any) => void) | undefined;
|
|
25
|
+
scope: import("@gui/create-context").Scope<any>;
|
|
26
|
+
hasFit: boolean;
|
|
27
|
+
position: number;
|
|
28
|
+
snapPoints: (string | number)[];
|
|
29
|
+
snapPointsMode: import("./types").SnapPointsMode;
|
|
30
|
+
setMaxContentSize: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
31
|
+
setPosition: (next: number) => void;
|
|
32
|
+
setPositionImmediate: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
33
|
+
onlyShowFrame: boolean;
|
|
34
|
+
} & {
|
|
35
|
+
setHasScrollView: (val: boolean) => void;
|
|
36
|
+
} & {
|
|
37
|
+
scope: import("@gui/create-context").Scope<SheetContextValue>;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}) => import("react/jsx-runtime").JSX.Element, useSheetContext: (consumerName: string, scope: import("@gui/create-context").Scope<SheetContextValue | undefined>, options?: {
|
|
40
|
+
warn?: boolean;
|
|
41
|
+
fallback?: Partial<SheetContextValue> | undefined;
|
|
42
|
+
} | undefined) => SheetContextValue;
|
|
43
|
+
//# sourceMappingURL=SheetContext.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SheetControllerContextValue } from './useSheetController';
|
|
3
|
+
export declare const SheetController: ({ children, onOpenChange: onOpenChangeProp, open, hidden, disableDrag, }: Partial<SheetControllerContextValue> & {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=SheetController.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { SnapPointsMode } from './types';
|
|
4
|
+
export declare const SheetImplementationCustom: React.ForwardRefExoticComponent<{
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: React.Dispatch<React.SetStateAction<boolean>> | ((open: boolean) => void);
|
|
8
|
+
position?: number;
|
|
9
|
+
defaultPosition?: number;
|
|
10
|
+
snapPoints?: (string | number)[];
|
|
11
|
+
snapPointsMode?: SnapPointsMode;
|
|
12
|
+
onPositionChange?: import("./types").PositionChangeHandler;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
dismissOnOverlayPress?: boolean;
|
|
15
|
+
dismissOnSnapToBottom?: boolean;
|
|
16
|
+
disableRemoveScroll?: boolean;
|
|
17
|
+
forceRemoveScrollEnabled?: boolean;
|
|
18
|
+
transitionConfig?: import("@gui/core").AnimatedNumberStrategy;
|
|
19
|
+
preferAdaptParentOpenState?: boolean;
|
|
20
|
+
unmountChildrenWhenHidden?: boolean;
|
|
21
|
+
native?: "ios"[] | boolean;
|
|
22
|
+
transition?: import("@gui/core").TransitionProp;
|
|
23
|
+
handleDisableScroll?: boolean;
|
|
24
|
+
disableDrag?: boolean;
|
|
25
|
+
modal?: boolean;
|
|
26
|
+
zIndex?: number;
|
|
27
|
+
portalProps?: import("@gui/portal").PortalProps;
|
|
28
|
+
moveOnKeyboardChange?: boolean;
|
|
29
|
+
containerComponent?: React.ComponentType<any>;
|
|
30
|
+
onAnimationComplete?: (info: {
|
|
31
|
+
open: boolean;
|
|
32
|
+
}) => void;
|
|
33
|
+
} & {
|
|
34
|
+
__scopeSheet?: import("@gui/create-context").Scope<any>;
|
|
35
|
+
} & React.RefAttributes<View>>;
|
|
36
|
+
//# sourceMappingURL=SheetImplementationCustom.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ScrollView as RNScrollView } from 'react-native';
|
|
3
|
+
export declare const SheetScrollView: React.ForwardRefExoticComponent<Omit<import("@gui/core").GuiComponentPropsBaseBase & import("react-native").ScrollViewProps, keyof import("@gui/core").StackStyleBase | "fullscreen" | "contentContainerStyle"> & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
4
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof RNScrollView, {
|
|
5
|
+
accept: {
|
|
6
|
+
readonly contentContainerStyle: "style";
|
|
7
|
+
};
|
|
8
|
+
}>> | undefined;
|
|
9
|
+
}> & {
|
|
10
|
+
fullscreen?: boolean | undefined;
|
|
11
|
+
} & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
12
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof RNScrollView, {
|
|
13
|
+
accept: {
|
|
14
|
+
readonly contentContainerStyle: "style";
|
|
15
|
+
};
|
|
16
|
+
}>> | undefined;
|
|
17
|
+
}>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
18
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof RNScrollView, {
|
|
19
|
+
accept: {
|
|
20
|
+
readonly contentContainerStyle: "style";
|
|
21
|
+
};
|
|
22
|
+
}>> | undefined;
|
|
23
|
+
}> & {
|
|
24
|
+
fullscreen?: boolean | undefined;
|
|
25
|
+
} & import("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase & {
|
|
26
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof RNScrollView, {
|
|
27
|
+
accept: {
|
|
28
|
+
readonly contentContainerStyle: "style";
|
|
29
|
+
};
|
|
30
|
+
}>> | undefined;
|
|
31
|
+
}>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase & {
|
|
32
|
+
readonly contentContainerStyle?: Partial<import("@gui/core").InferStyleProps<typeof RNScrollView, {
|
|
33
|
+
accept: {
|
|
34
|
+
readonly contentContainerStyle: "style";
|
|
35
|
+
};
|
|
36
|
+
}>> | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
fullscreen?: boolean | undefined;
|
|
39
|
+
}>> & React.RefAttributes<RNScrollView>>;
|
|
40
|
+
//# sourceMappingURL=SheetScrollView.d.ts.map
|