react-native-gesture-handler 2.16.0-rc.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +2 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +9 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +2 -2
- package/android/src/main/java/com/swmansion/gesturehandler/core/DiagonalDirections.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +61 -24
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +17 -22
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +30 -11
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/Vector.kt +66 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +119 -19
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +2 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +1 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +4 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +1 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +4 -7
- package/apple/Handlers/RNLongPressHandler.m +5 -13
- package/apple/Handlers/RNPinchHandler.m +12 -1
- package/apple/RNGestureHandler.m +3 -1
- package/lib/commonjs/Directions.js +19 -6
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.js +97 -4
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.native.js +16 -0
- package/lib/commonjs/RNGestureHandlerModule.native.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +5 -10
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.native.js +16 -0
- package/lib/commonjs/RNRenderer.native.js.map +1 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +19 -82
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.native.js +115 -0
- package/lib/commonjs/components/GestureComponents.native.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +13 -3
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.native.js +14 -0
- package/lib/commonjs/components/GestureHandlerButton.native.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +0 -6
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +7 -1
- package/lib/commonjs/components/GestureHandlerRootView.native.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +3 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.js +1 -12
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.native.js +22 -0
- package/lib/commonjs/getReactNativeVersion.native.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +5 -34
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.native.js +44 -0
- package/lib/commonjs/getShadowNodeFromRef.native.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +5 -7
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.native.js +14 -0
- package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +11 -5
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +11 -0
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -0
- package/lib/commonjs/handlers/customDirectEventTypes.native.js +14 -0
- package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +13 -2
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +25 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +13 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +17 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +135 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +66 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +12 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +10 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +76 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +42 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mocks.js +2 -0
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/utils.js +5 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +66 -0
- package/lib/commonjs/web/Gestures.js.map +1 -0
- package/lib/commonjs/web/constants.js +3 -8
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +36 -12
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +11 -9
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/IGestureHandler.js +2 -0
- package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +5 -6
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +3 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +1 -13
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +114 -115
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +10 -5
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +12 -3
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +55 -27
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +26 -5
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +58 -0
- package/lib/commonjs/web/tools/Vector.js.map +1 -0
- package/lib/commonjs/web/utils.js +9 -1
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/Directions.js +16 -4
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +84 -4
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.native.js +5 -0
- package/lib/module/RNGestureHandlerModule.native.js.map +1 -0
- package/lib/module/RNRenderer.js +3 -3
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.native.js +4 -0
- package/lib/module/RNRenderer.native.js.map +1 -0
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureComponents.js +18 -80
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.native.js +90 -0
- package/lib/module/components/GestureComponents.native.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.js +8 -2
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.native.js +3 -0
- package/lib/module/components/GestureHandlerButton.native.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +0 -5
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +6 -1
- package/lib/module/components/GestureHandlerRootView.native.js.map +1 -0
- package/lib/module/components/Swipeable.js +3 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +1 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/getReactNativeVersion.js +1 -7
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.native.js +10 -0
- package/lib/module/getReactNativeVersion.native.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +4 -33
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.native.js +37 -0
- package/lib/module/getShadowNodeFromRef.native.js.map +1 -0
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.js +4 -2
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.native.js +3 -0
- package/lib/module/handlers/PressabilityDebugView.native.js.map +1 -0
- package/lib/module/handlers/createHandler.js +11 -6
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +5 -0
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -0
- package/lib/module/handlers/customDirectEventTypes.native.js +3 -0
- package/lib/module/handlers/customDirectEventTypes.native.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +11 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +25 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +13 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +17 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +135 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +67 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +12 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +10 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +76 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +42 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks.js +2 -0
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/utils.js +5 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/Gestures.js +39 -0
- package/lib/module/web/Gestures.js.map +1 -0
- package/lib/module/web/constants.js +1 -6
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +34 -12
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +10 -9
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/IGestureHandler.js +2 -0
- package/lib/module/web/handlers/IGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +5 -6
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +3 -1
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +0 -11
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/EventManager.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +114 -115
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +9 -4
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +9 -3
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +53 -26
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +26 -5
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/tools/Vector.js +47 -0
- package/lib/module/web/tools/Vector.js.map +1 -0
- package/lib/module/web/utils.js +2 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/typescript/Directions.d.ts +7 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +15 -2
- package/lib/typescript/RNGestureHandlerModule.native.d.ts +2 -0
- package/lib/typescript/RNRenderer.d.ts +3 -1
- package/lib/typescript/RNRenderer.native.d.ts +1 -0
- package/lib/typescript/components/DrawerLayout.d.ts +1 -2
- package/lib/typescript/components/GestureComponents.d.ts +7 -21
- package/lib/typescript/components/GestureComponents.native.d.ts +22 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
- package/lib/typescript/components/GestureHandlerButton.native.d.ts +4 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +2 -1
- package/lib/typescript/getReactNativeVersion.d.ts +1 -4
- package/lib/typescript/getReactNativeVersion.native.d.ts +4 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/getShadowNodeFromRef.native.d.ts +1 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts +4 -4
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
- package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +2 -0
- package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +1 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +11 -2
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +38 -1
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +11 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +14 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +114 -2
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +57 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +10 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +8 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +67 -4
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +35 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/mocks.d.ts +1 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +4 -1
- package/lib/typescript/web/Gestures.d.ts +36 -0
- package/lib/typescript/web/constants.d.ts +1 -6
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +3 -3
- package/lib/typescript/web/handlers/GestureHandler.d.ts +13 -11
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +38 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web/interfaces.d.ts +8 -10
- package/lib/typescript/web/tools/EventManager.d.ts +15 -12
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +3 -4
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +7 -5
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -3
- package/lib/typescript/web/tools/InteractionManager.d.ts +6 -6
- package/lib/typescript/web/tools/NodeManager.d.ts +4 -3
- package/lib/typescript/web/tools/PointerEventManager.d.ts +11 -2
- package/lib/typescript/web/tools/TouchEventManager.d.ts +6 -1
- package/lib/typescript/web/tools/Vector.d.ts +15 -0
- package/lib/typescript/web/utils.d.ts +4 -4
- package/lib/typescript/web_hammer/NodeManager.d.ts +1 -1
- package/package.json +4 -2
- package/src/Directions.ts +21 -4
- package/src/RNGestureHandlerModule.native.ts +5 -0
- package/src/RNGestureHandlerModule.ts +104 -4
- package/src/RNRenderer.native.ts +3 -0
- package/src/RNRenderer.ts +3 -3
- package/src/components/DrawerLayout.tsx +1 -1
- package/src/components/GestureComponents.native.tsx +148 -0
- package/src/components/GestureComponents.tsx +24 -131
- package/src/components/GestureHandlerButton.native.tsx +5 -0
- package/src/components/GestureHandlerButton.tsx +5 -4
- package/src/components/{GestureHandlerRootView.web.tsx → GestureHandlerRootView.native.tsx} +6 -0
- package/src/components/GestureHandlerRootView.tsx +0 -6
- package/src/components/Swipeable.tsx +2 -0
- package/src/components/touchables/GenericTouchable.tsx +3 -0
- package/src/getReactNativeVersion.native.ts +11 -0
- package/src/getReactNativeVersion.ts +1 -9
- package/src/getShadowNodeFromRef.native.ts +44 -0
- package/src/getShadowNodeFromRef.ts +4 -41
- package/src/handlers/PanGestureHandler.ts +8 -4
- package/src/handlers/PressabilityDebugView.native.tsx +2 -0
- package/src/handlers/PressabilityDebugView.tsx +4 -2
- package/src/handlers/createHandler.tsx +24 -14
- package/src/handlers/customDirectEventTypes.native.ts +2 -0
- package/src/handlers/customDirectEventTypes.ts +5 -0
- package/src/handlers/gestureHandlerCommon.ts +28 -1
- package/src/handlers/gestures/GestureDetector.tsx +62 -4
- package/src/handlers/gestures/flingGesture.ts +11 -0
- package/src/handlers/gestures/forceTouchGesture.ts +14 -0
- package/src/handlers/gestures/gesture.ts +114 -1
- package/src/handlers/gestures/gestureObjects.ts +57 -0
- package/src/handlers/gestures/gestureStateManager.web.ts +1 -1
- package/src/handlers/gestures/hoverGesture.ts +1 -1
- package/src/handlers/gestures/longPressGesture.ts +10 -0
- package/src/handlers/gestures/nativeGesture.ts +8 -0
- package/src/handlers/gestures/panGesture.ts +75 -4
- package/src/handlers/gestures/tapGesture.ts +35 -0
- package/src/index.ts +1 -1
- package/src/mocks.ts +2 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +4 -0
- package/src/utils.ts +9 -2
- package/src/web/Gestures.ts +41 -0
- package/src/web/constants.ts +1 -7
- package/src/web/handlers/FlingGestureHandler.ts +54 -24
- package/src/web/handlers/GestureHandler.ts +23 -19
- package/src/web/handlers/IGestureHandler.ts +50 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +5 -6
- package/src/web/handlers/PanGestureHandler.ts +4 -0
- package/src/web/interfaces.ts +14 -10
- package/src/web/tools/EventManager.ts +16 -14
- package/src/web/tools/GestureHandlerDelegate.ts +3 -4
- package/src/web/tools/GestureHandlerOrchestrator.ts +160 -145
- package/src/web/tools/GestureHandlerWebDelegate.ts +14 -9
- package/src/web/tools/InteractionManager.ts +18 -12
- package/src/web/tools/NodeManager.ts +4 -3
- package/src/web/tools/PointerEventManager.ts +181 -166
- package/src/web/tools/TouchEventManager.ts +126 -114
- package/src/web/tools/Vector.ts +60 -0
- package/src/web/utils.ts +7 -4
- package/src/web_hammer/NodeManager.ts +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +0 -163
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/commonjs/RNRenderer.web.js +0 -11
- package/lib/commonjs/RNRenderer.web.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.web.js +0 -52
- package/lib/commonjs/components/GestureComponents.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +0 -24
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/getReactNativeVersion.web.js +0 -11
- package/lib/commonjs/getReactNativeVersion.web.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +0 -15
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -12
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.web.js +0 -122
- package/lib/module/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/module/RNRenderer.web.js +0 -4
- package/lib/module/RNRenderer.web.js.map +0 -1
- package/lib/module/components/GestureComponents.web.js +0 -28
- package/lib/module/components/GestureComponents.web.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.web.js +0 -9
- package/lib/module/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/getReactNativeVersion.web.js +0 -4
- package/lib/module/getReactNativeVersion.web.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.web.js +0 -8
- package/lib/module/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.web.js +0 -5
- package/lib/module/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +0 -50
- package/lib/typescript/RNRenderer.web.d.ts +0 -3
- package/lib/typescript/components/GestureComponents.web.d.ts +0 -8
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +0 -4
- package/lib/typescript/getReactNativeVersion.web.d.ts +0 -1
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +0 -1
- package/src/RNGestureHandlerModule.web.ts +0 -146
- package/src/RNRenderer.web.ts +0 -3
- package/src/components/GestureComponents.web.tsx +0 -41
- package/src/components/GestureHandlerButton.web.tsx +0 -6
- package/src/getReactNativeVersion.web.ts +0 -3
- package/src/getShadowNodeFromRef.web.ts +0 -7
- package/src/handlers/PressabilityDebugView.web.tsx +0 -4
- /package/lib/typescript/components/{GestureHandlerRootView.web.d.ts → GestureHandlerRootView.native.d.ts} +0 -0
|
@@ -1,148 +1,41 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
ForwardedRef,
|
|
5
|
-
RefAttributes,
|
|
6
|
-
ReactElement,
|
|
7
|
-
} from 'react';
|
|
8
|
-
import {
|
|
9
|
-
ScrollView as RNScrollView,
|
|
10
|
-
ScrollViewProps as RNScrollViewProps,
|
|
3
|
+
FlatList as RNFlatList,
|
|
11
4
|
Switch as RNSwitch,
|
|
12
|
-
SwitchProps as RNSwitchProps,
|
|
13
5
|
TextInput as RNTextInput,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
FlatList as RNFlatList,
|
|
18
|
-
FlatListProps as RNFlatListProps,
|
|
19
|
-
RefreshControl as RNRefreshControl,
|
|
6
|
+
ScrollView as RNScrollView,
|
|
7
|
+
FlatListProps,
|
|
8
|
+
View,
|
|
20
9
|
} from 'react-native';
|
|
21
10
|
|
|
22
11
|
import createNativeWrapper from '../handlers/createNativeWrapper';
|
|
23
12
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
nativeViewProps,
|
|
27
|
-
} from '../handlers/NativeViewGestureHandler';
|
|
28
|
-
|
|
29
|
-
import { toArray } from '../utils';
|
|
30
|
-
|
|
31
|
-
export const RefreshControl = createNativeWrapper(RNRefreshControl, {
|
|
32
|
-
disallowInterruption: true,
|
|
33
|
-
shouldCancelWhenOutside: false,
|
|
13
|
+
export const ScrollView = createNativeWrapper(RNScrollView, {
|
|
14
|
+
disallowInterruption: false,
|
|
34
15
|
});
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
36
|
-
export type RefreshControl = typeof RefreshControl & RNRefreshControl;
|
|
37
|
-
|
|
38
|
-
const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
|
|
39
|
-
RNScrollView,
|
|
40
|
-
{
|
|
41
|
-
disallowInterruption: true,
|
|
42
|
-
shouldCancelWhenOutside: false,
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
export const ScrollView = React.forwardRef<
|
|
46
|
-
RNScrollView,
|
|
47
|
-
RNScrollViewProps & NativeViewGestureHandlerProps
|
|
48
|
-
>((props, ref) => {
|
|
49
|
-
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
|
50
|
-
const { refreshControl, waitFor, ...rest } = props;
|
|
51
16
|
|
|
52
|
-
|
|
53
|
-
<GHScrollView
|
|
54
|
-
{...rest}
|
|
55
|
-
// @ts-ignore `ref` exists on `GHScrollView`
|
|
56
|
-
ref={ref}
|
|
57
|
-
waitFor={[...toArray(waitFor ?? []), refreshControlGestureRef]}
|
|
58
|
-
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
|
59
|
-
refreshControl={
|
|
60
|
-
refreshControl
|
|
61
|
-
? React.cloneElement(refreshControl, {
|
|
62
|
-
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
|
63
|
-
ref: refreshControlGestureRef,
|
|
64
|
-
})
|
|
65
|
-
: undefined
|
|
66
|
-
}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
});
|
|
70
|
-
// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
|
71
|
-
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
73
|
-
export type ScrollView = typeof GHScrollView & RNScrollView;
|
|
74
|
-
|
|
75
|
-
export const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {
|
|
17
|
+
export const Switch = createNativeWrapper(RNSwitch, {
|
|
76
18
|
shouldCancelWhenOutside: false,
|
|
77
19
|
shouldActivateOnStart: true,
|
|
78
20
|
disallowInterruption: true,
|
|
79
21
|
});
|
|
80
|
-
|
|
81
|
-
export
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export const FlatList = React.forwardRef((props, ref) => {
|
|
95
|
-
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
|
96
|
-
|
|
97
|
-
const { waitFor, refreshControl, ...rest } = props;
|
|
98
|
-
|
|
99
|
-
const flatListProps = {};
|
|
100
|
-
const scrollViewProps = {};
|
|
101
|
-
for (const [propName, value] of Object.entries(rest)) {
|
|
102
|
-
// https://github.com/microsoft/TypeScript/issues/26255
|
|
103
|
-
if ((nativeViewProps as readonly string[]).includes(propName)) {
|
|
104
|
-
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
106
|
-
scrollViewProps[propName] = value;
|
|
107
|
-
} else {
|
|
108
|
-
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
110
|
-
flatListProps[propName] = value;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
22
|
+
export const TextInput = createNativeWrapper(RNTextInput);
|
|
23
|
+
export const DrawerLayoutAndroid = () => {
|
|
24
|
+
console.warn('DrawerLayoutAndroid is not supported on web!');
|
|
25
|
+
return <View />;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// RefreshControl is implemented as a functional component, rendering a View
|
|
29
|
+
// NativeViewGestureHandler needs to set a ref on its child, which cannot be done
|
|
30
|
+
// on functional components
|
|
31
|
+
export const RefreshControl = createNativeWrapper(View);
|
|
32
|
+
|
|
33
|
+
export const FlatList = React.forwardRef(
|
|
34
|
+
<ItemT extends any>(props: FlatListProps<ItemT>, ref: any) => (
|
|
116
35
|
<RNFlatList
|
|
117
36
|
ref={ref}
|
|
118
|
-
{...
|
|
119
|
-
renderScrollComponent={(scrollProps) =>
|
|
120
|
-
<ScrollView
|
|
121
|
-
{...{
|
|
122
|
-
...scrollProps,
|
|
123
|
-
...scrollViewProps,
|
|
124
|
-
waitFor: [...toArray(waitFor ?? []), refreshControlGestureRef],
|
|
125
|
-
}}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
|
129
|
-
refreshControl={
|
|
130
|
-
refreshControl
|
|
131
|
-
? React.cloneElement(refreshControl, {
|
|
132
|
-
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
|
133
|
-
ref: refreshControlGestureRef,
|
|
134
|
-
})
|
|
135
|
-
: undefined
|
|
136
|
-
}
|
|
37
|
+
{...props}
|
|
38
|
+
renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps} />}
|
|
137
39
|
/>
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
props: PropsWithChildren<
|
|
141
|
-
RNFlatListProps<ItemT> &
|
|
142
|
-
RefAttributes<FlatList<ItemT>> &
|
|
143
|
-
NativeViewGestureHandlerProps
|
|
144
|
-
>,
|
|
145
|
-
ref: ForwardedRef<FlatList<ItemT>>
|
|
146
|
-
) => ReactElement | null;
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
148
|
-
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
|
40
|
+
)
|
|
41
|
+
);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HostComponent } from 'react-native';
|
|
2
|
+
import { RawButtonProps } from './GestureButtons';
|
|
3
|
+
import RNGestureHandlerButtonNativeComponent from '../specs/RNGestureHandlerButtonNativeComponent';
|
|
4
|
+
|
|
5
|
+
export default RNGestureHandlerButtonNativeComponent as HostComponent<RawButtonProps>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import RNGestureHandlerButtonNativeComponent from '../specs/RNGestureHandlerButtonNativeComponent';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
4
3
|
|
|
5
|
-
export default
|
|
4
|
+
export default React.forwardRef<View>((props, ref) => (
|
|
5
|
+
<View ref={ref} accessibilityRole="button" {...props} />
|
|
6
|
+
));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { View, ViewProps, StyleSheet } from 'react-native';
|
|
4
|
+
import { maybeInitializeFabric } from '../init';
|
|
4
5
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
|
5
6
|
|
|
6
7
|
export interface GestureHandlerRootViewProps
|
|
@@ -10,6 +11,11 @@ export default function GestureHandlerRootView({
|
|
|
10
11
|
style,
|
|
11
12
|
...rest
|
|
12
13
|
}: GestureHandlerRootViewProps) {
|
|
14
|
+
// try initialize fabric on the first render, at this point we can
|
|
15
|
+
// reliably check if fabric is enabled (the function contains a flag
|
|
16
|
+
// to make sure it's called only once)
|
|
17
|
+
maybeInitializeFabric();
|
|
18
|
+
|
|
13
19
|
return (
|
|
14
20
|
<GestureHandlerRootViewContext.Provider value>
|
|
15
21
|
<View style={style ?? styles.container} {...rest} />
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { View, ViewProps, StyleSheet } from 'react-native';
|
|
4
|
-
import { maybeInitializeFabric } from '../init';
|
|
5
4
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
|
6
5
|
|
|
7
6
|
export interface GestureHandlerRootViewProps
|
|
@@ -11,11 +10,6 @@ export default function GestureHandlerRootView({
|
|
|
11
10
|
style,
|
|
12
11
|
...rest
|
|
13
12
|
}: GestureHandlerRootViewProps) {
|
|
14
|
-
// try initialize fabric on the first render, at this point we can
|
|
15
|
-
// reliably check if fabric is enabled (the function contains a flag
|
|
16
|
-
// to make sure it's called only once)
|
|
17
|
-
maybeInitializeFabric();
|
|
18
|
-
|
|
19
13
|
return (
|
|
20
14
|
<GestureHandlerRootViewContext.Provider value>
|
|
21
15
|
<View style={style ?? styles.container} {...rest} />
|
|
@@ -541,6 +541,7 @@ export default class Swipeable extends Component<
|
|
|
541
541
|
return (
|
|
542
542
|
<PanGestureHandler
|
|
543
543
|
activeOffsetX={[-dragOffsetFromRightEdge, dragOffsetFromLeftEdge]}
|
|
544
|
+
touchAction="pan-y"
|
|
544
545
|
{...this.props}
|
|
545
546
|
onGestureEvent={this.onGestureEvent}
|
|
546
547
|
onHandlerStateChange={this.onHandlerStateChange}>
|
|
@@ -551,6 +552,7 @@ export default class Swipeable extends Component<
|
|
|
551
552
|
{right}
|
|
552
553
|
<TapGestureHandler
|
|
553
554
|
enabled={rowState !== 0}
|
|
555
|
+
touchAction="pan-y"
|
|
554
556
|
onHandlerStateChange={this.onTapHandlerStateChange}>
|
|
555
557
|
<Animated.View
|
|
556
558
|
pointerEvents={rowState === 0 ? 'auto' : 'box-only'}
|
|
@@ -15,6 +15,7 @@ import { BaseButton } from '../GestureButtons';
|
|
|
15
15
|
import {
|
|
16
16
|
GestureEvent,
|
|
17
17
|
HandlerStateChangeEvent,
|
|
18
|
+
UserSelect,
|
|
18
19
|
} from '../../handlers/gestureHandlerCommon';
|
|
19
20
|
import { NativeViewGestureHandlerPayload } from '../../handlers/NativeViewGestureHandler';
|
|
20
21
|
import { TouchableNativeFeedbackExtraProps } from './TouchableNativeFeedback.android';
|
|
@@ -51,6 +52,7 @@ export interface GenericTouchableProps
|
|
|
51
52
|
|
|
52
53
|
containerStyle?: StyleProp<ViewStyle>;
|
|
53
54
|
hitSlop?: Insets | number;
|
|
55
|
+
userSelect?: UserSelect;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
interface InternalProps {
|
|
@@ -286,6 +288,7 @@ export default class GenericTouchable extends Component<
|
|
|
286
288
|
}
|
|
287
289
|
onGestureEvent={this.onGestureEvent}
|
|
288
290
|
hitSlop={hitSlop}
|
|
291
|
+
userSelect={this.props.userSelect}
|
|
289
292
|
shouldActivateOnStart={this.props.shouldActivateOnStart}
|
|
290
293
|
disallowInterruption={this.props.disallowInterruption}
|
|
291
294
|
testID={this.props.testID}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import pack from 'react-native/package.json';
|
|
2
|
+
|
|
3
|
+
const [majorStr, minorStr] = pack.version.split('.');
|
|
4
|
+
const REACT_NATIVE_VERSION = {
|
|
5
|
+
major: parseInt(majorStr, 10),
|
|
6
|
+
minor: parseInt(minorStr, 10),
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function getReactNativeVersion() {
|
|
10
|
+
return REACT_NATIVE_VERSION;
|
|
11
|
+
}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import pack from 'react-native/package.json';
|
|
2
|
-
|
|
3
|
-
const [majorStr, minorStr] = pack.version.split('.');
|
|
4
|
-
const REACT_NATIVE_VERSION = {
|
|
5
|
-
major: parseInt(majorStr, 10),
|
|
6
|
-
minor: parseInt(minorStr, 10),
|
|
7
|
-
};
|
|
8
|
-
|
|
9
1
|
export function getReactNativeVersion() {
|
|
10
|
-
|
|
2
|
+
throw new Error('getReactNativeVersion is not supported on web');
|
|
11
3
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Used by GestureDetector (unsupported on web at the moment) to check whether the
|
|
2
|
+
// attached view may get flattened on Fabric. This implementation causes errors
|
|
3
|
+
// on web due to the static resolution of `require` statements by webpack breaking
|
|
4
|
+
// the conditional importing. Solved by making .web file.
|
|
5
|
+
let findHostInstance_DEPRECATED: (ref: unknown) => void;
|
|
6
|
+
let getInternalInstanceHandleFromPublicInstance: (ref: unknown) => {
|
|
7
|
+
stateNode: { node: unknown };
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function getShadowNodeFromRef(ref: unknown) {
|
|
11
|
+
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
12
|
+
if (findHostInstance_DEPRECATED === undefined) {
|
|
13
|
+
try {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
15
|
+
findHostInstance_DEPRECATED =
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
|
17
|
+
require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
findHostInstance_DEPRECATED = (_ref: unknown) => null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
24
|
+
if (getInternalInstanceHandleFromPublicInstance === undefined) {
|
|
25
|
+
try {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
|
+
getInternalInstanceHandleFromPublicInstance =
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
|
29
|
+
require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
|
|
30
|
+
.getInternalInstanceHandleFromPublicInstance ??
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
32
|
+
((ref: any) => ref._internalInstanceHandle);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
getInternalInstanceHandleFromPublicInstance = (ref: any) =>
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
36
|
+
ref._internalInstanceHandle;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// @ts-ignore Fabric
|
|
41
|
+
return getInternalInstanceHandleFromPublicInstance(
|
|
42
|
+
findHostInstance_DEPRECATED(ref)
|
|
43
|
+
).stateNode.node;
|
|
44
|
+
}
|
|
@@ -1,44 +1,7 @@
|
|
|
1
1
|
// Used by GestureDetector (unsupported on web at the moment) to check whether the
|
|
2
|
-
// attached view may get flattened on Fabric.
|
|
2
|
+
// attached view may get flattened on Fabric. Original implementation causes errors
|
|
3
3
|
// on web due to the static resolution of `require` statements by webpack breaking
|
|
4
|
-
// the conditional importing.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
stateNode: { node: unknown };
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function getShadowNodeFromRef(ref: unknown) {
|
|
11
|
-
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
12
|
-
if (findHostInstance_DEPRECATED === undefined) {
|
|
13
|
-
try {
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
15
|
-
findHostInstance_DEPRECATED =
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
|
17
|
-
require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
findHostInstance_DEPRECATED = (_ref: unknown) => null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
24
|
-
if (getInternalInstanceHandleFromPublicInstance === undefined) {
|
|
25
|
-
try {
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
|
-
getInternalInstanceHandleFromPublicInstance =
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
|
29
|
-
require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
|
|
30
|
-
.getInternalInstanceHandleFromPublicInstance ??
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
32
|
-
((ref: any) => ref._internalInstanceHandle);
|
|
33
|
-
} catch (e) {
|
|
34
|
-
getInternalInstanceHandleFromPublicInstance = (ref: any) =>
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
36
|
-
ref._internalInstanceHandle;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// @ts-ignore Fabric
|
|
41
|
-
return getInternalInstanceHandleFromPublicInstance(
|
|
42
|
-
findHostInstance_DEPRECATED(ref)
|
|
43
|
-
).stateNode.node;
|
|
4
|
+
// the conditional importing.
|
|
5
|
+
export function getShadowNodeFromRef(_ref: any) {
|
|
6
|
+
return null;
|
|
44
7
|
}
|
|
@@ -150,7 +150,9 @@ export interface PanGestureHandlerProps
|
|
|
150
150
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
151
151
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
152
152
|
*/
|
|
153
|
-
activeOffsetY?:
|
|
153
|
+
activeOffsetY?:
|
|
154
|
+
| number
|
|
155
|
+
| [activeOffsetYStart: number, activeOffsetYEnd: number];
|
|
154
156
|
|
|
155
157
|
/**
|
|
156
158
|
* Range along X axis (in points) where fingers travels without activation of
|
|
@@ -160,7 +162,9 @@ export interface PanGestureHandlerProps
|
|
|
160
162
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
161
163
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
162
164
|
*/
|
|
163
|
-
activeOffsetX?:
|
|
165
|
+
activeOffsetX?:
|
|
166
|
+
| number
|
|
167
|
+
| [activeOffsetXStart: number, activeOffsetXEnd: number];
|
|
164
168
|
|
|
165
169
|
/**
|
|
166
170
|
* When the finger moves outside this range (in points) along Y axis and
|
|
@@ -170,7 +174,7 @@ export interface PanGestureHandlerProps
|
|
|
170
174
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
171
175
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
172
176
|
*/
|
|
173
|
-
failOffsetY?: number | number
|
|
177
|
+
failOffsetY?: number | [failOffsetYStart: number, failOffsetYEnd: number];
|
|
174
178
|
|
|
175
179
|
/**
|
|
176
180
|
* When the finger moves outside this range (in points) along X axis and
|
|
@@ -180,7 +184,7 @@ export interface PanGestureHandlerProps
|
|
|
180
184
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
181
185
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
182
186
|
*/
|
|
183
|
-
failOffsetX?: number | number
|
|
187
|
+
failOffsetX?: number | [failOffsetXStart: number, failOffsetXEnd: number];
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
export const panHandlerName = 'PanGestureHandler';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
export
|
|
1
|
+
// PressabilityDebugView is not implemented in react-native-web
|
|
2
|
+
export function PressabilityDebugView() {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
@@ -5,12 +5,10 @@ import {
|
|
|
5
5
|
DeviceEventEmitter,
|
|
6
6
|
EmitterSubscription,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
|
|
8
|
+
import { customDirectEventTypes } from './customDirectEventTypes';
|
|
10
9
|
// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types
|
|
11
10
|
import deepEqual from 'lodash/isEqual';
|
|
12
11
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
13
|
-
import type RNGestureHandlerModuleWeb from '../RNGestureHandlerModule.web';
|
|
14
12
|
import { State } from '../State';
|
|
15
13
|
import {
|
|
16
14
|
handlerIDToTag,
|
|
@@ -155,6 +153,14 @@ type InternalEventHandlers = {
|
|
|
155
153
|
onGestureHandlerStateChange?: (event: any) => void;
|
|
156
154
|
};
|
|
157
155
|
|
|
156
|
+
type AttachGestureHandlerWeb = (
|
|
157
|
+
handlerTag: number,
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
newView: any,
|
|
160
|
+
_actionType: ActionType,
|
|
161
|
+
propsRef: React.RefObject<unknown>
|
|
162
|
+
) => void;
|
|
163
|
+
|
|
158
164
|
const UNRESOLVED_REFS_RETRY_LIMIT = 1;
|
|
159
165
|
|
|
160
166
|
// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
|
@@ -321,7 +327,7 @@ export default function createHandler<
|
|
|
321
327
|
if (Platform.OS === 'web') {
|
|
322
328
|
// typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
|
|
323
329
|
(
|
|
324
|
-
RNGestureHandlerModule.attachGestureHandler as
|
|
330
|
+
RNGestureHandlerModule.attachGestureHandler as AttachGestureHandlerWeb
|
|
325
331
|
)(
|
|
326
332
|
this.handlerTag,
|
|
327
333
|
newViewTag,
|
|
@@ -335,18 +341,22 @@ export default function createHandler<
|
|
|
335
341
|
});
|
|
336
342
|
|
|
337
343
|
const actionType = (() => {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
(
|
|
342
|
-
'
|
|
343
|
-
|
|
344
|
+
const onGestureEvent = this.props?.onGestureEvent;
|
|
345
|
+
const isGestureHandlerWorklet =
|
|
346
|
+
onGestureEvent &&
|
|
347
|
+
('current' in onGestureEvent ||
|
|
348
|
+
'workletEventHandler' in onGestureEvent);
|
|
349
|
+
const onHandlerStateChange = this.props?.onHandlerStateChange;
|
|
350
|
+
const isStateChangeHandlerWorklet =
|
|
351
|
+
onHandlerStateChange &&
|
|
352
|
+
('current' in onHandlerStateChange ||
|
|
353
|
+
'workletEventHandler' in onHandlerStateChange);
|
|
354
|
+
const isReanimatedHandler =
|
|
355
|
+
isGestureHandlerWorklet || isStateChangeHandlerWorklet;
|
|
356
|
+
if (isReanimatedHandler) {
|
|
344
357
|
// Reanimated worklet
|
|
345
358
|
return ActionType.REANIMATED_WORKLET;
|
|
346
|
-
} else if (
|
|
347
|
-
this.props?.onGestureEvent &&
|
|
348
|
-
'__isNative' in this.props.onGestureEvent
|
|
349
|
-
) {
|
|
359
|
+
} else if (onGestureEvent && '__isNative' in onGestureEvent) {
|
|
350
360
|
// Animated.event with useNativeDriver: true
|
|
351
361
|
return ActionType.NATIVE_ANIMATED_EVENT;
|
|
352
362
|
} else {
|
|
@@ -12,7 +12,6 @@ import { handlerIDToTag } from './handlersRegistry';
|
|
|
12
12
|
import { toArray } from '../utils';
|
|
13
13
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
14
14
|
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
15
|
-
import { MouseButton } from '../web/interfaces';
|
|
16
15
|
import { PointerType } from '../PointerType';
|
|
17
16
|
|
|
18
17
|
const commonProps = [
|
|
@@ -25,6 +24,7 @@ const commonProps = [
|
|
|
25
24
|
'activeCursor',
|
|
26
25
|
'mouseButton',
|
|
27
26
|
'enableContextMenu',
|
|
27
|
+
'touchAction',
|
|
28
28
|
] as const;
|
|
29
29
|
|
|
30
30
|
const componentInteractionProps = [
|
|
@@ -113,6 +113,32 @@ export type ActiveCursor =
|
|
|
113
113
|
| 'zoom-in'
|
|
114
114
|
| 'zoom-out';
|
|
115
115
|
|
|
116
|
+
export enum MouseButton {
|
|
117
|
+
LEFT = 1,
|
|
118
|
+
RIGHT = 2,
|
|
119
|
+
MIDDLE = 4,
|
|
120
|
+
BUTTON_4 = 8,
|
|
121
|
+
BUTTON_5 = 16,
|
|
122
|
+
ALL = 31,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type TouchAction =
|
|
126
|
+
| 'auto'
|
|
127
|
+
| 'none'
|
|
128
|
+
| 'pan-x'
|
|
129
|
+
| 'pan-left'
|
|
130
|
+
| 'pan-right'
|
|
131
|
+
| 'pan-y'
|
|
132
|
+
| 'pan-up'
|
|
133
|
+
| 'pan-down'
|
|
134
|
+
| 'pinch-zoom'
|
|
135
|
+
| 'manipulation'
|
|
136
|
+
| 'inherit'
|
|
137
|
+
| 'initial'
|
|
138
|
+
| 'revert'
|
|
139
|
+
| 'revert-layer'
|
|
140
|
+
| 'unset';
|
|
141
|
+
|
|
116
142
|
//TODO(TS) events in handlers
|
|
117
143
|
|
|
118
144
|
export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
@@ -156,6 +182,7 @@ export type CommonGestureConfig = {
|
|
|
156
182
|
activeCursor?: ActiveCursor;
|
|
157
183
|
mouseButton?: MouseButton;
|
|
158
184
|
enableContextMenu?: boolean;
|
|
185
|
+
touchAction?: TouchAction;
|
|
159
186
|
};
|
|
160
187
|
|
|
161
188
|
// Events payloads are types instead of interfaces due to TS limitation.
|