@hanzogui/sheet 2.0.0-rc.41-hanzoai.3
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/.turbo/turbo-build.log +2 -0
- 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 +54 -0
- package/dist/cjs/GestureDetectorWrapper.native.js +58 -0
- package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -0
- package/dist/cjs/GestureSheetContext.cjs +54 -0
- package/dist/cjs/GestureSheetContext.native.js +58 -0
- package/dist/cjs/GestureSheetContext.native.js.map +1 -0
- package/dist/cjs/Sheet.cjs +119 -0
- package/dist/cjs/Sheet.native.js +122 -0
- package/dist/cjs/Sheet.native.js.map +1 -0
- package/dist/cjs/SheetContext.cjs +34 -0
- package/dist/cjs/SheetContext.native.js +37 -0
- package/dist/cjs/SheetContext.native.js.map +1 -0
- package/dist/cjs/SheetController.cjs +73 -0
- package/dist/cjs/SheetController.native.js +79 -0
- package/dist/cjs/SheetController.native.js.map +1 -0
- package/dist/cjs/SheetImplementationCustom.cjs +589 -0
- package/dist/cjs/SheetImplementationCustom.native.js +615 -0
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -0
- package/dist/cjs/SheetScrollView.cjs +216 -0
- package/dist/cjs/SheetScrollView.native.js +223 -0
- package/dist/cjs/SheetScrollView.native.js.map +1 -0
- package/dist/cjs/constants.cjs +34 -0
- package/dist/cjs/constants.native.js +37 -0
- package/dist/cjs/constants.native.js.map +1 -0
- package/dist/cjs/contexts.cjs +44 -0
- package/dist/cjs/contexts.native.js +47 -0
- package/dist/cjs/contexts.native.js.map +1 -0
- package/dist/cjs/controller.cjs +31 -0
- package/dist/cjs/controller.native.js +34 -0
- package/dist/cjs/controller.native.js.map +1 -0
- package/dist/cjs/createSheet.cjs +190 -0
- package/dist/cjs/createSheet.native.js +200 -0
- package/dist/cjs/createSheet.native.js.map +1 -0
- package/dist/cjs/gestureState.cjs +41 -0
- package/dist/cjs/gestureState.native.js +44 -0
- package/dist/cjs/gestureState.native.js.map +1 -0
- package/dist/cjs/helpers.cjs +35 -0
- package/dist/cjs/helpers.native.js +39 -0
- package/dist/cjs/helpers.native.js.map +1 -0
- package/dist/cjs/index.cjs +30 -0
- package/dist/cjs/index.native.js +33 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/nativeSheet.cjs +96 -0
- package/dist/cjs/nativeSheet.native.js +106 -0
- package/dist/cjs/nativeSheet.native.js.map +1 -0
- package/dist/cjs/setupGestureHandler.cjs +52 -0
- package/dist/cjs/setupGestureHandler.native.js +55 -0
- package/dist/cjs/setupGestureHandler.native.js.map +1 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/useGestureHandlerPan.cjs +206 -0
- package/dist/cjs/useGestureHandlerPan.native.js +213 -0
- package/dist/cjs/useGestureHandlerPan.native.js.map +1 -0
- package/dist/cjs/useKeyboardControllerSheet.cjs +40 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js +132 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -0
- package/dist/cjs/useSheet.cjs +29 -0
- package/dist/cjs/useSheet.native.js +34 -0
- package/dist/cjs/useSheet.native.js.map +1 -0
- package/dist/cjs/useSheetController.cjs +52 -0
- package/dist/cjs/useSheetController.native.js +55 -0
- package/dist/cjs/useSheetController.native.js.map +1 -0
- package/dist/cjs/useSheetOffscreenSize.cjs +63 -0
- package/dist/cjs/useSheetOffscreenSize.native.js +70 -0
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -0
- package/dist/cjs/useSheetOpenState.cjs +52 -0
- package/dist/cjs/useSheetOpenState.native.js +58 -0
- package/dist/cjs/useSheetOpenState.native.js.map +1 -0
- package/dist/cjs/useSheetProviderProps.cjs +181 -0
- package/dist/cjs/useSheetProviderProps.native.js +196 -0
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -0
- package/dist/cjs/useSheetScrollViewGestures.cjs +166 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js +159 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -0
- package/dist/esm/GestureDetectorWrapper.mjs +29 -0
- package/dist/esm/GestureDetectorWrapper.mjs.map +1 -0
- package/dist/esm/GestureDetectorWrapper.native.js +30 -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 +37 -0
- package/dist/esm/SheetController.mjs.map +1 -0
- package/dist/esm/SheetController.native.js +40 -0
- package/dist/esm/SheetController.native.js.map +1 -0
- package/dist/esm/SheetImplementationCustom.mjs +552 -0
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -0
- package/dist/esm/SheetImplementationCustom.native.js +572 -0
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -0
- package/dist/esm/SheetScrollView.mjs +180 -0
- package/dist/esm/SheetScrollView.mjs.map +1 -0
- package/dist/esm/SheetScrollView.native.js +184 -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 +165 -0
- package/dist/esm/createSheet.mjs.map +1 -0
- package/dist/esm/createSheet.native.js +172 -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 +10 -0
- package/dist/esm/helpers.mjs.map +1 -0
- package/dist/esm/helpers.native.js +11 -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 +70 -0
- package/dist/esm/nativeSheet.mjs.map +1 -0
- package/dist/esm/nativeSheet.native.js +77 -0
- package/dist/esm/nativeSheet.native.js.map +1 -0
- package/dist/esm/setupGestureHandler.mjs +26 -0
- package/dist/esm/setupGestureHandler.mjs.map +1 -0
- package/dist/esm/setupGestureHandler.native.js +26 -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 +181 -0
- package/dist/esm/useGestureHandlerPan.mjs.map +1 -0
- package/dist/esm/useGestureHandlerPan.native.js +185 -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 +104 -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 +38 -0
- package/dist/esm/useSheetOffscreenSize.mjs.map +1 -0
- package/dist/esm/useSheetOffscreenSize.native.js +42 -0
- package/dist/esm/useSheetOffscreenSize.native.js.map +1 -0
- package/dist/esm/useSheetOpenState.mjs +27 -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 +145 -0
- package/dist/esm/useSheetProviderProps.mjs.map +1 -0
- package/dist/esm/useSheetProviderProps.native.js +157 -0
- package/dist/esm/useSheetProviderProps.native.js.map +1 -0
- package/dist/esm/useSheetScrollViewGestures.mjs +141 -0
- package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -0
- package/dist/esm/useSheetScrollViewGestures.native.js +131 -0
- package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -0
- package/dist/jsx/GestureDetectorWrapper.mjs +29 -0
- package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -0
- package/dist/jsx/GestureDetectorWrapper.native.js +58 -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 +58 -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 +122 -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 +37 -0
- package/dist/jsx/SheetContext.native.js.map +1 -0
- package/dist/jsx/SheetController.mjs +37 -0
- package/dist/jsx/SheetController.mjs.map +1 -0
- package/dist/jsx/SheetController.native.js +79 -0
- package/dist/jsx/SheetController.native.js.map +1 -0
- package/dist/jsx/SheetImplementationCustom.mjs +552 -0
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -0
- package/dist/jsx/SheetImplementationCustom.native.js +615 -0
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -0
- package/dist/jsx/SheetScrollView.mjs +180 -0
- package/dist/jsx/SheetScrollView.mjs.map +1 -0
- package/dist/jsx/SheetScrollView.native.js +223 -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 +37 -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 +47 -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 +34 -0
- package/dist/jsx/controller.native.js.map +1 -0
- package/dist/jsx/createSheet.mjs +165 -0
- package/dist/jsx/createSheet.mjs.map +1 -0
- package/dist/jsx/createSheet.native.js +200 -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 +44 -0
- package/dist/jsx/gestureState.native.js.map +1 -0
- package/dist/jsx/helpers.mjs +10 -0
- package/dist/jsx/helpers.mjs.map +1 -0
- package/dist/jsx/helpers.native.js +39 -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 +33 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/dist/jsx/nativeSheet.mjs +70 -0
- package/dist/jsx/nativeSheet.mjs.map +1 -0
- package/dist/jsx/nativeSheet.native.js +106 -0
- package/dist/jsx/nativeSheet.native.js.map +1 -0
- package/dist/jsx/setupGestureHandler.mjs +26 -0
- package/dist/jsx/setupGestureHandler.mjs.map +1 -0
- package/dist/jsx/setupGestureHandler.native.js +55 -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 +21 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/dist/jsx/useGestureHandlerPan.mjs +181 -0
- package/dist/jsx/useGestureHandlerPan.mjs.map +1 -0
- package/dist/jsx/useGestureHandlerPan.native.js +213 -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 +132 -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 +34 -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 +55 -0
- package/dist/jsx/useSheetController.native.js.map +1 -0
- package/dist/jsx/useSheetOffscreenSize.mjs +38 -0
- package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -0
- package/dist/jsx/useSheetOffscreenSize.native.js +70 -0
- package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -0
- package/dist/jsx/useSheetOpenState.mjs +27 -0
- package/dist/jsx/useSheetOpenState.mjs.map +1 -0
- package/dist/jsx/useSheetOpenState.native.js +58 -0
- package/dist/jsx/useSheetOpenState.native.js.map +1 -0
- package/dist/jsx/useSheetProviderProps.mjs +145 -0
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -0
- package/dist/jsx/useSheetProviderProps.native.js +196 -0
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -0
- package/dist/jsx/useSheetScrollViewGestures.mjs +141 -0
- package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js +159 -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 +47 -0
- package/src/SheetImplementationCustom.tsx +879 -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 +31 -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/GestureDetectorWrapper.d.ts.map +1 -0
- package/types/GestureSheetContext.d.ts +36 -0
- package/types/GestureSheetContext.d.ts.map +1 -0
- package/types/Sheet.d.ts +183 -0
- package/types/Sheet.d.ts.map +1 -0
- package/types/SheetContext.d.ts +43 -0
- package/types/SheetContext.d.ts.map +1 -0
- package/types/SheetController.d.ts +6 -0
- package/types/SheetController.d.ts.map +1 -0
- package/types/SheetImplementationCustom.d.ts +36 -0
- package/types/SheetImplementationCustom.d.ts.map +1 -0
- package/types/SheetScrollView.d.ts +40 -0
- package/types/SheetScrollView.d.ts.map +1 -0
- package/types/constants.d.ts +5 -0
- package/types/constants.d.ts.map +1 -0
- package/types/contexts.d.ts +6 -0
- package/types/contexts.d.ts.map +1 -0
- package/types/controller.d.ts +3 -0
- package/types/controller.d.ts.map +1 -0
- package/types/createSheet.d.ts +194 -0
- package/types/createSheet.d.ts.map +1 -0
- package/types/gestureState.d.ts +11 -0
- package/types/gestureState.d.ts.map +1 -0
- package/types/helpers.d.ts +2 -0
- package/types/helpers.d.ts.map +1 -0
- package/types/index.d.ts +12 -0
- package/types/index.d.ts.map +1 -0
- package/types/nativeSheet.d.ts +10 -0
- package/types/nativeSheet.d.ts.map +1 -0
- package/types/setupGestureHandler.d.ts +11 -0
- package/types/setupGestureHandler.d.ts.map +1 -0
- package/types/types.d.ts +147 -0
- package/types/types.d.ts.map +1 -0
- package/types/useGestureHandlerPan.d.ts +44 -0
- package/types/useGestureHandlerPan.d.ts.map +1 -0
- package/types/useKeyboardControllerSheet.d.ts +7 -0
- package/types/useKeyboardControllerSheet.d.ts.map +1 -0
- package/types/useKeyboardControllerSheet.native.d.ts +13 -0
- package/types/useKeyboardControllerSheet.native.d.ts.map +1 -0
- package/types/useSheet.d.ts +2 -0
- package/types/useSheet.d.ts.map +1 -0
- package/types/useSheetController.d.ts +20 -0
- package/types/useSheetController.d.ts.map +1 -0
- package/types/useSheetOffscreenSize.d.ts +3 -0
- package/types/useSheetOffscreenSize.d.ts.map +1 -0
- package/types/useSheetOpenState.d.ts +9 -0
- package/types/useSheetOpenState.d.ts.map +1 -0
- package/types/useSheetProviderProps.d.ts +36 -0
- package/types/useSheetProviderProps.d.ts.map +1 -0
- package/types/useSheetScrollViewGestures.d.ts +12 -0
- package/types/useSheetScrollViewGestures.d.ts.map +1 -0
- package/types/useSheetScrollViewGestures.native.d.ts +21 -0
- package/types/useSheetScrollViewGestures.native.d.ts.map +1 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var useSheetScrollViewGestures_native_exports = {};
|
|
26
|
+
__export(useSheetScrollViewGestures_native_exports, {
|
|
27
|
+
useSheetScrollViewGestures: () => useSheetScrollViewGestures
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useSheetScrollViewGestures_native_exports);
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
function useSheetScrollViewGestures(param) {
|
|
32
|
+
var {
|
|
33
|
+
scrollBridge,
|
|
34
|
+
hasScrollableContent,
|
|
35
|
+
scrollEnabled,
|
|
36
|
+
setScrollEnabled
|
|
37
|
+
} = param;
|
|
38
|
+
var state = (0, import_react.useRef)({
|
|
39
|
+
lastPageY: 0,
|
|
40
|
+
dragAt: 0,
|
|
41
|
+
dys: [],
|
|
42
|
+
isScrolling: false,
|
|
43
|
+
isDraggingScrollArea: false,
|
|
44
|
+
scrollEngaged: false,
|
|
45
|
+
prevScrollY: 0,
|
|
46
|
+
handoffOccurred: false,
|
|
47
|
+
handoffDragOffset: 0
|
|
48
|
+
});
|
|
49
|
+
var release = function () {
|
|
50
|
+
var s = state.current;
|
|
51
|
+
if (!s.isDraggingScrollArea) return;
|
|
52
|
+
s.isDraggingScrollArea = false;
|
|
53
|
+
scrollBridge.scrollStartY = -1;
|
|
54
|
+
scrollBridge.scrollLock = false;
|
|
55
|
+
s.isScrolling = false;
|
|
56
|
+
s.scrollEngaged = false;
|
|
57
|
+
s.prevScrollY = 0;
|
|
58
|
+
s.handoffOccurred = false;
|
|
59
|
+
s.handoffDragOffset = 0;
|
|
60
|
+
setScrollEnabled(true);
|
|
61
|
+
var vy = 0;
|
|
62
|
+
if (s.dys.length) {
|
|
63
|
+
var recentDys = s.dys.slice(-10);
|
|
64
|
+
var dist = recentDys.reduce(function (a, b) {
|
|
65
|
+
return a + b;
|
|
66
|
+
}, 0);
|
|
67
|
+
vy = dist / recentDys.length * 0.04;
|
|
68
|
+
}
|
|
69
|
+
s.dys = [];
|
|
70
|
+
scrollBridge.release({
|
|
71
|
+
dragAt: s.dragAt,
|
|
72
|
+
vy
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var onStartShouldSetResponder = function () {
|
|
76
|
+
var s = state.current;
|
|
77
|
+
scrollBridge.scrollStartY = -1;
|
|
78
|
+
s.isDraggingScrollArea = true;
|
|
79
|
+
s.scrollEngaged = scrollBridge.y > 0;
|
|
80
|
+
s.prevScrollY = scrollBridge.y;
|
|
81
|
+
s.handoffOccurred = false;
|
|
82
|
+
s.handoffDragOffset = 0;
|
|
83
|
+
return false;
|
|
84
|
+
};
|
|
85
|
+
var onMoveShouldSetResponder = function (e) {
|
|
86
|
+
if (!scrollEnabled) return false;
|
|
87
|
+
var s = state.current;
|
|
88
|
+
var {
|
|
89
|
+
pageY
|
|
90
|
+
} = e.nativeEvent;
|
|
91
|
+
if (s.lastPageY === 0) {
|
|
92
|
+
s.lastPageY = pageY;
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return Math.abs(pageY - s.lastPageY) > 10;
|
|
96
|
+
};
|
|
97
|
+
var onResponderMove = function (e) {
|
|
98
|
+
var s = state.current;
|
|
99
|
+
var {
|
|
100
|
+
pageY
|
|
101
|
+
} = e.nativeEvent;
|
|
102
|
+
if (!s.isScrolling && scrollBridge.scrollStartY === -1) {
|
|
103
|
+
scrollBridge.scrollStartY = pageY;
|
|
104
|
+
s.lastPageY = pageY;
|
|
105
|
+
}
|
|
106
|
+
var dragAt = pageY - scrollBridge.scrollStartY;
|
|
107
|
+
var dy = pageY - s.lastPageY;
|
|
108
|
+
s.lastPageY = pageY;
|
|
109
|
+
var isDraggingDown = dy > 0;
|
|
110
|
+
var isPaneAtTop = scrollBridge.paneY <= scrollBridge.paneMinY + 5;
|
|
111
|
+
var currentScrollY = scrollBridge.y;
|
|
112
|
+
if (currentScrollY > 0) s.scrollEngaged = true;
|
|
113
|
+
var wasScrolledNowAtZero = s.scrollEngaged && s.prevScrollY > 0 && currentScrollY <= 0;
|
|
114
|
+
if (wasScrolledNowAtZero && !s.handoffOccurred) {
|
|
115
|
+
s.handoffOccurred = true;
|
|
116
|
+
s.handoffDragOffset = 0;
|
|
117
|
+
}
|
|
118
|
+
s.prevScrollY = currentScrollY;
|
|
119
|
+
var panHandles = false;
|
|
120
|
+
if (!isPaneAtTop) {
|
|
121
|
+
panHandles = isDraggingDown ? currentScrollY <= 0 || !hasScrollableContent : true;
|
|
122
|
+
} else if (isDraggingDown) {
|
|
123
|
+
if (currentScrollY > 0 && hasScrollableContent && !s.handoffOccurred) {
|
|
124
|
+
panHandles = false;
|
|
125
|
+
} else {
|
|
126
|
+
panHandles = s.handoffOccurred || wasScrolledNowAtZero || currentScrollY <= 0;
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
panHandles = !hasScrollableContent;
|
|
130
|
+
if (!panHandles) {
|
|
131
|
+
s.isScrolling = true;
|
|
132
|
+
scrollBridge.scrollLock = true;
|
|
133
|
+
setScrollEnabled(true);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (panHandles) {
|
|
138
|
+
setScrollEnabled(false);
|
|
139
|
+
var effectiveDragAt = dragAt;
|
|
140
|
+
if (s.handoffOccurred) {
|
|
141
|
+
s.handoffDragOffset += dy;
|
|
142
|
+
effectiveDragAt = s.handoffDragOffset;
|
|
143
|
+
}
|
|
144
|
+
scrollBridge.drag(effectiveDragAt);
|
|
145
|
+
s.dragAt = effectiveDragAt;
|
|
146
|
+
s.dys.push(dy);
|
|
147
|
+
if (s.dys.length > 100) s.dys = s.dys.slice(-10);
|
|
148
|
+
} else {
|
|
149
|
+
setScrollEnabled(true);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
onResponderRelease: release,
|
|
154
|
+
onStartShouldSetResponder,
|
|
155
|
+
onMoveShouldSetResponder,
|
|
156
|
+
onResponderMove
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=useSheetScrollViewGestures.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSheetScrollViewGestures_native_exports","__export","useSheetScrollViewGestures","module","exports","__toCommonJS","import_react","require","param","scrollBridge","hasScrollableContent","scrollEnabled","setScrollEnabled","state","useRef","lastPageY","dragAt","dys","isScrolling","isDraggingScrollArea","scrollEngaged","prevScrollY","handoffOccurred","handoffDragOffset","release","s","current","scrollStartY","scrollLock","vy","length","recentDys","slice","dist","reduce","a","b","onStartShouldSetResponder","y","onMoveShouldSetResponder","e","pageY","nativeEvent","Math","abs","onResponderMove","dy","isDraggingDown","isPaneAtTop","paneY","paneMinY","currentScrollY","wasScrolledNowAtZero","panHandles","effectiveDragAt","drag","push","onResponderRelease"],"sources":["../../src/useSheetScrollViewGestures.native.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yCAAA;AAAAC,QAAA,CAAAD,yCAAA;EAAAE,0BAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,yCAAA;AAAA,IAAAM,YAAA,GAAuBC,OAAA;AAIZ,SAASL,2BAA2BM,KAAA,EAAO;EAClD,IAAI;IAAEC,YAAA;IAAcC,oBAAA;IAAsBC,aAAA;IAAeC;EAAiB,IAAIJ,KAAA;EAC9E,IAAIK,KAAA,OAAQP,YAAA,CAAAQ,MAAA,EAAO;IACfC,SAAA,EAAW;IACXC,MAAA,EAAQ;IACRC,GAAA,EAAK,EAAC;IACNC,WAAA,EAAa;IACbC,oBAAA,EAAsB;IACtBC,aAAA,EAAe;IACfC,WAAA,EAAa;IACbC,eAAA,EAAiB;IACjBC,iBAAA,EAAmB;EACvB,CAAC;EACD,IAAIC,OAAA,GAAU,SAAAA,CAAA,EAAW;IACrB,IAAIC,CAAA,GAAIZ,KAAA,CAAMa,OAAA;IACd,IAAI,CAACD,CAAA,CAAEN,oBAAA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":[]}
|
package/next.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Sheet ScrollView Gesture Handoff - Next Steps
|
|
2
|
+
|
|
3
|
+
## Current Limitation
|
|
4
|
+
|
|
5
|
+
The Sheet + ScrollView gesture coordination on native iOS has limitations because Hanzogui uses React Native's built-in `PanResponder`, while iOS's `UIScrollView` gesture recognizers fire BEFORE the RN responder system can claim the gesture.
|
|
6
|
+
|
|
7
|
+
This causes:
|
|
8
|
+
|
|
9
|
+
- Minor scroll "flicker" when starting to drag down from scroll top
|
|
10
|
+
- Imperfect handoff between scroll and sheet drag gestures
|
|
11
|
+
|
|
12
|
+
## Ideal Solution: react-native-gesture-handler Integration
|
|
13
|
+
|
|
14
|
+
Both `gorhom/bottom-sheet` and `react-native-actions-sheet` solve this by using `react-native-gesture-handler` which provides:
|
|
15
|
+
|
|
16
|
+
1. **`simultaneousHandlers`** - allows coordinating multiple gesture recognizers
|
|
17
|
+
2. **`GestureDetector`** with worklets - can check conditions and decide who handles gesture before it starts
|
|
18
|
+
3. **Native gesture coordination** - works at the iOS/Android gesture recognizer level, not the JS responder level
|
|
19
|
+
|
|
20
|
+
## Proposed API
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { setupGestureHandler } from '@hanzogui/sheet'
|
|
24
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
|
25
|
+
|
|
26
|
+
// Call once at app startup (optional - falls back to PanResponder)
|
|
27
|
+
setupGestureHandler({
|
|
28
|
+
// Pass the gesture handler module so we don't add it as a hard dependency
|
|
29
|
+
GestureDetector: require('react-native-gesture-handler').GestureDetector,
|
|
30
|
+
Gesture: require('react-native-gesture-handler').Gesture,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// Then wrap app
|
|
34
|
+
export default function App() {
|
|
35
|
+
return (
|
|
36
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
37
|
+
<YourApp />
|
|
38
|
+
</GestureHandlerRootView>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Implementation Notes
|
|
44
|
+
|
|
45
|
+
If `setupGestureHandler()` is called:
|
|
46
|
+
|
|
47
|
+
- Use `GestureDetector` with `Gesture.Pan()` instead of `PanResponder`
|
|
48
|
+
- Use `simultaneousHandlers` to coordinate with ScrollView's gesture
|
|
49
|
+
- Implement `blockPan` flag pattern from actions-sheet for smooth handoff
|
|
50
|
+
|
|
51
|
+
If not called:
|
|
52
|
+
|
|
53
|
+
- Fall back to current `PanResponder` implementation
|
|
54
|
+
- Accept the minor limitations on native
|
|
55
|
+
|
|
56
|
+
## References
|
|
57
|
+
|
|
58
|
+
- gorhom/bottom-sheet: Uses Reanimated worklets + gesture handler
|
|
59
|
+
- react-native-actions-sheet: Uses `blockPan` flag pattern with gesture handler
|
|
60
|
+
- Both are MIT licensed and can be used as reference
|
|
61
|
+
|
|
62
|
+
## Files to Modify
|
|
63
|
+
|
|
64
|
+
- `SheetImplementationCustom.tsx` - Replace PanResponder with GestureDetector
|
|
65
|
+
- `SheetScrollView.tsx` - Use `useScrollHandlers()` pattern from actions-sheet
|
|
66
|
+
- Add `setupGestureHandler.ts` for optional gesture handler registration
|
|
67
|
+
|
|
68
|
+
## Test Case
|
|
69
|
+
|
|
70
|
+
There's a test case at `code/kitchen-sink/src/usecases/SheetScrollableDrag.tsx` that demonstrates the bug and can be used to verify fixes. It's not exported in the main navigation but can be accessed directly for testing.
|
|
71
|
+
|
|
72
|
+
## Attempted Fixes
|
|
73
|
+
|
|
74
|
+
1. **Native scroll enable/disable based on pane position** - Tried disabling scroll when sheet is not at top position, but this completely broke scrolling because the initial pane position values aren't set correctly on mount.
|
|
75
|
+
|
|
76
|
+
2. **PaneY change listeners** - Added `onPaneYChange`/`setPaneY` to ScrollBridge to notify ScrollView of position changes during drag, but the fundamental issue remains that iOS UIScrollView gesture recognizers fire before RN's responder system.
|
|
77
|
+
|
|
78
|
+
The core issue is architectural: React Native's PanResponder cannot coordinate with iOS's native UIScrollView gesture recognizers at the right level. The only real solution is `react-native-gesture-handler` integration.
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hanzogui/sheet",
|
|
3
|
+
"version": "2.0.0-rc.41-hanzoai.3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"source": "src/index.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"*.css"
|
|
9
|
+
],
|
|
10
|
+
"main": "dist/cjs",
|
|
11
|
+
"module": "dist/esm",
|
|
12
|
+
"types": "./types/index.d.ts",
|
|
13
|
+
"typesVersions": {
|
|
14
|
+
"*": {
|
|
15
|
+
"setup-gesture-handler": [
|
|
16
|
+
"./types/setupGestureHandler.d.ts"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./types/index.d.ts",
|
|
24
|
+
"react-native": "./dist/esm/index.native.js",
|
|
25
|
+
"browser": "./dist/esm/index.mjs",
|
|
26
|
+
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"import": "./dist/esm/index.mjs",
|
|
28
|
+
"require": "./dist/cjs/index.cjs",
|
|
29
|
+
"default": "./dist/esm/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./controller": {
|
|
32
|
+
"types": "./types/controller.d.ts",
|
|
33
|
+
"react-native": "./dist/esm/controller.native.js",
|
|
34
|
+
"browser": "./dist/esm/controller.mjs",
|
|
35
|
+
"module": "./dist/esm/controller.mjs",
|
|
36
|
+
"import": "./dist/esm/controller.mjs",
|
|
37
|
+
"require": "./dist/cjs/controller.cjs",
|
|
38
|
+
"default": "./dist/cjs/controller.native.js"
|
|
39
|
+
},
|
|
40
|
+
"./setup-gesture-handler": {
|
|
41
|
+
"types": "./types/setupGestureHandler.d.ts",
|
|
42
|
+
"react-native": "./dist/esm/setupGestureHandler.native.js",
|
|
43
|
+
"browser": "./dist/esm/setupGestureHandler.mjs",
|
|
44
|
+
"module": "./dist/esm/setupGestureHandler.mjs",
|
|
45
|
+
"import": "./dist/esm/setupGestureHandler.mjs",
|
|
46
|
+
"require": "./dist/cjs/setupGestureHandler.cjs",
|
|
47
|
+
"default": "./dist/esm/setupGestureHandler.mjs"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "hanzogui-build",
|
|
55
|
+
"watch": "hanzogui-build --watch",
|
|
56
|
+
"clean": "hanzogui-build clean"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@hanzogui/adapt": "2.0.0-rc.41-hanzoai.3",
|
|
60
|
+
"@hanzogui/animate-presence": "2.0.0-rc.41-hanzoai.3",
|
|
61
|
+
"@hanzogui/animations-react-native": "2.0.0-rc.41-hanzoai.3",
|
|
62
|
+
"@hanzogui/compose-refs": "2.0.0-rc.41-hanzoai.3",
|
|
63
|
+
"@hanzogui/constants": "2.0.0-rc.41-hanzoai.3",
|
|
64
|
+
"@hanzogui/core": "2.0.0-rc.41-hanzoai.3",
|
|
65
|
+
"@hanzogui/create-context": "2.0.0-rc.41-hanzoai.3",
|
|
66
|
+
"@hanzogui/helpers": "2.0.0-rc.41-hanzoai.3",
|
|
67
|
+
"@hanzogui/native": "2.0.0-rc.41-hanzoai.3",
|
|
68
|
+
"@hanzogui/portal": "2.0.0-rc.41-hanzoai.3",
|
|
69
|
+
"@hanzogui/remove-scroll": "2.0.0-rc.41-hanzoai.3",
|
|
70
|
+
"@hanzogui/scroll-view": "2.0.0-rc.41-hanzoai.3",
|
|
71
|
+
"@hanzogui/stacks": "2.0.0-rc.41-hanzoai.3",
|
|
72
|
+
"@hanzogui/use-constant": "2.0.0-rc.41-hanzoai.3",
|
|
73
|
+
"@hanzogui/use-controllable-state": "2.0.0-rc.41-hanzoai.3",
|
|
74
|
+
"@hanzogui/use-did-finish-ssr": "2.0.0-rc.41-hanzoai.3",
|
|
75
|
+
"@hanzogui/use-keyboard-visible": "2.0.0-rc.41-hanzoai.3",
|
|
76
|
+
"@hanzogui/z-index-stack": "2.0.0-rc.41-hanzoai.3"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@hanzogui/build": "2.0.0-rc.41-hanzoai.3",
|
|
80
|
+
"react": ">=19",
|
|
81
|
+
"react-native": "0.83.2",
|
|
82
|
+
"react-native-gesture-handler": "~2.30.0"
|
|
83
|
+
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"react": ">=19",
|
|
86
|
+
"react-native": "*",
|
|
87
|
+
"react-native-gesture-handler": ">=2.0.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependenciesMeta": {
|
|
90
|
+
"react-native-gesture-handler": {
|
|
91
|
+
"optional": true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"module:jsx": "dist/jsx",
|
|
95
|
+
"removeSideEffects": true
|
|
96
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.assign(module.exports, require('./dist/cjs/setupGestureHandler.cjs'))
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
import { View, type ViewStyle } from 'react-native'
|
|
3
|
+
import { getGestureHandlerState, isGestureHandlerEnabled } from './gestureState'
|
|
4
|
+
|
|
5
|
+
interface GestureDetectorWrapperProps {
|
|
6
|
+
gesture: any
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
style?: ViewStyle
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Conditionally wraps children with GestureDetector when RNGH is available.
|
|
13
|
+
* Uses a plain View wrapper that GestureDetector can attach gesture handlers to.
|
|
14
|
+
*/
|
|
15
|
+
export function GestureDetectorWrapper({
|
|
16
|
+
gesture,
|
|
17
|
+
children,
|
|
18
|
+
style,
|
|
19
|
+
}: GestureDetectorWrapperProps) {
|
|
20
|
+
const { GestureDetector } = getGestureHandlerState()
|
|
21
|
+
const enabled = isGestureHandlerEnabled()
|
|
22
|
+
|
|
23
|
+
// console.warn('[RNGH-Wrapper] enabled:', enabled, 'hasDetector:', !!GestureDetector, 'hasGesture:', !!gesture)
|
|
24
|
+
|
|
25
|
+
// only wrap if we have RNGH available AND a gesture to attach
|
|
26
|
+
if (enabled && GestureDetector && gesture) {
|
|
27
|
+
// GestureDetector needs a native View to attach handlers to
|
|
28
|
+
// the View wrapper ensures proper gesture propagation
|
|
29
|
+
// console.warn('[RNGH-Wrapper] WRAPPING')
|
|
30
|
+
return (
|
|
31
|
+
<GestureDetector gesture={gesture}>
|
|
32
|
+
<View style={style} collapsable={false}>
|
|
33
|
+
{children}
|
|
34
|
+
</View>
|
|
35
|
+
</GestureDetector>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// pass through children in a consistent View wrapper
|
|
40
|
+
return <View style={style}>{children}</View>
|
|
41
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
import { createContext, useContext, type RefObject } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface GestureSheetContextValue {
|
|
5
|
+
/**
|
|
6
|
+
* The sheet's pan gesture object, used for simultaneousHandlers
|
|
7
|
+
* in ScrollView to coordinate gestures
|
|
8
|
+
*/
|
|
9
|
+
panGesture: any | null
|
|
10
|
+
/**
|
|
11
|
+
* Ref to the pan gesture for simultaneousHandlers prop
|
|
12
|
+
*/
|
|
13
|
+
panGestureRef: RefObject<any> | null
|
|
14
|
+
/**
|
|
15
|
+
* Whether the sheet is currently being dragged by the user
|
|
16
|
+
*/
|
|
17
|
+
isDragging: boolean
|
|
18
|
+
/**
|
|
19
|
+
* Set whether panning should be blocked (e.g., when scrolling)
|
|
20
|
+
*/
|
|
21
|
+
setBlockPan: (blocked: boolean) => void
|
|
22
|
+
/**
|
|
23
|
+
* Whether pan gesture is currently blocked
|
|
24
|
+
*/
|
|
25
|
+
blockPan: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const GestureSheetContext = createContext<GestureSheetContextValue | null>(null)
|
|
29
|
+
|
|
30
|
+
export function useGestureSheetContext(): GestureSheetContextValue | null {
|
|
31
|
+
return useContext(GestureSheetContext)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface GestureSheetProviderProps {
|
|
35
|
+
children: React.ReactNode
|
|
36
|
+
isDragging: boolean
|
|
37
|
+
blockPan: boolean
|
|
38
|
+
setBlockPan: (blocked: boolean) => void
|
|
39
|
+
panGesture: any | null
|
|
40
|
+
panGestureRef: RefObject<any> | null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function GestureSheetProvider({
|
|
44
|
+
children,
|
|
45
|
+
isDragging,
|
|
46
|
+
blockPan,
|
|
47
|
+
setBlockPan,
|
|
48
|
+
panGesture,
|
|
49
|
+
panGestureRef,
|
|
50
|
+
}: GestureSheetProviderProps) {
|
|
51
|
+
const value: GestureSheetContextValue = {
|
|
52
|
+
panGesture,
|
|
53
|
+
panGestureRef,
|
|
54
|
+
isDragging,
|
|
55
|
+
blockPan,
|
|
56
|
+
setBlockPan,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<GestureSheetContext.Provider value={value}>{children}</GestureSheetContext.Provider>
|
|
61
|
+
)
|
|
62
|
+
}
|
package/src/Sheet.tsx
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { styled } from '@hanzogui/core'
|
|
2
|
+
import { XStack, YStack } from '@hanzogui/stacks'
|
|
3
|
+
|
|
4
|
+
import { SHEET_HANDLE_NAME, SHEET_NAME, SHEET_OVERLAY_NAME } from './constants'
|
|
5
|
+
import { createSheet } from './createSheet'
|
|
6
|
+
|
|
7
|
+
export { createSheetScope } from './SheetContext'
|
|
8
|
+
export * from './types'
|
|
9
|
+
|
|
10
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11
|
+
* SheetHandle
|
|
12
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
13
|
+
|
|
14
|
+
export const Handle = styled(XStack, {
|
|
15
|
+
name: SHEET_HANDLE_NAME,
|
|
16
|
+
|
|
17
|
+
variants: {
|
|
18
|
+
open: {
|
|
19
|
+
true: {
|
|
20
|
+
opacity: 1,
|
|
21
|
+
pointerEvents: 'auto',
|
|
22
|
+
},
|
|
23
|
+
false: {
|
|
24
|
+
opacity: 0,
|
|
25
|
+
pointerEvents: 'none',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
unstyled: {
|
|
30
|
+
false: {
|
|
31
|
+
height: 10,
|
|
32
|
+
borderRadius: 100,
|
|
33
|
+
backgroundColor: '$background',
|
|
34
|
+
zIndex: 10,
|
|
35
|
+
marginHorizontal: '35%',
|
|
36
|
+
marginBottom: '$2',
|
|
37
|
+
opacity: 0.5,
|
|
38
|
+
|
|
39
|
+
hoverStyle: {
|
|
40
|
+
opacity: 0.7,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
} as const,
|
|
45
|
+
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
unstyled: process.env.HANZOGUI_HEADLESS === '1',
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
/* -------------------------------------------------------------------------------------------------
|
|
52
|
+
* SheetOverlay
|
|
53
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
54
|
+
|
|
55
|
+
export const Overlay = styled(YStack, {
|
|
56
|
+
name: SHEET_OVERLAY_NAME,
|
|
57
|
+
|
|
58
|
+
variants: {
|
|
59
|
+
open: {
|
|
60
|
+
true: {
|
|
61
|
+
pointerEvents: 'auto',
|
|
62
|
+
},
|
|
63
|
+
false: {
|
|
64
|
+
pointerEvents: 'none',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
unstyled: {
|
|
69
|
+
false: {
|
|
70
|
+
fullscreen: true,
|
|
71
|
+
position: 'absolute',
|
|
72
|
+
backgroundColor: '$background',
|
|
73
|
+
zIndex: 100_000 - 1,
|
|
74
|
+
pointerEvents: 'auto',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
} as const,
|
|
78
|
+
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
unstyled: process.env.HANZOGUI_HEADLESS === '1',
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
/* -------------------------------------------------------------------------------------------------
|
|
85
|
+
* Sheet
|
|
86
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
87
|
+
|
|
88
|
+
export const Frame = styled(YStack, {
|
|
89
|
+
name: SHEET_NAME,
|
|
90
|
+
|
|
91
|
+
variants: {
|
|
92
|
+
unstyled: {
|
|
93
|
+
false: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
backgroundColor: '$background',
|
|
96
|
+
borderTopLeftRadius: '$true',
|
|
97
|
+
borderTopRightRadius: '$true',
|
|
98
|
+
width: '100%',
|
|
99
|
+
maxHeight: '100%',
|
|
100
|
+
overflow: 'hidden',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
} as const,
|
|
104
|
+
|
|
105
|
+
defaultVariants: {
|
|
106
|
+
unstyled: process.env.HANZOGUI_HEADLESS === '1',
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
export const Sheet = createSheet({
|
|
111
|
+
Frame,
|
|
112
|
+
Handle,
|
|
113
|
+
Overlay,
|
|
114
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContextScope } from '@hanzogui/create-context'
|
|
2
|
+
|
|
3
|
+
import { SHEET_NAME } from './constants'
|
|
4
|
+
import type { SheetContextValue } from './useSheetProviderProps'
|
|
5
|
+
|
|
6
|
+
export const [createSheetContext, createSheetScope] = createContextScope(SHEET_NAME)
|
|
7
|
+
|
|
8
|
+
export const [SheetProvider, useSheetContext] = createSheetContext<SheetContextValue>(
|
|
9
|
+
SHEET_NAME,
|
|
10
|
+
{} as any
|
|
11
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useId, useRef } from 'react'
|
|
2
|
+
import { useEvent } from '@hanzogui/core'
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
import type { SheetControllerContextValue } from './useSheetController'
|
|
6
|
+
import { SheetControllerContext } from './useSheetController'
|
|
7
|
+
|
|
8
|
+
export const SheetController = ({
|
|
9
|
+
children,
|
|
10
|
+
onOpenChange: onOpenChangeProp,
|
|
11
|
+
onAnimationComplete: onAnimationCompleteProp,
|
|
12
|
+
open,
|
|
13
|
+
hidden,
|
|
14
|
+
disableDrag,
|
|
15
|
+
}: Partial<SheetControllerContextValue> & { children?: ReactNode }) => {
|
|
16
|
+
const onOpenChange = useEvent(onOpenChangeProp)
|
|
17
|
+
const onAnimationComplete = useEvent(onAnimationCompleteProp)
|
|
18
|
+
const id = useId()
|
|
19
|
+
|
|
20
|
+
// track hidden transitions to signal adapt handoff
|
|
21
|
+
// when hidden goes from true -> false while open, the sheet should skip animation
|
|
22
|
+
const wasHiddenRef = useRef(hidden)
|
|
23
|
+
let skipNextAnimation = false
|
|
24
|
+
if (wasHiddenRef.current && !hidden && open) {
|
|
25
|
+
skipNextAnimation = true
|
|
26
|
+
}
|
|
27
|
+
wasHiddenRef.current = hidden
|
|
28
|
+
|
|
29
|
+
const memoValue = React.useMemo(
|
|
30
|
+
() => ({
|
|
31
|
+
id,
|
|
32
|
+
open,
|
|
33
|
+
hidden,
|
|
34
|
+
disableDrag,
|
|
35
|
+
onOpenChange,
|
|
36
|
+
onAnimationComplete,
|
|
37
|
+
skipNextAnimation,
|
|
38
|
+
}),
|
|
39
|
+
[id, onOpenChange, onAnimationComplete, open, hidden, disableDrag, skipNextAnimation]
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<SheetControllerContext.Provider value={memoValue}>
|
|
44
|
+
{children}
|
|
45
|
+
</SheetControllerContext.Provider>
|
|
46
|
+
)
|
|
47
|
+
}
|