react-native-gesture-handler 2.4.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -2
- package/RNGestureHandler.podspec +17 -5
- package/android/build.gradle +71 -15
- package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +2 -1
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +9 -5
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +32 -6
- package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +5 -2
- package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +105 -23
- package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +30 -2
- package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +3 -2
- package/android/src/fabric/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +74 -84
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +7 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +5 -1
- package/android/src/main/jni/CMakeLists.txt +59 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +12 -9
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +1 -0
- package/ios/Handlers/RNFlingHandler.m +43 -1
- package/ios/Handlers/{RNNativeViewHandler.m → RNNativeViewHandler.mm} +13 -1
- package/ios/Handlers/RNPanHandler.m +27 -0
- package/ios/RNGestureHandler.h +1 -0
- package/ios/RNGestureHandler.m +22 -4
- package/ios/RNGestureHandlerButtonComponentView.mm +1 -1
- package/ios/RNGestureHandlerManager.mm +10 -7
- package/ios/RNGestureHandlerModule.mm +4 -1
- package/ios/RNGestureHandlerRootViewComponentView.mm +1 -1
- package/ios/RNManualActivationRecognizer.m +10 -3
- package/ios/RNRootViewGestureRecognizer.m +12 -1
- package/lib/commonjs/EnableExperimentalWebImplementation.js +24 -0
- package/lib/commonjs/EnableExperimentalWebImplementation.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js +138 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +87 -25
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNRenderer.js +16 -0
- package/lib/commonjs/RNRenderer.js.map +1 -0
- package/lib/commonjs/RNRenderer.web.js +11 -0
- package/lib/commonjs/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/components/DrawerLayout.js +41 -12
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureButtons.js +42 -9
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +41 -4
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +7 -2
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +3 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +5 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/fabric/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +2 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +1 -1
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +14 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +33 -12
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +150 -75
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +13 -2
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +13 -9
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +5 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +7 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +6 -3
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/constants.js +3 -51
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +169 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +167 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +154 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/GestureHandler.js +538 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +147 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +116 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js +451 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +171 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +187 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js +296 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web/interfaces.js +34 -0
- package/lib/commonjs/web/interfaces.js.map +1 -0
- package/lib/commonjs/web/tools/EventManager.js +169 -0
- package/lib/commonjs/web/tools/EventManager.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +283 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/commonjs/web/tools/InteractionManager.js +102 -0
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -0
- package/lib/commonjs/web/tools/NodeManager.js +48 -0
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerTracker.js +132 -0
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -0
- package/lib/commonjs/{web → web_hammer}/DiscreteGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/DiscreteGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/DraggingGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/DraggingGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/Errors.js +0 -0
- package/lib/commonjs/{web → web_hammer}/Errors.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/FlingGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/FlingGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/GestureHandler.js +83 -42
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -0
- package/lib/commonjs/{web → web_hammer}/IndiscreteGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/IndiscreteGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/LongPressGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/LongPressGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/NativeViewGestureHandler.js +4 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/{web → web_hammer}/NodeManager.js +0 -0
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -0
- package/lib/commonjs/{web → web_hammer}/PanGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/PanGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/PinchGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/PinchGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/PressGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/PressGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/RotationGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/RotationGestureHandler.js.map +0 -0
- package/lib/commonjs/{web → web_hammer}/TapGestureHandler.js +0 -0
- package/lib/commonjs/{web → web_hammer}/TapGestureHandler.js.map +0 -0
- package/lib/commonjs/web_hammer/constants.js +64 -0
- package/lib/commonjs/web_hammer/constants.js.map +1 -0
- package/lib/commonjs/{web → web_hammer}/utils.js +0 -0
- package/lib/commonjs/{web → web_hammer}/utils.js.map +1 -1
- package/lib/module/EnableExperimentalWebImplementation.js +15 -0
- package/lib/module/EnableExperimentalWebImplementation.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.macos.js +102 -0
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.web.js +73 -24
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNRenderer.js +4 -0
- package/lib/module/RNRenderer.js.map +1 -0
- package/lib/module/RNRenderer.web.js +4 -0
- package/lib/module/RNRenderer.web.js.map +1 -0
- package/lib/module/components/DrawerLayout.js +41 -12
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureButtons.js +43 -9
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureComponents.js +39 -4
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +6 -2
- package/lib/module/components/GestureComponents.web.js.map +1 -1
- package/lib/module/components/Swipeable.js +3 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +5 -1
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/fabric/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js +1 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/module/handlers/PanGestureHandler.js +1 -1
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.js +3 -0
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/module/handlers/createHandler.js +35 -14
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +147 -74
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +13 -2
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +13 -9
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +5 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +7 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +2 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/constants.js +1 -36
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +159 -0
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js +156 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js +139 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/GestureHandler.js +521 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js +133 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +103 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PanGestureHandler.js +434 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PinchGestureHandler.js +155 -0
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/RotationGestureHandler.js +171 -0
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/TapGestureHandler.js +281 -0
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/web/interfaces.js +26 -0
- package/lib/module/web/interfaces.js.map +1 -0
- package/lib/module/web/tools/EventManager.js +160 -0
- package/lib/module/web/tools/EventManager.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +270 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/module/web/tools/InteractionManager.js +93 -0
- package/lib/module/web/tools/InteractionManager.js.map +1 -0
- package/lib/module/web/tools/NodeManager.js +39 -0
- package/lib/module/web/tools/NodeManager.js.map +1 -0
- package/lib/module/web/tools/PointerTracker.js +122 -0
- package/lib/module/web/tools/PointerTracker.js.map +1 -0
- package/lib/module/{web → web_hammer}/DiscreteGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/DiscreteGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/DraggingGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/DraggingGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/Errors.js +0 -0
- package/lib/module/{web → web_hammer}/Errors.js.map +0 -0
- package/lib/module/{web → web_hammer}/FlingGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/FlingGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/GestureHandler.js +83 -42
- package/lib/module/web_hammer/GestureHandler.js.map +1 -0
- package/lib/module/{web → web_hammer}/IndiscreteGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/IndiscreteGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/LongPressGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/LongPressGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/NativeViewGestureHandler.js +4 -0
- package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/{web → web_hammer}/NodeManager.js +0 -0
- package/lib/module/web_hammer/NodeManager.js.map +1 -0
- package/lib/module/{web → web_hammer}/PanGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/PanGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/PinchGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/PinchGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/PressGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/PressGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/RotationGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/RotationGestureHandler.js.map +0 -0
- package/lib/module/{web → web_hammer}/TapGestureHandler.js +0 -0
- package/lib/module/{web → web_hammer}/TapGestureHandler.js.map +0 -0
- package/lib/module/web_hammer/constants.js +43 -0
- package/lib/module/web_hammer/constants.js.map +1 -0
- package/lib/module/{web → web_hammer}/utils.js +0 -0
- package/lib/module/{web → web_hammer}/utils.js.map +1 -1
- package/lib/typescript/EnableExperimentalWebImplementation.d.ts +2 -0
- package/lib/typescript/RNGestureHandlerModule.macos.d.ts +44 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +29 -18
- package/lib/typescript/RNRenderer.d.ts +1 -0
- package/lib/typescript/RNRenderer.web.d.ts +3 -0
- package/lib/typescript/components/DrawerLayout.d.ts +4 -1
- package/lib/typescript/components/GestureButtons.d.ts +22 -0
- package/lib/typescript/components/GestureComponents.d.ts +7 -3
- package/lib/typescript/components/GestureComponents.web.d.ts +1 -0
- package/lib/typescript/components/Swipeable.d.ts +1 -1
- package/lib/typescript/fabric/RNGestureHandlerButtonNativeComponent.d.ts +1 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/PanGestureHandler.d.ts +2 -1
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +3 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/web/constants.d.ts +1 -33
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +30 -0
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +30 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +31 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +84 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +33 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +16 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +68 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +30 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +30 -0
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +49 -0
- package/lib/typescript/web/interfaces.d.ts +97 -0
- package/lib/typescript/web/tools/EventManager.d.ts +28 -0
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +28 -0
- package/lib/typescript/web/tools/InteractionManager.d.ts +13 -0
- package/lib/typescript/web/tools/NodeManager.d.ts +11 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +28 -0
- package/lib/typescript/{web → web_hammer}/DiscreteGestureHandler.d.ts +0 -0
- package/lib/typescript/{web → web_hammer}/DraggingGestureHandler.d.ts +0 -0
- package/lib/typescript/{web → web_hammer}/Errors.d.ts +0 -0
- package/lib/typescript/{web → web_hammer}/FlingGestureHandler.d.ts +1 -0
- package/lib/typescript/{web → web_hammer}/GestureHandler.d.ts +6 -0
- package/lib/typescript/{web → web_hammer}/IndiscreteGestureHandler.d.ts +1 -0
- package/lib/typescript/{web → web_hammer}/LongPressGestureHandler.d.ts +1 -0
- package/lib/typescript/{web → web_hammer}/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/NodeManager.d.ts +8 -0
- package/lib/typescript/{web → web_hammer}/PanGestureHandler.d.ts +1 -0
- package/lib/typescript/{web → web_hammer}/PinchGestureHandler.d.ts +0 -0
- package/lib/typescript/{web → web_hammer}/PressGestureHandler.d.ts +2 -0
- package/lib/typescript/{web → web_hammer}/RotationGestureHandler.d.ts +0 -0
- package/lib/typescript/{web → web_hammer}/TapGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/constants.d.ts +39 -0
- package/lib/typescript/{web → web_hammer}/utils.d.ts +0 -0
- package/package.json +1 -1
- package/src/EnableExperimentalWebImplementation.ts +18 -0
- package/src/RNGestureHandlerModule.macos.ts +114 -0
- package/src/RNGestureHandlerModule.web.ts +89 -26
- package/src/RNRenderer.ts +3 -0
- package/src/RNRenderer.web.ts +3 -0
- package/src/components/DrawerLayout.tsx +37 -14
- package/src/components/GestureButtons.tsx +64 -0
- package/src/components/GestureComponents.tsx +66 -6
- package/src/components/GestureComponents.web.tsx +5 -0
- package/src/components/Swipeable.tsx +3 -1
- package/src/components/touchables/GenericTouchable.tsx +2 -0
- package/src/fabric/RNGestureHandlerButtonNativeComponent.ts +1 -0
- package/src/handlers/ForceTouchGestureHandler.ts +3 -2
- package/src/handlers/PanGestureHandler.ts +2 -0
- package/src/handlers/PressabilityDebugView.tsx +2 -0
- package/src/handlers/PressabilityDebugView.web.tsx +4 -0
- package/src/handlers/{createHandler.ts → createHandler.tsx} +45 -19
- package/src/handlers/gestureHandlerCommon.ts +2 -0
- package/src/handlers/gestures/GestureDetector.tsx +185 -93
- package/src/handlers/gestures/gesture.ts +16 -0
- package/src/handlers/gestures/gestureStateManager.ts +13 -8
- package/src/handlers/gestures/panGesture.ts +5 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +7 -0
- package/src/index.ts +3 -0
- package/src/utils.ts +3 -1
- package/src/web/constants.ts +1 -41
- package/src/web/detectors/RotationGestureDetector.ts +199 -0
- package/src/web/detectors/ScaleGestureDetector.ts +208 -0
- package/src/web/handlers/FlingGestureHandler.ts +146 -0
- package/src/web/handlers/GestureHandler.ts +572 -0
- package/src/web/handlers/LongPressGestureHandler.ts +122 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +109 -0
- package/src/web/handlers/PanGestureHandler.ts +488 -0
- package/src/web/handlers/PinchGestureHandler.ts +162 -0
- package/src/web/handlers/RotationGestureHandler.ts +181 -0
- package/src/web/handlers/TapGestureHandler.ts +275 -0
- package/src/web/interfaces.ts +114 -0
- package/src/web/tools/EventManager.ts +186 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +329 -0
- package/src/web/tools/InteractionManager.ts +108 -0
- package/src/web/tools/NodeManager.ts +43 -0
- package/src/web/tools/PointerTracker.ts +130 -0
- package/src/{web → web_hammer}/DiscreteGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/DraggingGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/Errors.ts +0 -0
- package/src/{web → web_hammer}/FlingGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/GestureHandler.ts +102 -55
- package/src/{web → web_hammer}/IndiscreteGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/LongPressGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/NativeViewGestureHandler.ts +4 -0
- package/src/{web → web_hammer}/NodeManager.ts +6 -3
- package/src/{web → web_hammer}/PanGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/PinchGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/PressGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/RotationGestureHandler.ts +0 -0
- package/src/{web → web_hammer}/TapGestureHandler.ts +0 -0
- package/src/web_hammer/constants.ts +48 -0
- package/src/{web → web_hammer}/utils.ts +1 -1
- package/android/src/main/jni/Android.mk +0 -53
- package/android/src/main/jni/OnLoad.cpp +0 -9
- package/android/src/main/jni/RNGestureHandlerComponentsRegistry.cpp +0 -71
- package/android/src/main/jni/RNGestureHandlerComponentsRegistry.h +0 -34
- package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +0 -19
- package/lib/commonjs/web/GestureHandler.js.map +0 -1
- package/lib/commonjs/web/NativeViewGestureHandler.js.map +0 -1
- package/lib/commonjs/web/NodeManager.js.map +0 -1
- package/lib/module/web/GestureHandler.js.map +0 -1
- package/lib/module/web/NativeViewGestureHandler.js.map +0 -1
- package/lib/module/web/NodeManager.js.map +0 -1
- package/lib/typescript/web/NodeManager.d.ts +0 -8
@@ -0,0 +1,102 @@
|
|
1
|
+
import { isExperimentalWebImplementationEnabled } from './EnableExperimentalWebImplementation'; //GestureHandlers
|
2
|
+
|
3
|
+
import InteractionManager from './web/tools/InteractionManager';
|
4
|
+
import NodeManager from './web/tools/NodeManager';
|
5
|
+
import PanGestureHandler from './web/handlers/PanGestureHandler';
|
6
|
+
import TapGestureHandler from './web/handlers/TapGestureHandler';
|
7
|
+
import LongPressGestureHandler from './web/handlers/LongPressGestureHandler';
|
8
|
+
import PinchGestureHandler from './web/handlers/PinchGestureHandler';
|
9
|
+
import RotationGestureHandler from './web/handlers/RotationGestureHandler';
|
10
|
+
import FlingGestureHandler from './web/handlers/FlingGestureHandler';
|
11
|
+
import NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler'; //Hammer Handlers
|
12
|
+
|
13
|
+
import * as HammerNodeManager from './web_hammer/NodeManager';
|
14
|
+
import HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';
|
15
|
+
import HammerPanGestureHandler from './web_hammer/PanGestureHandler';
|
16
|
+
import HammerTapGestureHandler from './web_hammer/TapGestureHandler';
|
17
|
+
import HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';
|
18
|
+
import HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';
|
19
|
+
import HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';
|
20
|
+
import HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';
|
21
|
+
export const Gestures = {
|
22
|
+
NativeViewGestureHandler,
|
23
|
+
PanGestureHandler,
|
24
|
+
TapGestureHandler,
|
25
|
+
LongPressGestureHandler,
|
26
|
+
PinchGestureHandler,
|
27
|
+
RotationGestureHandler,
|
28
|
+
FlingGestureHandler
|
29
|
+
};
|
30
|
+
export const HammerGestures = {
|
31
|
+
NativeViewGestureHandler: HammerNativeViewGestureHandler,
|
32
|
+
PanGestureHandler: HammerPanGestureHandler,
|
33
|
+
TapGestureHandler: HammerTapGestureHandler,
|
34
|
+
LongPressGestureHandler: HammerLongPressGestureHandler,
|
35
|
+
PinchGestureHandler: HammerPinchGestureHandler,
|
36
|
+
RotationGestureHandler: HammerRotationGestureHandler,
|
37
|
+
FlingGestureHandler: HammerFlingGestureHandler
|
38
|
+
};
|
39
|
+
export default {
|
40
|
+
// Direction,
|
41
|
+
handleSetJSResponder(tag, blockNativeResponder) {
|
42
|
+
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
|
43
|
+
},
|
44
|
+
|
45
|
+
handleClearJSResponder() {
|
46
|
+
console.warn('handleClearJSResponder: ');
|
47
|
+
},
|
48
|
+
|
49
|
+
createGestureHandler(handlerName, handlerTag, config) {
|
50
|
+
if (isExperimentalWebImplementationEnabled()) {
|
51
|
+
if (!(handlerName in Gestures)) return;
|
52
|
+
const interactionManager = new InteractionManager();
|
53
|
+
const GestureClass = Gestures[handlerName];
|
54
|
+
NodeManager.createGestureHandler(handlerTag, new GestureClass());
|
55
|
+
interactionManager.configureInteractions(NodeManager.getHandler(handlerTag), config);
|
56
|
+
} else {
|
57
|
+
if (!(handlerName in HammerGestures)) return;
|
58
|
+
const GestureClass = HammerGestures[handlerName];
|
59
|
+
HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
|
60
|
+
}
|
61
|
+
|
62
|
+
this.updateGestureHandler(handlerTag, config);
|
63
|
+
},
|
64
|
+
|
65
|
+
attachGestureHandler(handlerTag, newView, //ref
|
66
|
+
_actionType, propsRef) {
|
67
|
+
if (isExperimentalWebImplementationEnabled()) {
|
68
|
+
NodeManager.getHandler(handlerTag).init(newView, propsRef);
|
69
|
+
} else {
|
70
|
+
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
71
|
+
}
|
72
|
+
},
|
73
|
+
|
74
|
+
updateGestureHandler(handlerTag, newConfig) {
|
75
|
+
if (isExperimentalWebImplementationEnabled()) {
|
76
|
+
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
77
|
+
} else {
|
78
|
+
HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
79
|
+
}
|
80
|
+
},
|
81
|
+
|
82
|
+
getGestureHandlerNode(handlerTag) {
|
83
|
+
if (isExperimentalWebImplementationEnabled()) {
|
84
|
+
return NodeManager.getHandler(handlerTag);
|
85
|
+
} else {
|
86
|
+
return HammerNodeManager.getHandler(handlerTag);
|
87
|
+
}
|
88
|
+
},
|
89
|
+
|
90
|
+
dropGestureHandler(handlerTag) {
|
91
|
+
if (isExperimentalWebImplementationEnabled()) {
|
92
|
+
NodeManager.dropGestureHandler(handlerTag);
|
93
|
+
} else {
|
94
|
+
HammerNodeManager.dropGestureHandler(handlerTag);
|
95
|
+
}
|
96
|
+
},
|
97
|
+
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
99
|
+
flushOperations() {}
|
100
|
+
|
101
|
+
};
|
102
|
+
//# sourceMappingURL=RNGestureHandlerModule.macos.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["RNGestureHandlerModule.macos.ts"],"names":["isExperimentalWebImplementationEnabled","InteractionManager","NodeManager","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","NativeViewGestureHandler","HammerNodeManager","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","Gestures","HammerGestures","handleSetJSResponder","tag","blockNativeResponder","console","warn","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","interactionManager","GestureClass","configureInteractions","getHandler","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"AACA,SAASA,sCAAT,QAAuD,uCAAvD,C,CAEA;;AACA,OAAOC,kBAAP,MAA+B,gCAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAA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C+B,UAAZ,CAAuBL,UAAvB,EAAmCc,mBAAnC,CAAuDD,SAAvD;AACD,KAFD,MAEO;AACL/B,MAAAA,iBAAiB,CAACuB,UAAlB,CAA6BL,UAA7B,EAAyCc,mBAAzC,CAA6DD,SAA7D;AACD;AACF,GAnDY;;AAoDbE,EAAAA,qBAAqB,CAACf,UAAD,EAAqB;AACxC,QAAI5B,sCAAsC,EAA1C,EAA8C;AAC5C,aAAOE,WAAW,CAAC+B,UAAZ,CAAuBL,UAAvB,CAAP;AACD,KAFD,MAEO;AACL,aAAOlB,iBAAiB,CAACuB,UAAlB,CAA6BL,UAA7B,CAAP;AACD;AACF,GA1DY;;AA2DbgB,EAAAA,kBAAkB,CAAChB,UAAD,EAAqB;AACrC,QAAI5B,sCAAsC,EAA1C,EAA8C;AAC5CE,MAAAA,WAAW,CAAC0C,kBAAZ,CAA+BhB,UAA/B;AACD,KAFD,MAEO;AACLlB,MAAAA,iBAAiB,CAACkC,kBAAlB,CAAqChB,UAArC;AACD;AACF,GAjEY;;AAkEb;AACAiB,EAAAA,eAAe,GAAG,CAAE;;AAnEP,CAAf","sourcesContent":["import { ActionType } from './ActionType';\nimport { isExperimentalWebImplementationEnabled } from './EnableExperimentalWebImplementation';\n\n//GestureHandlers\nimport InteractionManager from './web/tools/InteractionManager';\nimport NodeManager from './web/tools/NodeManager';\nimport PanGestureHandler from './web/handlers/PanGestureHandler';\nimport TapGestureHandler from './web/handlers/TapGestureHandler';\nimport LongPressGestureHandler from './web/handlers/LongPressGestureHandler';\nimport PinchGestureHandler from './web/handlers/PinchGestureHandler';\nimport RotationGestureHandler from './web/handlers/RotationGestureHandler';\nimport FlingGestureHandler from './web/handlers/FlingGestureHandler';\nimport NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';\n\n//Hammer Handlers\nimport * as HammerNodeManager from './web_hammer/NodeManager';\nimport HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';\nimport HammerPanGestureHandler from './web_hammer/PanGestureHandler';\nimport HammerTapGestureHandler from './web_hammer/TapGestureHandler';\nimport HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';\nimport HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';\nimport HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';\nimport HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';\nimport { Config } from './web_hammer/GestureHandler';\n\nexport const Gestures = {\n NativeViewGestureHandler,\n PanGestureHandler,\n TapGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n};\n\nexport const HammerGestures = {\n NativeViewGestureHandler: HammerNativeViewGestureHandler,\n PanGestureHandler: HammerPanGestureHandler,\n TapGestureHandler: HammerTapGestureHandler,\n LongPressGestureHandler: HammerLongPressGestureHandler,\n PinchGestureHandler: HammerPinchGestureHandler,\n RotationGestureHandler: HammerRotationGestureHandler,\n FlingGestureHandler: HammerFlingGestureHandler,\n};\n\nexport default {\n // Direction,\n handleSetJSResponder(tag: number, blockNativeResponder: boolean) {\n console.warn('handleSetJSResponder: ', tag, blockNativeResponder);\n },\n handleClearJSResponder() {\n console.warn('handleClearJSResponder: ');\n },\n createGestureHandler<T>(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n if (isExperimentalWebImplementationEnabled()) {\n if (!(handlerName in Gestures)) return;\n\n const interactionManager = new InteractionManager();\n\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(handlerTag, new GestureClass());\n interactionManager.configureInteractions(\n NodeManager.getHandler(handlerTag),\n (config as unknown) as Config\n );\n } else {\n if (!(handlerName in HammerGestures)) return;\n\n const GestureClass = HammerGestures[handlerName];\n HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());\n }\n\n this.updateGestureHandler(handlerTag, config);\n },\n attachGestureHandler(\n handlerTag: number,\n newView: number, //ref\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n ) {\n if (isExperimentalWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).init(newView, propsRef);\n } else {\n HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);\n }\n },\n updateGestureHandler(handlerTag: number, newConfig: any) {\n if (isExperimentalWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n } else {\n HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n }\n },\n getGestureHandlerNode(handlerTag: number) {\n if (isExperimentalWebImplementationEnabled()) {\n return NodeManager.getHandler(handlerTag);\n } else {\n return HammerNodeManager.getHandler(handlerTag);\n }\n },\n dropGestureHandler(handlerTag: number) {\n if (isExperimentalWebImplementationEnabled()) {\n NodeManager.dropGestureHandler(handlerTag);\n } else {\n HammerNodeManager.dropGestureHandler(handlerTag);\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n flushOperations() {},\n};\n"]}
|
@@ -1,25 +1,44 @@
|
|
1
|
-
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import PinchGestureHandler from './web/PinchGestureHandler';
|
8
|
-
import RotationGestureHandler from './web/RotationGestureHandler';
|
9
|
-
import
|
1
|
+
//GestureHandlers
|
2
|
+
import InteractionManager from './web/tools/InteractionManager';
|
3
|
+
import NodeManager from './web/tools/NodeManager';
|
4
|
+
import PanGestureHandler from './web/handlers/PanGestureHandler';
|
5
|
+
import TapGestureHandler from './web/handlers/TapGestureHandler';
|
6
|
+
import LongPressGestureHandler from './web/handlers/LongPressGestureHandler';
|
7
|
+
import PinchGestureHandler from './web/handlers/PinchGestureHandler';
|
8
|
+
import RotationGestureHandler from './web/handlers/RotationGestureHandler';
|
9
|
+
import FlingGestureHandler from './web/handlers/FlingGestureHandler';
|
10
|
+
import NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler'; //Hammer Handlers
|
11
|
+
|
12
|
+
import * as HammerNodeManager from './web_hammer/NodeManager';
|
13
|
+
import HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';
|
14
|
+
import HammerPanGestureHandler from './web_hammer/PanGestureHandler';
|
15
|
+
import HammerTapGestureHandler from './web_hammer/TapGestureHandler';
|
16
|
+
import HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';
|
17
|
+
import HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';
|
18
|
+
import HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';
|
19
|
+
import HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';
|
20
|
+
import { isExperimentalWebImplementationEnabled } from './EnableExperimentalWebImplementation';
|
10
21
|
export const Gestures = {
|
22
|
+
NativeViewGestureHandler,
|
11
23
|
PanGestureHandler,
|
12
|
-
RotationGestureHandler,
|
13
|
-
PinchGestureHandler,
|
14
24
|
TapGestureHandler,
|
15
|
-
NativeViewGestureHandler,
|
16
25
|
LongPressGestureHandler,
|
17
|
-
|
18
|
-
|
26
|
+
PinchGestureHandler,
|
27
|
+
RotationGestureHandler,
|
28
|
+
FlingGestureHandler
|
29
|
+
};
|
30
|
+
export const HammerGestures = {
|
31
|
+
NativeViewGestureHandler: HammerNativeViewGestureHandler,
|
32
|
+
PanGestureHandler: HammerPanGestureHandler,
|
33
|
+
TapGestureHandler: HammerTapGestureHandler,
|
34
|
+
LongPressGestureHandler: HammerLongPressGestureHandler,
|
35
|
+
PinchGestureHandler: HammerPinchGestureHandler,
|
36
|
+
RotationGestureHandler: HammerRotationGestureHandler,
|
37
|
+
FlingGestureHandler: HammerFlingGestureHandler
|
19
38
|
};
|
39
|
+
const interactionManager = new InteractionManager();
|
20
40
|
export default {
|
21
|
-
Direction,
|
22
|
-
|
41
|
+
// Direction,
|
23
42
|
handleSetJSResponder(tag, blockNativeResponder) {
|
24
43
|
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
|
25
44
|
},
|
@@ -29,27 +48,57 @@ export default {
|
|
29
48
|
},
|
30
49
|
|
31
50
|
createGestureHandler(handlerName, handlerTag, config) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
51
|
+
if (isExperimentalWebImplementationEnabled()) {
|
52
|
+
if (!(handlerName in Gestures)) {
|
53
|
+
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
54
|
+
}
|
55
|
+
|
56
|
+
const GestureClass = Gestures[handlerName];
|
57
|
+
NodeManager.createGestureHandler(handlerTag, new GestureClass());
|
58
|
+
interactionManager.configureInteractions(NodeManager.getHandler(handlerTag), config);
|
59
|
+
} else {
|
60
|
+
if (!(handlerName in HammerGestures)) {
|
61
|
+
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
62
|
+
}
|
63
|
+
|
64
|
+
const GestureClass = HammerGestures[handlerName];
|
65
|
+
HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
|
66
|
+
}
|
67
|
+
|
36
68
|
this.updateGestureHandler(handlerTag, config);
|
37
69
|
},
|
38
70
|
|
39
71
|
attachGestureHandler(handlerTag, newView, _actionType, propsRef) {
|
40
|
-
|
72
|
+
if (isExperimentalWebImplementationEnabled()) {
|
73
|
+
NodeManager.getHandler(handlerTag).init(newView, propsRef);
|
74
|
+
} else {
|
75
|
+
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
76
|
+
}
|
41
77
|
},
|
42
78
|
|
43
79
|
updateGestureHandler(handlerTag, newConfig) {
|
44
|
-
|
80
|
+
if (isExperimentalWebImplementationEnabled()) {
|
81
|
+
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
82
|
+
interactionManager.configureInteractions(NodeManager.getHandler(handlerTag), newConfig);
|
83
|
+
} else {
|
84
|
+
HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
85
|
+
}
|
45
86
|
},
|
46
87
|
|
47
88
|
getGestureHandlerNode(handlerTag) {
|
48
|
-
|
89
|
+
if (isExperimentalWebImplementationEnabled()) {
|
90
|
+
return NodeManager.getHandler(handlerTag);
|
91
|
+
} else {
|
92
|
+
return HammerNodeManager.getHandler(handlerTag);
|
93
|
+
}
|
49
94
|
},
|
50
95
|
|
51
96
|
dropGestureHandler(handlerTag) {
|
52
|
-
|
97
|
+
if (isExperimentalWebImplementationEnabled()) {
|
98
|
+
NodeManager.dropGestureHandler(handlerTag);
|
99
|
+
} else {
|
100
|
+
HammerNodeManager.dropGestureHandler(handlerTag);
|
101
|
+
}
|
53
102
|
},
|
54
103
|
|
55
104
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["RNGestureHandlerModule.web.ts"],"names":["
|
1
|
+
{"version":3,"sources":["RNGestureHandlerModule.web.ts"],"names":["InteractionManager","NodeManager","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","NativeViewGestureHandler","HammerNodeManager","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","isExperimentalWebImplementationEnabled","Gestures","HammerGestures","interactionManager","handleSetJSResponder","tag","blockNativeResponder","console","warn","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","configureInteractions","getHandler","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"AAEA;AACA,OAAOA,kBAAP,MAA+B,gCAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,uBAAP,MAAoC,wCAApC;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,OAAOC,sBAAP,MAAmC,uCAAnC;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,OAAOC,wBAAP,MAAqC,yCAArC,C,CAEA;;AACA,OAAO,KAAKC,iBAAZ,MAAmC,0BAAnC;AACA,OAAOC,8BA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AACiC,UAAZ,CAAuBL,UAAvB,CADF,EAEEa,SAFF;AAID,KAPD,MAOO;AACLjC,MAAAA,iBAAiB,CAACyB,UAAlB,CAA6BL,UAA7B,EAAyCc,mBAAzC,CAA6DD,SAA7D;AACD;AACF,GA9DY;;AA+DbE,EAAAA,qBAAqB,CAACf,UAAD,EAAqB;AACxC,QAAIZ,sCAAsC,EAA1C,EAA8C;AAC5C,aAAOhB,WAAW,CAACiC,UAAZ,CAAuBL,UAAvB,CAAP;AACD,KAFD,MAEO;AACL,aAAOpB,iBAAiB,CAACyB,UAAlB,CAA6BL,UAA7B,CAAP;AACD;AACF,GArEY;;AAsEbgB,EAAAA,kBAAkB,CAAChB,UAAD,EAAqB;AACrC,QAAIZ,sCAAsC,EAA1C,EAA8C;AAC5ChB,MAAAA,WAAW,CAAC4C,kBAAZ,CAA+BhB,UAA/B;AACD,KAFD,MAEO;AACLpB,MAAAA,iBAAiB,CAACoC,kBAAlB,CAAqChB,UAArC;AACD;AACF,GA5EY;;AA6Eb;AACAiB,EAAAA,eAAe,GAAG,CAAE;;AA9EP,CAAf","sourcesContent":["import { ActionType } from './ActionType';\n\n//GestureHandlers\nimport InteractionManager from './web/tools/InteractionManager';\nimport NodeManager from './web/tools/NodeManager';\nimport PanGestureHandler from './web/handlers/PanGestureHandler';\nimport TapGestureHandler from './web/handlers/TapGestureHandler';\nimport LongPressGestureHandler from './web/handlers/LongPressGestureHandler';\nimport PinchGestureHandler from './web/handlers/PinchGestureHandler';\nimport RotationGestureHandler from './web/handlers/RotationGestureHandler';\nimport FlingGestureHandler from './web/handlers/FlingGestureHandler';\nimport NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';\n\n//Hammer Handlers\nimport * as HammerNodeManager from './web_hammer/NodeManager';\nimport HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';\nimport HammerPanGestureHandler from './web_hammer/PanGestureHandler';\nimport HammerTapGestureHandler from './web_hammer/TapGestureHandler';\nimport HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';\nimport HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';\nimport HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';\nimport HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';\nimport { Config } from './web/interfaces';\nimport { isExperimentalWebImplementationEnabled } from './EnableExperimentalWebImplementation';\n\nexport const Gestures = {\n NativeViewGestureHandler,\n PanGestureHandler,\n TapGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n};\n\nexport const HammerGestures = {\n NativeViewGestureHandler: HammerNativeViewGestureHandler,\n PanGestureHandler: HammerPanGestureHandler,\n TapGestureHandler: HammerTapGestureHandler,\n LongPressGestureHandler: HammerLongPressGestureHandler,\n PinchGestureHandler: HammerPinchGestureHandler,\n RotationGestureHandler: HammerRotationGestureHandler,\n FlingGestureHandler: HammerFlingGestureHandler,\n};\n\nconst interactionManager = new InteractionManager();\n\nexport default {\n // Direction,\n handleSetJSResponder(tag: number, blockNativeResponder: boolean) {\n console.warn('handleSetJSResponder: ', tag, blockNativeResponder);\n },\n handleClearJSResponder() {\n console.warn('handleClearJSResponder: ');\n },\n createGestureHandler<T>(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n if (isExperimentalWebImplementationEnabled()) {\n if (!(handlerName in Gestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(handlerTag, new GestureClass());\n interactionManager.configureInteractions(\n NodeManager.getHandler(handlerTag),\n (config as unknown) as Config\n );\n } else {\n if (!(handlerName in HammerGestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n const GestureClass = HammerGestures[handlerName];\n HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());\n }\n\n this.updateGestureHandler(handlerTag, (config as unknown) as Config);\n },\n attachGestureHandler(\n handlerTag: number,\n newView: number,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n ) {\n if (isExperimentalWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).init(newView, propsRef);\n } else {\n HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);\n }\n },\n updateGestureHandler(handlerTag: number, newConfig: Config) {\n if (isExperimentalWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n\n interactionManager.configureInteractions(\n NodeManager.getHandler(handlerTag),\n newConfig\n );\n } else {\n HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n }\n },\n getGestureHandlerNode(handlerTag: number) {\n if (isExperimentalWebImplementationEnabled()) {\n return NodeManager.getHandler(handlerTag);\n } else {\n return HammerNodeManager.getHandler(handlerTag);\n }\n },\n dropGestureHandler(handlerTag: number) {\n if (isExperimentalWebImplementationEnabled()) {\n NodeManager.dropGestureHandler(handlerTag);\n } else {\n HammerNodeManager.dropGestureHandler(handlerTag);\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n flushOperations() {},\n};\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["RNRenderer.ts"],"names":["default","RNRenderer"],"mappings":"AAAA;AACA;AACA,SAASA,OAAO,IAAIC,UAApB,QAAsC,mDAAtC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nexport { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["RNRenderer.web.ts"],"names":["RNRenderer","findHostInstance_DEPRECATED","_ref"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,2BAA2B,EAAGC,IAAD,IAAe;AADpB,CAAnB","sourcesContent":["export const RNRenderer = {\n findHostInstance_DEPRECATED: (_ref: any) => null,\n};\n"]}
|
@@ -152,6 +152,9 @@ export default class DrawerLayout extends Component {
|
|
152
152
|
});
|
153
153
|
} else if (nativeEvent.state === State.ACTIVE) {
|
154
154
|
this.emitStateChanged(DRAGGING, false);
|
155
|
+
this.setState({
|
156
|
+
drawerState: DRAGGING
|
157
|
+
});
|
155
158
|
|
156
159
|
if (this.props.keyboardDismissMode === 'on-drag') {
|
157
160
|
Keyboard.dismiss();
|
@@ -276,6 +279,9 @@ export default class DrawerLayout extends Component {
|
|
276
279
|
const willShow = toValue !== 0;
|
277
280
|
this.updateShowing(willShow);
|
278
281
|
this.emitStateChanged(SETTLING, willShow);
|
282
|
+
this.setState({
|
283
|
+
drawerState: SETTLING
|
284
|
+
});
|
279
285
|
|
280
286
|
if (this.props.hideStatusBar) {
|
281
287
|
StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');
|
@@ -292,6 +298,17 @@ export default class DrawerLayout extends Component {
|
|
292
298
|
}) => {
|
293
299
|
if (finished) {
|
294
300
|
this.emitStateChanged(IDLE, willShow);
|
301
|
+
this.setState({
|
302
|
+
drawerOpened: willShow
|
303
|
+
});
|
304
|
+
|
305
|
+
if (this.state.drawerState !== DRAGGING) {
|
306
|
+
// it's possilbe that user started drag while the drawer
|
307
|
+
// was settling, don't override state in this case
|
308
|
+
this.setState({
|
309
|
+
drawerState: IDLE
|
310
|
+
});
|
311
|
+
}
|
295
312
|
|
296
313
|
if (willShow) {
|
297
314
|
var _this$props$onDrawerO, _this$props3;
|
@@ -325,11 +342,14 @@ export default class DrawerLayout extends Component {
|
|
325
342
|
_defineProperty(this, "renderOverlay", () => {
|
326
343
|
/* Overlay styles */
|
327
344
|
invariant(this.openValue, 'should be set');
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
}
|
345
|
+
let overlayOpacity;
|
346
|
+
|
347
|
+
if (this.state.drawerState !== IDLE) {
|
348
|
+
overlayOpacity = this.openValue;
|
349
|
+
} else {
|
350
|
+
overlayOpacity = this.state.drawerOpened ? 1 : 0;
|
351
|
+
}
|
352
|
+
|
333
353
|
const dynamicOverlayStyles = {
|
334
354
|
opacity: overlayOpacity,
|
335
355
|
backgroundColor: this.props.overlayColor
|
@@ -385,11 +405,16 @@ export default class DrawerLayout extends Component {
|
|
385
405
|
|
386
406
|
if (drawerSlide) {
|
387
407
|
const closedDrawerOffset = fromLeft ? -drawerWidth : drawerWidth;
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
408
|
+
|
409
|
+
if (this.state.drawerState !== IDLE) {
|
410
|
+
drawerTranslateX = openValue.interpolate({
|
411
|
+
inputRange: [0, 1],
|
412
|
+
outputRange: [closedDrawerOffset, 0],
|
413
|
+
extrapolate: 'clamp'
|
414
|
+
});
|
415
|
+
} else {
|
416
|
+
drawerTranslateX = this.state.drawerOpened ? 0 : closedDrawerOffset;
|
417
|
+
}
|
393
418
|
}
|
394
419
|
|
395
420
|
const drawerStyles = {
|
@@ -433,15 +458,19 @@ export default class DrawerLayout extends Component {
|
|
433
458
|
dragX: _dragX,
|
434
459
|
touchX: _touchX,
|
435
460
|
drawerTranslation: _drawerTranslation,
|
436
|
-
containerWidth: 0
|
461
|
+
containerWidth: 0,
|
462
|
+
drawerState: IDLE,
|
463
|
+
drawerOpened: false
|
437
464
|
};
|
438
465
|
this.updateAnimatedEvent(_props, this.state);
|
439
466
|
}
|
440
467
|
|
441
|
-
|
468
|
+
shouldComponentUpdate(props, state) {
|
442
469
|
if (this.props.drawerPosition !== props.drawerPosition || this.props.drawerWidth !== props.drawerWidth || this.props.drawerType !== props.drawerType || this.state.containerWidth !== state.containerWidth) {
|
443
470
|
this.updateAnimatedEvent(props, state);
|
444
471
|
}
|
472
|
+
|
473
|
+
return true;
|
445
474
|
}
|
446
475
|
|
447
476
|
render() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["DrawerLayout.tsx"],"names":["React","Component","invariant","Animated","StyleSheet","View","Keyboard","StatusBar","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","IDLE","DRAGGING","SETTLING","DrawerLayout","constructor","props","createRef","state","drawerPosition","drawerWidth","drawerType","dragX","dragXValue","touchX","touchXValue","drawerTranslation","containerWidth","multiply","Value","add","setValue","translationX","startPositionX","dragOffsetFromOnStartPosition","interpolate","inputRange","outputRange","openValue","extrapolate","gestureOptions","useNativeDriver","useNativeAnimations","onDrawerSlide","listener","ev","Math","floor","abs","nativeEvent","position","onGestureEvent","event","x","setState","layout","width","newState","drawerWillShow","onDrawerStateChanged","oldState","ACTIVE","handleRelease","emitStateChanged","keyboardDismissMode","dismiss","hideStatusBar","setHidden","statusBarAnimation","drawerShown","drawerLockMode","closeDrawer","velocityX","gestureStartX","dragOffsetBasedOnStart","startOffsetX","projOffsetX","shouldOpen","animateDrawer","showing","accessibilityIsModalView","current","setNativeProps","accessibilityViewIsModal","pointerEventsView","pointerEvents","minSwipeDistance","edgeWidth","fromLeft","gestureOrientation","hitSlop","left","undefined","right","panGestureHandler","activeOffsetX","fromValue","toValue","velocity","speed","nextFramePosition","min","max","willShow","updateShowing","spring","bounciness","start","finished","onDrawerOpen","onDrawerClose","options","forceUpdate","overlayOpacity","dynamicOverlayStyles","opacity","backgroundColor","overlayColor","onTapHandlerStateChange","styles","overlay","drawerBackgroundColor","drawerContainerStyle","contentContainerStyle","drawerSlide","containerSlide","reverseContentDirection","isRTL","dynamicDrawerStyles","containerStyles","containerTranslateX","transform","translateX","drawerTranslateX","closedDrawerOffset","drawerStyles","flexDirection","main","handleContainerLayout","containerOnBack","containerInFront","children","renderOverlay","drawerContainer","renderNavigationView","ref","onGestureRef","updateAnimatedEvent","UNSAFE_componentWillUpdate","render","setPanGestureRef","openingHandlerStateChange","enableTrackpadTwoFingerGesture","renderDrawer","Left","Right","create","absoluteFillObject","zIndex","flex","overflow"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SACE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e,EAAE,EACf,GAAG7I,UAAU,CAAC2J,kBADC;AAEfC,IAAAA,MAAM,EAAE,IAFO;AAGftB,IAAAA,aAAa,EAAE;AAHA,GADc;AAM/BI,EAAAA,gBAAgB,EAAE,EAChB,GAAG1I,UAAU,CAAC2J,kBADE;AAEhBC,IAAAA,MAAM,EAAE;AAFQ,GANa;AAU/BnB,EAAAA,eAAe,EAAE,EACf,GAAGzI,UAAU,CAAC2J;AADC,GAVc;AAa/BpB,EAAAA,IAAI,EAAE;AACJsB,IAAAA,IAAI,EAAE,CADF;AAEJD,IAAAA,MAAM,EAAE,CAFJ;AAGJE,IAAAA,QAAQ,EAAE;AAHN,GAbyB;AAkB/BxC,EAAAA,OAAO,EAAE,EACP,GAAGtH,UAAU,CAAC2J,kBADP;AAEPC,IAAAA,MAAM,EAAE;AAFD;AAlBsB,CAAlB,CAAf","sourcesContent":["// This component is based on RN's DrawerLayoutAndroid API\n//\n// It perhaps deserves to be put in a separate repo, but since it relies on\n// react-native-gesture-handler library which isn't very popular at the moment I\n// decided to keep it here for the time being. It will allow us to move faster\n// and fix issues that may arise in gesture handler library that could be found\n// when using the drawer component\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport invariant from 'invariant';\nimport {\n Animated,\n StyleSheet,\n View,\n Keyboard,\n StatusBar,\n I18nManager,\n StatusBarAnimation,\n StyleProp,\n ViewStyle,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\nconst IDLE: DrawerState = 'Idle';\nconst DRAGGING: DrawerState = 'Dragging';\nconst SETTLING: DrawerState = 'Settling';\n\nexport type DrawerPosition = 'left' | 'right';\n\nexport type DrawerState = 'Idle' | 'Dragging' | 'Settling';\n\nexport type DrawerType = 'front' | 'back' | 'slide';\n\nexport type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';\n\nexport type DrawerKeyboardDismissMode = 'none' | 'on-drag';\n\nexport interface DrawerLayoutProps {\n /**\n * This attribute is present in the standard implementation already and is one\n * of the required params. Gesture handler version of DrawerLayout make it\n * possible for the function passed as `renderNavigationView` to take an\n * Animated value as a parameter that indicates the progress of drawer\n * opening/closing animation (progress value is 0 when closed and 1 when\n * opened). This can be used by the drawer component to animated its children\n * while the drawer is opening or closing.\n */\n renderNavigationView: (\n progressAnimatedValue: Animated.Value\n ) => React.ReactNode;\n\n drawerPosition?: DrawerPosition;\n\n drawerWidth?: number;\n\n drawerBackgroundColor?: string;\n\n drawerLockMode?: DrawerLockMode;\n\n keyboardDismissMode?: DrawerKeyboardDismissMode;\n\n /**\n * Called when the drawer is closed.\n */\n onDrawerClose?: () => void;\n\n /**\n * Called when the drawer is opened.\n */\n onDrawerOpen?: () => void;\n\n /**\n * Called when the status of the drawer changes.\n */\n onDrawerStateChanged?: (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => void;\n useNativeAnimations?: boolean;\n\n drawerType?: DrawerType;\n\n /**\n * Defines how far from the edge of the content view the gesture should\n * activate.\n */\n edgeWidth?: number;\n\n minSwipeDistance?: number;\n\n /**\n * When set to true Drawer component will use\n * {@link https://reactnative.dev/docs/statusbar StatusBar} API to hide the OS\n * status bar whenever the drawer is pulled or when its in an \"open\" state.\n */\n hideStatusBar?: boolean;\n\n /**\n * @default 'slide'\n *\n * Can be used when hideStatusBar is set to true and will select the animation\n * used for hiding/showing the status bar. See\n * {@link https://reactnative.dev/docs/statusbar StatusBar} documentation for\n * more details\n */\n statusBarAnimation?: StatusBarAnimation;\n\n /**\n * @default black\n *\n * Color of a semi-transparent overlay to be displayed on top of the content\n * view when drawer gets open. A solid color should be used as the opacity is\n * added by the Drawer itself and the opacity of the overlay is animated (from\n * 0% to 70%).\n */\n overlayColor?: string;\n\n contentContainerStyle?: StyleProp<ViewStyle>;\n\n drawerContainerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n onDrawerSlide?: (position: number) => void;\n\n onGestureRef?: (ref: PanGestureHandler) => void;\n}\n\nexport type DrawerLayoutState = {\n dragX: Animated.Value;\n touchX: Animated.Value;\n drawerTranslation: Animated.Value;\n containerWidth: number;\n};\n\nexport type DrawerMovementOption = {\n velocity?: number;\n speed?: number;\n};\nexport default class DrawerLayout extends Component<\n DrawerLayoutProps,\n DrawerLayoutState\n> {\n static defaultProps = {\n drawerWidth: 200,\n drawerPosition: 'left',\n useNativeAnimations: true,\n drawerType: 'front',\n edgeWidth: 20,\n minSwipeDistance: 3,\n overlayColor: 'rgba(0, 0, 0, 0.7)',\n drawerLockMode: 'unlocked',\n enableTrackpadTwoFingerGesture: false,\n };\n\n constructor(props: DrawerLayoutProps) {\n super(props);\n\n const dragX = new Animated.Value(0);\n const touchX = new Animated.Value(0);\n const drawerTranslation = new Animated.Value(0);\n\n this.state = {\n dragX,\n touchX,\n drawerTranslation,\n containerWidth: 0,\n };\n\n this.updateAnimatedEvent(props, this.state);\n }\n\n UNSAFE_componentWillUpdate(\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) {\n if (\n this.props.drawerPosition !== props.drawerPosition ||\n this.props.drawerWidth !== props.drawerWidth ||\n this.props.drawerType !== props.drawerType ||\n this.state.containerWidth !== state.containerWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n }\n\n private openValue?: Animated.AnimatedInterpolation;\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private accessibilityIsModalView = React.createRef<View>();\n private pointerEventsView = React.createRef<View>();\n private panGestureHandler = React.createRef<PanGestureHandler | null>();\n private drawerShown = false;\n\n static positions = {\n Left: 'left',\n Right: 'right',\n };\n\n private updateAnimatedEvent = (\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) => {\n // Event definition is based on\n const { drawerPosition, drawerWidth, drawerType } = props;\n const {\n dragX: dragXValue,\n touchX: touchXValue,\n drawerTranslation,\n containerWidth,\n } = state;\n\n let dragX = dragXValue;\n let touchX = touchXValue;\n\n if (drawerPosition !== 'left') {\n // Most of the code is written in a way to handle left-side drawer. In\n // order to handle right-side drawer the only thing we need to do is to\n // reverse events coming from gesture handler in a way they emulate\n // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is\n // calulcated by subtracing real touchX from the width of the container\n // (such that when touch happens at the right edge the value is simply 0)\n dragX = Animated.multiply(\n new Animated.Value(-1),\n dragXValue\n ) as Animated.Value; // TODO(TS): (for all \"as\" in this file) make sure we can map this\n touchX = Animated.add(\n new Animated.Value(containerWidth),\n Animated.multiply(new Animated.Value(-1), touchXValue)\n ) as Animated.Value; // TODO(TS): make sure we can map this;\n touchXValue.setValue(containerWidth);\n } else {\n touchXValue.setValue(0);\n }\n\n // While closing the drawer when user starts gesture outside of its area (in greyed\n // out part of the window), we want the drawer to follow only once finger reaches the\n // edge of the drawer.\n // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by\n // dots. The touch gesture starts at '*' and moves left, touch path is indicated by\n // an arrow pointing left\n // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // +---------------+ +---------------+ +---------------+ +---------------+\n //\n // For the above to work properly we define animated value that will keep\n // start position of the gesture. Then we use that value to calculate how\n // much we need to subtract from the dragX. If the gesture started on the\n // greyed out area we take the distance from the edge of the drawer to the\n // start position. Otherwise we don't subtract at all and the drawer be\n // pulled back as soon as you start the pan.\n //\n // This is used only when drawerType is \"front\"\n //\n let translationX = dragX;\n if (drawerType === 'front') {\n const startPositionX = Animated.add(\n touchX,\n Animated.multiply(new Animated.Value(-1), dragX)\n );\n\n const dragOffsetFromOnStartPosition = startPositionX.interpolate({\n inputRange: [drawerWidth! - 1, drawerWidth!, drawerWidth! + 1],\n outputRange: [0, 0, 1],\n });\n translationX = Animated.add(\n dragX,\n dragOffsetFromOnStartPosition\n ) as Animated.Value; // TODO: as above\n }\n\n this.openValue = Animated.add(translationX, drawerTranslation).interpolate({\n inputRange: [0, drawerWidth!],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n\n const gestureOptions: {\n useNativeDriver: boolean;\n // TODO: make sure it is correct\n listener?: (\n ev: NativeSyntheticEvent<PanGestureHandlerEventPayload>\n ) => void;\n } = {\n useNativeDriver: props.useNativeAnimations!,\n };\n\n if (this.props.onDrawerSlide) {\n gestureOptions.listener = (ev) => {\n const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));\n const position = translationX / this.state.containerWidth;\n\n this.props.onDrawerSlide?.(position);\n };\n }\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragXValue, x: touchXValue } }],\n gestureOptions\n );\n };\n\n private handleContainerLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ containerWidth: nativeEvent.layout.width });\n };\n\n private emitStateChanged = (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => {\n this.props.onDrawerStateChanged?.(newState, drawerWillShow);\n };\n\n private openingHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease({ nativeEvent });\n } else if (nativeEvent.state === State.ACTIVE) {\n this.emitStateChanged(DRAGGING, false);\n if (this.props.keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');\n }\n }\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (\n this.drawerShown &&\n nativeEvent.oldState === State.ACTIVE &&\n this.props.drawerLockMode !== 'locked-open'\n ) {\n this.closeDrawer();\n }\n };\n\n private handleRelease = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n const { drawerWidth, drawerPosition, drawerType } = this.props;\n const { containerWidth } = this.state;\n let { translationX: dragX, velocityX, x: touchX } = nativeEvent;\n\n if (drawerPosition !== 'left') {\n // See description in _updateAnimatedEvent about why events are flipped\n // for right-side drawer\n dragX = -dragX;\n touchX = containerWidth - touchX;\n velocityX = -velocityX;\n }\n\n const gestureStartX = touchX - dragX;\n let dragOffsetBasedOnStart = 0;\n\n if (drawerType === 'front') {\n dragOffsetBasedOnStart =\n gestureStartX > drawerWidth! ? gestureStartX - drawerWidth! : 0;\n }\n\n const startOffsetX =\n dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth! : 0);\n const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;\n\n const shouldOpen = projOffsetX > drawerWidth! / 2;\n\n if (shouldOpen) {\n this.animateDrawer(startOffsetX, drawerWidth!, velocityX);\n } else {\n this.animateDrawer(startOffsetX, 0, velocityX);\n }\n };\n\n private updateShowing = (showing: boolean) => {\n this.drawerShown = showing;\n this.accessibilityIsModalView.current?.setNativeProps({\n accessibilityViewIsModal: showing,\n });\n this.pointerEventsView.current?.setNativeProps({\n pointerEvents: showing ? 'auto' : 'none',\n });\n const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;\n const fromLeft = drawerPosition === 'left';\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: showing ? undefined : edgeWidth }\n : { right: 0, width: showing ? undefined : edgeWidth };\n // @ts-ignore internal API, maybe could be fixed in handler types\n this.panGestureHandler.current?.setNativeProps({\n hitSlop,\n activeOffsetX: gestureOrientation * minSwipeDistance!,\n });\n };\n\n private animateDrawer = (\n fromValue: number | null | undefined,\n toValue: number,\n velocity: number,\n speed?: number\n ) => {\n this.state.dragX.setValue(0);\n this.state.touchX.setValue(\n this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth\n );\n\n if (fromValue != null) {\n let nextFramePosition = fromValue;\n if (this.props.useNativeAnimations) {\n // When using native driver, we predict the next position of the\n // animation because it takes one frame of a roundtrip to pass RELEASE\n // event from native driver to JS before we can start animating. Without\n // it, it is more noticable that the frame is dropped.\n if (fromValue < toValue && velocity > 0) {\n nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);\n } else if (fromValue > toValue && velocity < 0) {\n nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);\n }\n }\n this.state.drawerTranslation.setValue(nextFramePosition);\n }\n\n const willShow = toValue !== 0;\n this.updateShowing(willShow);\n this.emitStateChanged(SETTLING, willShow);\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');\n }\n Animated.spring(this.state.drawerTranslation, {\n velocity,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n speed: speed ?? undefined,\n }).start(({ finished }) => {\n if (finished) {\n this.emitStateChanged(IDLE, willShow);\n if (willShow) {\n this.props.onDrawerOpen?.();\n } else {\n this.props.onDrawerClose?.();\n }\n }\n });\n };\n\n openDrawer = (options: DrawerMovementOption = {}) => {\n this.animateDrawer(\n // TODO: decide if it should be null or undefined is the proper value\n undefined,\n this.props.drawerWidth!,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would not be clickable\n this.forceUpdate();\n };\n\n closeDrawer = (options: DrawerMovementOption = {}) => {\n // TODO: decide if it should be null or undefined is the proper value\n this.animateDrawer(\n undefined,\n 0,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would be still clickable\n this.forceUpdate();\n };\n\n private renderOverlay = () => {\n /* Overlay styles */\n invariant(this.openValue, 'should be set');\n const overlayOpacity = this.openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n const dynamicOverlayStyles = {\n opacity: overlayOpacity,\n backgroundColor: this.props.overlayColor,\n };\n\n return (\n <TapGestureHandler onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={this.drawerShown ? 'auto' : 'none'}\n ref={this.pointerEventsView}\n style={[styles.overlay, dynamicOverlayStyles]}\n />\n </TapGestureHandler>\n );\n };\n\n private renderDrawer = () => {\n const {\n drawerBackgroundColor,\n drawerWidth,\n drawerPosition,\n drawerType,\n drawerContainerStyle,\n contentContainerStyle,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n const drawerSlide = drawerType !== 'back';\n const containerSlide = drawerType !== 'front';\n\n // we rely on row and row-reverse flex directions to position the drawer\n // properly. Apparently for RTL these are flipped which requires us to use\n // the opposite setting for the drawer to appear from left or right\n // according to the drawerPosition prop\n const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;\n\n const dynamicDrawerStyles = {\n backgroundColor: drawerBackgroundColor,\n width: drawerWidth,\n };\n const openValue = this.openValue;\n invariant(openValue, 'should be set');\n\n let containerStyles;\n if (containerSlide) {\n const containerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: fromLeft ? [0, drawerWidth!] : [0, -drawerWidth!],\n extrapolate: 'clamp',\n });\n containerStyles = {\n transform: [{ translateX: containerTranslateX }],\n };\n }\n\n let drawerTranslateX: number | Animated.AnimatedInterpolation = 0;\n if (drawerSlide) {\n const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;\n drawerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [closedDrawerOffset, 0],\n extrapolate: 'clamp',\n });\n }\n const drawerStyles: {\n transform: { translateX: number | Animated.AnimatedInterpolation }[];\n flexDirection: 'row-reverse' | 'row';\n } = {\n transform: [{ translateX: drawerTranslateX }],\n flexDirection: reverseContentDirection ? 'row-reverse' : 'row',\n };\n\n return (\n <Animated.View style={styles.main} onLayout={this.handleContainerLayout}>\n <Animated.View\n style={[\n drawerType === 'front'\n ? styles.containerOnBack\n : styles.containerInFront,\n containerStyles,\n contentContainerStyle,\n ]}\n importantForAccessibility={\n this.drawerShown ? 'no-hide-descendants' : 'yes'\n }>\n {typeof this.props.children === 'function'\n ? this.props.children(this.openValue)\n : this.props.children}\n {this.renderOverlay()}\n </Animated.View>\n <Animated.View\n pointerEvents=\"box-none\"\n ref={this.accessibilityIsModalView}\n accessibilityViewIsModal={this.drawerShown}\n style={[styles.drawerContainer, drawerStyles, drawerContainerStyle]}>\n <View style={dynamicDrawerStyles}>\n {this.props.renderNavigationView(this.openValue as Animated.Value)}\n </View>\n </Animated.View>\n </Animated.View>\n );\n };\n\n private setPanGestureRef = (ref: PanGestureHandler) => {\n // TODO(TS): make sure it is OK taken from\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842\n (this\n .panGestureHandler as React.MutableRefObject<PanGestureHandler>).current = ref;\n this.props.onGestureRef?.(ref);\n };\n\n render() {\n const {\n drawerPosition,\n drawerLockMode,\n edgeWidth,\n minSwipeDistance,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }\n : { right: 0, width: this.drawerShown ? undefined : edgeWidth };\n\n return (\n <PanGestureHandler\n // @ts-ignore could be fixed in handler types\n ref={this.setPanGestureRef}\n hitSlop={hitSlop}\n activeOffsetX={gestureOrientation * minSwipeDistance!}\n failOffsetY={[-15, 15]}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.openingHandlerStateChange}\n enableTrackpadTwoFingerGesture={\n this.props.enableTrackpadTwoFingerGesture\n }\n enabled={\n drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'\n }>\n {this.renderDrawer()}\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n drawerContainer: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1001,\n flexDirection: 'row',\n },\n containerInFront: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1002,\n },\n containerOnBack: {\n ...StyleSheet.absoluteFillObject,\n },\n main: {\n flex: 1,\n zIndex: 0,\n overflow: 'hidden',\n },\n overlay: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1000,\n },\n});\n"]}
|
1
|
+
{"version":3,"sources":["DrawerLayout.tsx"],"names":["React","Component","invariant","Animated","StyleSheet","View","Keyboard","StatusBar","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","IDLE","DRAGGING","SETTLING","DrawerLayout","constructor","props","createRef","state","drawerPosition","drawerWidth","drawerType","dragX","dragXValue","touchX","touchXValue","drawerTranslation","containerWidth","multiply","Value","add","setValue","translationX","startPositionX","dragOffsetFromOnStartPosition","interpolate","inputRange","outputRange","openValue","extrapolate","gestureOptions","useNativeDriver","useNativeAnimations","onDrawerSlide","listener","ev","Math","floor","abs","nativeEvent","position","onGestureEvent","event","x","setState","layout","width","newState","drawerWillShow","onDrawerStateChanged","oldState","ACTIVE","handleRelease","emitStateChanged","drawerState","keyboardDismissMode","dismiss","hideStatusBar","setHidden","statusBarAnimation","drawerShown","drawerLockMode","closeDrawer","velocityX","gestureStartX","dragOffsetBasedOnStart","startOffsetX","projOffsetX","shouldOpen","animateDrawer","showing","accessibilityIsModalView","current","setNativeProps","accessibilityViewIsModal","pointerEventsView","pointerEvents","minSwipeDistance","edgeWidth","fromLeft","gestureOrientation","hitSlop","left","undefined","right","panGestureHandler","activeOffsetX","fromValue","toValue","velocity","speed","nextFramePosition","min","max","willShow","updateShowing","spring","bounciness","start","finished","drawerOpened","onDrawerOpen","onDrawerClose","options","forceUpdate","overlayOpacity","dynamicOverlayStyles","opacity","backgroundColor","overlayColor","onTapHandlerStateChange","styles","overlay","drawerBackgroundColor","drawerContainerStyle","contentContainerStyle","drawerSlide","containerSlide","reverseContentDirection","isRTL","dynamicDrawerStyles","containerStyles","containerTranslateX","transform","translateX","drawerTranslateX","closedDrawerOffset","drawerStyles","flexDirection","main","handleContainerLayout","containerOnBack","containerInFront","children","renderOverlay","drawerContainer","renderNavigationView","ref","onGestureRef","updateAnimatedEvent","shouldComponentUpdate","render","setPanGestureRef","openingHandlerStateChange","enableTrackpadTwoFingerGesture","renderDrawer","Left","Right","create","absoluteFillObject","zIndex","flex","overflow"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SACEC,QADF,EAEEC,U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AAnB,IAAsCA,cAAc,KAAK;AAZ7D,OAcG,KAAKoF,YAAL,EAdH,CADF;AAkBD;;AA7gBD;;gBAHmB7I,Y,kBAIG;AACpBM,EAAAA,WAAW,EAAE,GADO;AAEpBD,EAAAA,cAAc,EAAE,MAFI;AAGpBuB,EAAAA,mBAAmB,EAAE,IAHD;AAIpBrB,EAAAA,UAAU,EAAE,OAJQ;AAKpBmE,EAAAA,SAAS,EAAE,EALS;AAMpBD,EAAAA,gBAAgB,EAAE,CANE;AAOpBgC,EAAAA,YAAY,EAAE,oBAPM;AAQpBhD,EAAAA,cAAc,EAAE,UARI;AASpBmF,EAAAA,8BAA8B,EAAE;AATZ,C;;gBAJH5I,Y,eAyDA;AACjB8I,EAAAA,IAAI,EAAE,MADW;AAEjBC,EAAAA,KAAK,EAAE;AAFU,C;;AA0drB,MAAMpC,MAAM,GAAGvH,UAAU,CAAC4J,MAAX,CAAkB;AAC/Bb,EAAAA,eAAe,EAAE,EACf,GAAG/I,UAAU,CAAC6J,kBADC;AAEfC,IAAAA,MAAM,EAAE,IAFO;AAGftB,IAAAA,aAAa,EAAE;AAHA,GADc;AAM/BI,EAAAA,gBAAgB,EAAE,EAChB,GAAG5I,UAAU,CAAC6J,kBADE;AAEhBC,IAAAA,MAAM,EAAE;AAFQ,GANa;AAU/BnB,EAAAA,eAAe,EAAE,EACf,GAAG3I,UAAU,CAAC6J;AADC,GAVc;AAa/BpB,EAAAA,IAAI,EAAE;AACJsB,IAAAA,IAAI,EAAE,CADF;AAEJD,IAAAA,MAAM,EAAE,CAFJ;AAGJE,IAAAA,QAAQ,EAAE;AAHN,GAbyB;AAkB/BxC,EAAAA,OAAO,EAAE,EACP,GAAGxH,UAAU,CAAC6J,kBADP;AAEPC,IAAAA,MAAM,EAAE;AAFD;AAlBsB,CAAlB,CAAf","sourcesContent":["// This component is based on RN's DrawerLayoutAndroid API\n//\n// It perhaps deserves to be put in a separate repo, but since it relies on\n// react-native-gesture-handler library which isn't very popular at the moment I\n// decided to keep it here for the time being. It will allow us to move faster\n// and fix issues that may arise in gesture handler library that could be found\n// when using the drawer component\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport invariant from 'invariant';\nimport {\n Animated,\n StyleSheet,\n View,\n Keyboard,\n StatusBar,\n I18nManager,\n StatusBarAnimation,\n StyleProp,\n ViewStyle,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\nconst IDLE: DrawerState = 'Idle';\nconst DRAGGING: DrawerState = 'Dragging';\nconst SETTLING: DrawerState = 'Settling';\n\nexport type DrawerPosition = 'left' | 'right';\n\nexport type DrawerState = 'Idle' | 'Dragging' | 'Settling';\n\nexport type DrawerType = 'front' | 'back' | 'slide';\n\nexport type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';\n\nexport type DrawerKeyboardDismissMode = 'none' | 'on-drag';\n\nexport interface DrawerLayoutProps {\n /**\n * This attribute is present in the standard implementation already and is one\n * of the required params. Gesture handler version of DrawerLayout make it\n * possible for the function passed as `renderNavigationView` to take an\n * Animated value as a parameter that indicates the progress of drawer\n * opening/closing animation (progress value is 0 when closed and 1 when\n * opened). This can be used by the drawer component to animated its children\n * while the drawer is opening or closing.\n */\n renderNavigationView: (\n progressAnimatedValue: Animated.Value\n ) => React.ReactNode;\n\n drawerPosition?: DrawerPosition;\n\n drawerWidth?: number;\n\n drawerBackgroundColor?: string;\n\n drawerLockMode?: DrawerLockMode;\n\n keyboardDismissMode?: DrawerKeyboardDismissMode;\n\n /**\n * Called when the drawer is closed.\n */\n onDrawerClose?: () => void;\n\n /**\n * Called when the drawer is opened.\n */\n onDrawerOpen?: () => void;\n\n /**\n * Called when the status of the drawer changes.\n */\n onDrawerStateChanged?: (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => void;\n useNativeAnimations?: boolean;\n\n drawerType?: DrawerType;\n\n /**\n * Defines how far from the edge of the content view the gesture should\n * activate.\n */\n edgeWidth?: number;\n\n minSwipeDistance?: number;\n\n /**\n * When set to true Drawer component will use\n * {@link https://reactnative.dev/docs/statusbar StatusBar} API to hide the OS\n * status bar whenever the drawer is pulled or when its in an \"open\" state.\n */\n hideStatusBar?: boolean;\n\n /**\n * @default 'slide'\n *\n * Can be used when hideStatusBar is set to true and will select the animation\n * used for hiding/showing the status bar. See\n * {@link https://reactnative.dev/docs/statusbar StatusBar} documentation for\n * more details\n */\n statusBarAnimation?: StatusBarAnimation;\n\n /**\n * @default black\n *\n * Color of a semi-transparent overlay to be displayed on top of the content\n * view when drawer gets open. A solid color should be used as the opacity is\n * added by the Drawer itself and the opacity of the overlay is animated (from\n * 0% to 70%).\n */\n overlayColor?: string;\n\n contentContainerStyle?: StyleProp<ViewStyle>;\n\n drawerContainerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n onDrawerSlide?: (position: number) => void;\n\n onGestureRef?: (ref: PanGestureHandler) => void;\n\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?:\n | React.ReactNode\n | ((openValue?: Animated.AnimatedInterpolation) => React.ReactNode);\n}\n\nexport type DrawerLayoutState = {\n dragX: Animated.Value;\n touchX: Animated.Value;\n drawerTranslation: Animated.Value;\n containerWidth: number;\n drawerState: DrawerState;\n drawerOpened: boolean;\n};\n\nexport type DrawerMovementOption = {\n velocity?: number;\n speed?: number;\n};\nexport default class DrawerLayout extends Component<\n DrawerLayoutProps,\n DrawerLayoutState\n> {\n static defaultProps = {\n drawerWidth: 200,\n drawerPosition: 'left',\n useNativeAnimations: true,\n drawerType: 'front',\n edgeWidth: 20,\n minSwipeDistance: 3,\n overlayColor: 'rgba(0, 0, 0, 0.7)',\n drawerLockMode: 'unlocked',\n enableTrackpadTwoFingerGesture: false,\n };\n\n constructor(props: DrawerLayoutProps) {\n super(props);\n\n const dragX = new Animated.Value(0);\n const touchX = new Animated.Value(0);\n const drawerTranslation = new Animated.Value(0);\n\n this.state = {\n dragX,\n touchX,\n drawerTranslation,\n containerWidth: 0,\n drawerState: IDLE,\n drawerOpened: false,\n };\n\n this.updateAnimatedEvent(props, this.state);\n }\n\n shouldComponentUpdate(props: DrawerLayoutProps, state: DrawerLayoutState) {\n if (\n this.props.drawerPosition !== props.drawerPosition ||\n this.props.drawerWidth !== props.drawerWidth ||\n this.props.drawerType !== props.drawerType ||\n this.state.containerWidth !== state.containerWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n\n return true;\n }\n\n private openValue?: Animated.AnimatedInterpolation;\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private accessibilityIsModalView = React.createRef<View>();\n private pointerEventsView = React.createRef<View>();\n private panGestureHandler = React.createRef<PanGestureHandler | null>();\n private drawerShown = false;\n\n static positions = {\n Left: 'left',\n Right: 'right',\n };\n\n private updateAnimatedEvent = (\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) => {\n // Event definition is based on\n const { drawerPosition, drawerWidth, drawerType } = props;\n const {\n dragX: dragXValue,\n touchX: touchXValue,\n drawerTranslation,\n containerWidth,\n } = state;\n\n let dragX = dragXValue;\n let touchX = touchXValue;\n\n if (drawerPosition !== 'left') {\n // Most of the code is written in a way to handle left-side drawer. In\n // order to handle right-side drawer the only thing we need to do is to\n // reverse events coming from gesture handler in a way they emulate\n // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is\n // calulcated by subtracing real touchX from the width of the container\n // (such that when touch happens at the right edge the value is simply 0)\n dragX = Animated.multiply(\n new Animated.Value(-1),\n dragXValue\n ) as Animated.Value; // TODO(TS): (for all \"as\" in this file) make sure we can map this\n touchX = Animated.add(\n new Animated.Value(containerWidth),\n Animated.multiply(new Animated.Value(-1), touchXValue)\n ) as Animated.Value; // TODO(TS): make sure we can map this;\n touchXValue.setValue(containerWidth);\n } else {\n touchXValue.setValue(0);\n }\n\n // While closing the drawer when user starts gesture outside of its area (in greyed\n // out part of the window), we want the drawer to follow only once finger reaches the\n // edge of the drawer.\n // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by\n // dots. The touch gesture starts at '*' and moves left, touch path is indicated by\n // an arrow pointing left\n // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // +---------------+ +---------------+ +---------------+ +---------------+\n //\n // For the above to work properly we define animated value that will keep\n // start position of the gesture. Then we use that value to calculate how\n // much we need to subtract from the dragX. If the gesture started on the\n // greyed out area we take the distance from the edge of the drawer to the\n // start position. Otherwise we don't subtract at all and the drawer be\n // pulled back as soon as you start the pan.\n //\n // This is used only when drawerType is \"front\"\n //\n let translationX = dragX;\n if (drawerType === 'front') {\n const startPositionX = Animated.add(\n touchX,\n Animated.multiply(new Animated.Value(-1), dragX)\n );\n\n const dragOffsetFromOnStartPosition = startPositionX.interpolate({\n inputRange: [drawerWidth! - 1, drawerWidth!, drawerWidth! + 1],\n outputRange: [0, 0, 1],\n });\n translationX = Animated.add(\n dragX,\n dragOffsetFromOnStartPosition\n ) as Animated.Value; // TODO: as above\n }\n\n this.openValue = Animated.add(translationX, drawerTranslation).interpolate({\n inputRange: [0, drawerWidth!],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n\n const gestureOptions: {\n useNativeDriver: boolean;\n // TODO: make sure it is correct\n listener?: (\n ev: NativeSyntheticEvent<PanGestureHandlerEventPayload>\n ) => void;\n } = {\n useNativeDriver: props.useNativeAnimations!,\n };\n\n if (this.props.onDrawerSlide) {\n gestureOptions.listener = (ev) => {\n const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));\n const position = translationX / this.state.containerWidth;\n\n this.props.onDrawerSlide?.(position);\n };\n }\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragXValue, x: touchXValue } }],\n gestureOptions\n );\n };\n\n private handleContainerLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ containerWidth: nativeEvent.layout.width });\n };\n\n private emitStateChanged = (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => {\n this.props.onDrawerStateChanged?.(newState, drawerWillShow);\n };\n\n private openingHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease({ nativeEvent });\n } else if (nativeEvent.state === State.ACTIVE) {\n this.emitStateChanged(DRAGGING, false);\n this.setState({ drawerState: DRAGGING });\n if (this.props.keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');\n }\n }\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (\n this.drawerShown &&\n nativeEvent.oldState === State.ACTIVE &&\n this.props.drawerLockMode !== 'locked-open'\n ) {\n this.closeDrawer();\n }\n };\n\n private handleRelease = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n const { drawerWidth, drawerPosition, drawerType } = this.props;\n const { containerWidth } = this.state;\n let { translationX: dragX, velocityX, x: touchX } = nativeEvent;\n\n if (drawerPosition !== 'left') {\n // See description in _updateAnimatedEvent about why events are flipped\n // for right-side drawer\n dragX = -dragX;\n touchX = containerWidth - touchX;\n velocityX = -velocityX;\n }\n\n const gestureStartX = touchX - dragX;\n let dragOffsetBasedOnStart = 0;\n\n if (drawerType === 'front') {\n dragOffsetBasedOnStart =\n gestureStartX > drawerWidth! ? gestureStartX - drawerWidth! : 0;\n }\n\n const startOffsetX =\n dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth! : 0);\n const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;\n\n const shouldOpen = projOffsetX > drawerWidth! / 2;\n\n if (shouldOpen) {\n this.animateDrawer(startOffsetX, drawerWidth!, velocityX);\n } else {\n this.animateDrawer(startOffsetX, 0, velocityX);\n }\n };\n\n private updateShowing = (showing: boolean) => {\n this.drawerShown = showing;\n this.accessibilityIsModalView.current?.setNativeProps({\n accessibilityViewIsModal: showing,\n });\n this.pointerEventsView.current?.setNativeProps({\n pointerEvents: showing ? 'auto' : 'none',\n });\n const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;\n const fromLeft = drawerPosition === 'left';\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: showing ? undefined : edgeWidth }\n : { right: 0, width: showing ? undefined : edgeWidth };\n // @ts-ignore internal API, maybe could be fixed in handler types\n this.panGestureHandler.current?.setNativeProps({\n hitSlop,\n activeOffsetX: gestureOrientation * minSwipeDistance!,\n });\n };\n\n private animateDrawer = (\n fromValue: number | null | undefined,\n toValue: number,\n velocity: number,\n speed?: number\n ) => {\n this.state.dragX.setValue(0);\n this.state.touchX.setValue(\n this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth\n );\n\n if (fromValue != null) {\n let nextFramePosition = fromValue;\n if (this.props.useNativeAnimations) {\n // When using native driver, we predict the next position of the\n // animation because it takes one frame of a roundtrip to pass RELEASE\n // event from native driver to JS before we can start animating. Without\n // it, it is more noticable that the frame is dropped.\n if (fromValue < toValue && velocity > 0) {\n nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);\n } else if (fromValue > toValue && velocity < 0) {\n nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);\n }\n }\n this.state.drawerTranslation.setValue(nextFramePosition);\n }\n\n const willShow = toValue !== 0;\n this.updateShowing(willShow);\n this.emitStateChanged(SETTLING, willShow);\n this.setState({ drawerState: SETTLING });\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');\n }\n Animated.spring(this.state.drawerTranslation, {\n velocity,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n speed: speed ?? undefined,\n }).start(({ finished }) => {\n if (finished) {\n this.emitStateChanged(IDLE, willShow);\n this.setState({ drawerOpened: willShow });\n if (this.state.drawerState !== DRAGGING) {\n // it's possilbe that user started drag while the drawer\n // was settling, don't override state in this case\n this.setState({ drawerState: IDLE });\n }\n if (willShow) {\n this.props.onDrawerOpen?.();\n } else {\n this.props.onDrawerClose?.();\n }\n }\n });\n };\n\n openDrawer = (options: DrawerMovementOption = {}) => {\n this.animateDrawer(\n // TODO: decide if it should be null or undefined is the proper value\n undefined,\n this.props.drawerWidth!,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would not be clickable\n this.forceUpdate();\n };\n\n closeDrawer = (options: DrawerMovementOption = {}) => {\n // TODO: decide if it should be null or undefined is the proper value\n this.animateDrawer(\n undefined,\n 0,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would be still clickable\n this.forceUpdate();\n };\n\n private renderOverlay = () => {\n /* Overlay styles */\n invariant(this.openValue, 'should be set');\n let overlayOpacity;\n\n if (this.state.drawerState !== IDLE) {\n overlayOpacity = this.openValue;\n } else {\n overlayOpacity = this.state.drawerOpened ? 1 : 0;\n }\n\n const dynamicOverlayStyles = {\n opacity: overlayOpacity,\n backgroundColor: this.props.overlayColor,\n };\n\n return (\n <TapGestureHandler onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={this.drawerShown ? 'auto' : 'none'}\n ref={this.pointerEventsView}\n style={[styles.overlay, dynamicOverlayStyles]}\n />\n </TapGestureHandler>\n );\n };\n\n private renderDrawer = () => {\n const {\n drawerBackgroundColor,\n drawerWidth,\n drawerPosition,\n drawerType,\n drawerContainerStyle,\n contentContainerStyle,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n const drawerSlide = drawerType !== 'back';\n const containerSlide = drawerType !== 'front';\n\n // we rely on row and row-reverse flex directions to position the drawer\n // properly. Apparently for RTL these are flipped which requires us to use\n // the opposite setting for the drawer to appear from left or right\n // according to the drawerPosition prop\n const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;\n\n const dynamicDrawerStyles = {\n backgroundColor: drawerBackgroundColor,\n width: drawerWidth,\n };\n const openValue = this.openValue;\n invariant(openValue, 'should be set');\n\n let containerStyles;\n if (containerSlide) {\n const containerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: fromLeft ? [0, drawerWidth!] : [0, -drawerWidth!],\n extrapolate: 'clamp',\n });\n containerStyles = {\n transform: [{ translateX: containerTranslateX }],\n };\n }\n\n let drawerTranslateX: number | Animated.AnimatedInterpolation = 0;\n if (drawerSlide) {\n const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;\n if (this.state.drawerState !== IDLE) {\n drawerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [closedDrawerOffset, 0],\n extrapolate: 'clamp',\n });\n } else {\n drawerTranslateX = this.state.drawerOpened ? 0 : closedDrawerOffset;\n }\n }\n const drawerStyles: {\n transform: { translateX: number | Animated.AnimatedInterpolation }[];\n flexDirection: 'row-reverse' | 'row';\n } = {\n transform: [{ translateX: drawerTranslateX }],\n flexDirection: reverseContentDirection ? 'row-reverse' : 'row',\n };\n\n return (\n <Animated.View style={styles.main} onLayout={this.handleContainerLayout}>\n <Animated.View\n style={[\n drawerType === 'front'\n ? styles.containerOnBack\n : styles.containerInFront,\n containerStyles,\n contentContainerStyle,\n ]}\n importantForAccessibility={\n this.drawerShown ? 'no-hide-descendants' : 'yes'\n }>\n {typeof this.props.children === 'function'\n ? this.props.children(this.openValue)\n : this.props.children}\n {this.renderOverlay()}\n </Animated.View>\n <Animated.View\n pointerEvents=\"box-none\"\n ref={this.accessibilityIsModalView}\n accessibilityViewIsModal={this.drawerShown}\n style={[styles.drawerContainer, drawerStyles, drawerContainerStyle]}>\n <View style={dynamicDrawerStyles}>\n {this.props.renderNavigationView(this.openValue as Animated.Value)}\n </View>\n </Animated.View>\n </Animated.View>\n );\n };\n\n private setPanGestureRef = (ref: PanGestureHandler) => {\n // TODO(TS): make sure it is OK taken from\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842\n (this\n .panGestureHandler as React.MutableRefObject<PanGestureHandler>).current = ref;\n this.props.onGestureRef?.(ref);\n };\n\n render() {\n const {\n drawerPosition,\n drawerLockMode,\n edgeWidth,\n minSwipeDistance,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }\n : { right: 0, width: this.drawerShown ? undefined : edgeWidth };\n\n return (\n <PanGestureHandler\n // @ts-ignore could be fixed in handler types\n ref={this.setPanGestureRef}\n hitSlop={hitSlop}\n activeOffsetX={gestureOrientation * minSwipeDistance!}\n failOffsetY={[-15, 15]}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.openingHandlerStateChange}\n enableTrackpadTwoFingerGesture={\n this.props.enableTrackpadTwoFingerGesture\n }\n enabled={\n drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'\n }>\n {this.renderDrawer()}\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n drawerContainer: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1001,\n flexDirection: 'row',\n },\n containerInFront: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1002,\n },\n containerOnBack: {\n ...StyleSheet.absoluteFillObject,\n },\n main: {\n flex: 1,\n zIndex: 0,\n overflow: 'hidden',\n },\n overlay: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1000,\n },\n});\n"]}
|