react-native-gesture-handler 2.16.0-rc.0 → 2.16.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,6 +1,6 @@
|
|
1
1
|
import { FlingGestureHandlerEventPayload } from '../FlingGestureHandler';
|
2
2
|
import { ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';
|
3
|
-
import { HitSlop, CommonGestureConfig, GestureTouchEvent, GestureStateChangeEvent, GestureUpdateEvent, ActiveCursor } from '../gestureHandlerCommon';
|
3
|
+
import { HitSlop, CommonGestureConfig, GestureTouchEvent, GestureStateChangeEvent, GestureUpdateEvent, ActiveCursor, MouseButton } from '../gestureHandlerCommon';
|
4
4
|
import { GestureStateManagerType } from './gestureStateManager';
|
5
5
|
import { LongPressGestureHandlerEventPayload } from '../LongPressGestureHandler';
|
6
6
|
import { PanGestureHandlerEventPayload } from '../PanGestureHandler';
|
@@ -8,7 +8,6 @@ import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
|
|
8
8
|
import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
|
9
9
|
import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
|
10
10
|
import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
|
11
|
-
import { MouseButton } from '../../web/interfaces';
|
12
11
|
export type GestureType = BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<FlingGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
|
13
12
|
export type GestureRef = number | GestureType | React.RefObject<GestureType | undefined> | React.RefObject<React.ComponentType | undefined>;
|
14
13
|
export interface BaseGestureConfig extends CommonGestureConfig, Record<string, unknown> {
|
@@ -78,26 +77,125 @@ export declare abstract class BaseGesture<EventPayloadT extends Record<string, u
|
|
78
77
|
handlers: HandlerCallbacks<EventPayloadT>;
|
79
78
|
constructor();
|
80
79
|
private addDependency;
|
80
|
+
/**
|
81
|
+
* Sets a `ref` to the gesture object, allowing for interoperability with the old API.
|
82
|
+
* @param ref
|
83
|
+
*/
|
81
84
|
withRef(ref: React.MutableRefObject<GestureType | undefined>): this;
|
82
85
|
protected isWorklet(callback: Function): boolean;
|
86
|
+
/**
|
87
|
+
* Set the callback that is being called when given gesture handler starts receiving touches.
|
88
|
+
* At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.
|
89
|
+
* @param callback
|
90
|
+
*/
|
83
91
|
onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void): this;
|
92
|
+
/**
|
93
|
+
* Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.
|
94
|
+
* @param callback
|
95
|
+
*/
|
84
96
|
onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void): this;
|
97
|
+
/**
|
98
|
+
* Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.
|
99
|
+
* It will be called only if the handler was previously in the `ACTIVE` state.
|
100
|
+
* @param callback
|
101
|
+
*/
|
85
102
|
onEnd(callback: (event: GestureStateChangeEvent<EventPayloadT>, success: boolean) => void): this;
|
103
|
+
/**
|
104
|
+
* Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.
|
105
|
+
* @param callback
|
106
|
+
*/
|
86
107
|
onFinalize(callback: (event: GestureStateChangeEvent<EventPayloadT>, success: boolean) => void): this;
|
108
|
+
/**
|
109
|
+
* Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.
|
110
|
+
* @param callback
|
111
|
+
*/
|
87
112
|
onTouchesDown(callback: TouchEventHandlerType): this;
|
113
|
+
/**
|
114
|
+
* Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.
|
115
|
+
* @param callback
|
116
|
+
*/
|
88
117
|
onTouchesMove(callback: TouchEventHandlerType): this;
|
118
|
+
/**
|
119
|
+
* Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.
|
120
|
+
* @param callback
|
121
|
+
*/
|
89
122
|
onTouchesUp(callback: TouchEventHandlerType): this;
|
123
|
+
/**
|
124
|
+
* Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.
|
125
|
+
* @param callback
|
126
|
+
*/
|
90
127
|
onTouchesCancelled(callback: TouchEventHandlerType): this;
|
128
|
+
/**
|
129
|
+
* Indicates whether the given handler should be analyzing stream of touch events or not.
|
130
|
+
* @param enabled
|
131
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean
|
132
|
+
*/
|
91
133
|
enabled(enabled: boolean): this;
|
134
|
+
/**
|
135
|
+
* When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.
|
136
|
+
* @param value
|
137
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean
|
138
|
+
*/
|
92
139
|
shouldCancelWhenOutside(value: boolean): this;
|
140
|
+
/**
|
141
|
+
* This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.
|
142
|
+
* When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.
|
143
|
+
* @param hitSlop
|
144
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings
|
145
|
+
*/
|
93
146
|
hitSlop(hitSlop: HitSlop): this;
|
147
|
+
/**
|
148
|
+
* #### Web only
|
149
|
+
* This parameter allows to specify which `cursor` should be used when gesture activates.
|
150
|
+
* Supports all CSS cursor values (e.g. `"grab"`, `"zoom-in"`). Default value is set to `"auto"`.
|
151
|
+
* @param activeCursor
|
152
|
+
*/
|
94
153
|
activeCursor(activeCursor: ActiveCursor): this;
|
154
|
+
/**
|
155
|
+
* #### Web & Android only
|
156
|
+
* Allows users to choose which mouse button should handler respond to.
|
157
|
+
* Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`.
|
158
|
+
* Default value is set to `MouseButton.LEFT`.
|
159
|
+
* @param mouseButton
|
160
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only
|
161
|
+
*/
|
95
162
|
mouseButton(mouseButton: MouseButton): this;
|
163
|
+
/**
|
164
|
+
* When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.
|
165
|
+
* This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.
|
166
|
+
* Defaults to `false`.
|
167
|
+
* @param runOnJS
|
168
|
+
*/
|
96
169
|
runOnJS(runOnJS: boolean): this;
|
170
|
+
/**
|
171
|
+
* Allows gestures across different components to be recognized simultaneously.
|
172
|
+
* @param gestures
|
173
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture
|
174
|
+
*/
|
97
175
|
simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
|
176
|
+
/**
|
177
|
+
* Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).
|
178
|
+
* @param gestures
|
179
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail
|
180
|
+
*/
|
98
181
|
requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]): this;
|
182
|
+
/**
|
183
|
+
* Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.
|
184
|
+
* @param gestures
|
185
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture
|
186
|
+
*/
|
99
187
|
blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
|
188
|
+
/**
|
189
|
+
* Sets a `testID` property for gesture object, allowing for querying for it in tests.
|
190
|
+
* @param id
|
191
|
+
*/
|
100
192
|
withTestId(id: string): this;
|
193
|
+
/**
|
194
|
+
* #### iOS only
|
195
|
+
* When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.
|
196
|
+
* Default value is `true`.
|
197
|
+
* @param value
|
198
|
+
*/
|
101
199
|
cancelsTouchesInView(value: boolean): this;
|
102
200
|
initialize(): void;
|
103
201
|
toGestureArray(): GestureType[];
|
@@ -105,8 +203,22 @@ export declare abstract class BaseGesture<EventPayloadT extends Record<string, u
|
|
105
203
|
get shouldUseReanimated(): boolean;
|
106
204
|
}
|
107
205
|
export declare abstract class ContinousBaseGesture<EventPayloadT extends Record<string, unknown>, EventChangePayloadT extends Record<string, unknown>> extends BaseGesture<EventPayloadT> {
|
206
|
+
/**
|
207
|
+
* Set the callback that is being called every time the gesture receives an update while it's active.
|
208
|
+
* @param callback
|
209
|
+
*/
|
108
210
|
onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void): this;
|
211
|
+
/**
|
212
|
+
* Set the callback that is being called every time the gesture receives an update while it's active.
|
213
|
+
* This callback will receive information about change in value in relation to the last received event.
|
214
|
+
* @param callback
|
215
|
+
*/
|
109
216
|
onChange(callback: (event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>) => void): this;
|
217
|
+
/**
|
218
|
+
* When `true` the handler will not activate by itself even if its activation criteria are met.
|
219
|
+
* Instead you can manipulate its state using state manager.
|
220
|
+
* @param manualActivation
|
221
|
+
*/
|
110
222
|
manualActivation(manualActivation: boolean): this;
|
111
223
|
}
|
112
224
|
export {};
|
@@ -10,24 +10,80 @@ import { TapGesture } from './tapGesture';
|
|
10
10
|
import { NativeGesture } from './nativeGesture';
|
11
11
|
import { ManualGesture } from './manualGesture';
|
12
12
|
import { HoverGesture } from './hoverGesture';
|
13
|
+
/**
|
14
|
+
* `Gesture` is the object that allows you to create and compose gestures.
|
15
|
+
*
|
16
|
+
* ### Remarks
|
17
|
+
* - Consider wrapping your gesture configurations with `useMemo`, as it will reduce the amount of work Gesture Handler has to do under the hood when updating gestures.
|
18
|
+
*
|
19
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture
|
20
|
+
*/
|
13
21
|
export declare const GestureObjects: {
|
22
|
+
/**
|
23
|
+
* A discrete gesture that recognizes one or many taps.
|
24
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture
|
25
|
+
*/
|
14
26
|
Tap: () => TapGesture;
|
27
|
+
/**
|
28
|
+
* A continuous gesture that can recognize a panning (dragging) gesture and track its movement.
|
29
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture
|
30
|
+
*/
|
15
31
|
Pan: () => PanGesture;
|
32
|
+
/**
|
33
|
+
* A continuous gesture that recognizes pinch gesture. It allows for tracking the distance between two fingers and use that information to scale or zoom your content.
|
34
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pinch-gesture
|
35
|
+
*/
|
16
36
|
Pinch: () => PinchGesture;
|
37
|
+
/**
|
38
|
+
* A continuous gesture that can recognize rotation and track its movement.
|
39
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/rotation-gesture
|
40
|
+
*/
|
17
41
|
Rotation: () => RotationGesture;
|
42
|
+
/**
|
43
|
+
* A discrete gesture that activates when the movement is sufficiently fast.
|
44
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture
|
45
|
+
*/
|
18
46
|
Fling: () => FlingGesture;
|
47
|
+
/**
|
48
|
+
* A discrete gesture that activates when the corresponding view is pressed for a sufficiently long time.
|
49
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture
|
50
|
+
*/
|
19
51
|
LongPress: () => LongPressGesture;
|
52
|
+
/**
|
53
|
+
* #### iOS only
|
54
|
+
* A continuous gesture that recognizes force of a touch. It allows for tracking pressure of touch on some iOS devices.
|
55
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/force-touch-gesture
|
56
|
+
*/
|
20
57
|
ForceTouch: () => ForceTouchGesture;
|
58
|
+
/**
|
59
|
+
* A gesture that allows other touch handling components to participate in RNGH's gesture system.
|
60
|
+
* When used, the other component should be the direct child of a `GestureDetector`.
|
61
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/native-gesture
|
62
|
+
*/
|
21
63
|
Native: () => NativeGesture;
|
64
|
+
/**
|
65
|
+
* A plain gesture that has no specific activation criteria nor event data set.
|
66
|
+
* Its state has to be controlled manually using a state manager.
|
67
|
+
* It will not fail when all the pointers are lifted from the screen.
|
68
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/manual-gesture
|
69
|
+
*/
|
22
70
|
Manual: () => ManualGesture;
|
71
|
+
/**
|
72
|
+
* A continuous gesture that can recognize hovering above the view it's attached to.
|
73
|
+
* The hover effect may be activated by moving a mouse or a stylus over the view.
|
74
|
+
*
|
75
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/hover-gesture
|
76
|
+
*/
|
23
77
|
Hover: () => HoverGesture;
|
24
78
|
/**
|
25
79
|
* Builds a composed gesture consisting of gestures provided as parameters.
|
26
80
|
* The first one that becomes active cancels the rest of gestures.
|
81
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#race
|
27
82
|
*/
|
28
83
|
Race: (...gestures: Gesture[]) => ComposedGesture;
|
29
84
|
/**
|
30
85
|
* Builds a composed gesture that allows all base gestures to run simultaneously.
|
86
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneous
|
31
87
|
*/
|
32
88
|
Simultaneous(...gestures: Gesture[]): SimultaneousGesture;
|
33
89
|
/**
|
@@ -36,6 +92,7 @@ export declare const GestureObjects: {
|
|
36
92
|
* than the second one, second one has higher priority than the third one, and so on.
|
37
93
|
* For example, to make a gesture that recognizes both single and double tap you need
|
38
94
|
* to call Exclusive(doubleTap, singleTap).
|
95
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#exclusive
|
39
96
|
*/
|
40
97
|
Exclusive(...gestures: Gesture[]): ExclusiveGesture;
|
41
98
|
};
|
@@ -23,8 +23,8 @@ export declare class HoverGesture extends ContinousBaseGesture<HoverGestureHandl
|
|
23
23
|
config: BaseGestureConfig & HoverGestureConfig;
|
24
24
|
constructor();
|
25
25
|
/**
|
26
|
+
* #### iOS only
|
26
27
|
* Sets the visual hover effect.
|
27
|
-
* iOS only
|
28
28
|
*/
|
29
29
|
effect(effect: HoverEffect): this;
|
30
30
|
onChange(callback: (event: GestureUpdateEvent<HoverGestureHandlerEventPayload & HoverGestureChangeEventPayload>) => void): this;
|
@@ -3,7 +3,17 @@ import { LongPressGestureConfig, LongPressGestureHandlerEventPayload } from '../
|
|
3
3
|
export declare class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {
|
4
4
|
config: BaseGestureConfig & LongPressGestureConfig;
|
5
5
|
constructor();
|
6
|
+
/**
|
7
|
+
* Minimum time, expressed in milliseconds, that a finger must remain pressed on the corresponding view.
|
8
|
+
* The default value is 500.
|
9
|
+
* @param duration
|
10
|
+
*/
|
6
11
|
minDuration(duration: number): this;
|
12
|
+
/**
|
13
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a long press gesture.
|
14
|
+
* @param distance
|
15
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture#maxdistancevalue-number
|
16
|
+
*/
|
7
17
|
maxDistance(distance: number): this;
|
8
18
|
}
|
9
19
|
export type LongPressGestureType = InstanceType<typeof LongPressGesture>;
|
@@ -3,7 +3,15 @@ import { NativeViewGestureConfig, NativeViewGestureHandlerPayload } from '../Nat
|
|
3
3
|
export declare class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {
|
4
4
|
config: BaseGestureConfig & NativeViewGestureConfig;
|
5
5
|
constructor();
|
6
|
+
/**
|
7
|
+
* When true, underlying handler will activate unconditionally when in `BEGAN` or `UNDETERMINED` state.
|
8
|
+
* @param value
|
9
|
+
*/
|
6
10
|
shouldActivateOnStart(value: boolean): this;
|
11
|
+
/**
|
12
|
+
* When true, cancels all other gesture handlers when this `NativeViewGestureHandler` receives an `ACTIVE` state event.
|
13
|
+
* @param value
|
14
|
+
*/
|
7
15
|
disallowInterruption(value: boolean): this;
|
8
16
|
}
|
9
17
|
export type NativeGestureType = InstanceType<typeof NativeGesture>;
|
@@ -8,18 +8,81 @@ export type PanGestureChangeEventPayload = {
|
|
8
8
|
export declare class PanGesture extends ContinousBaseGesture<PanGestureHandlerEventPayload, PanGestureChangeEventPayload> {
|
9
9
|
config: BaseGestureConfig & PanGestureConfig;
|
10
10
|
constructor();
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
/**
|
12
|
+
* Range along Y axis (in points) where fingers travels without activation of gesture.
|
13
|
+
* @param offset
|
14
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number
|
15
|
+
*/
|
16
|
+
activeOffsetY(offset: number | [activeOffsetYStart: number, activeOffsetYEnd: number]): this;
|
17
|
+
/**
|
18
|
+
* Range along X axis (in points) where fingers travels without activation of gesture.
|
19
|
+
* @param offset
|
20
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number
|
21
|
+
*/
|
22
|
+
activeOffsetX(offset: number | [activeOffsetXStart: number, activeOffsetXEnd: number]): this;
|
23
|
+
/**
|
24
|
+
* When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.
|
25
|
+
* @param offset
|
26
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number
|
27
|
+
*/
|
28
|
+
failOffsetY(offset: number | [failOffsetYStart: number, failOffsetYEnd: number]): this;
|
29
|
+
/**
|
30
|
+
* When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.
|
31
|
+
* @param offset
|
32
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number
|
33
|
+
*/
|
34
|
+
failOffsetX(offset: number | [failOffsetXStart: number, failOffsetXEnd: number]): this;
|
35
|
+
/**
|
36
|
+
* A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.
|
37
|
+
* @param minPointers
|
38
|
+
*/
|
15
39
|
minPointers(minPointers: number): this;
|
40
|
+
/**
|
41
|
+
* When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.
|
42
|
+
* Should be a higher or equal to 0 integer.
|
43
|
+
* @param maxPointers
|
44
|
+
*/
|
16
45
|
maxPointers(maxPointers: number): this;
|
46
|
+
/**
|
47
|
+
* Minimum distance the finger (or multiple finger) need to travel before the gesture activates.
|
48
|
+
* Expressed in points.
|
49
|
+
* @param distance
|
50
|
+
*/
|
17
51
|
minDistance(distance: number): this;
|
52
|
+
/**
|
53
|
+
* Minimum velocity the finger has to reach in order to activate handler.
|
54
|
+
* @param velocity
|
55
|
+
*/
|
18
56
|
minVelocity(velocity: number): this;
|
57
|
+
/**
|
58
|
+
* Minimum velocity along X axis the finger has to reach in order to activate handler.
|
59
|
+
* @param velocity
|
60
|
+
*/
|
19
61
|
minVelocityX(velocity: number): this;
|
62
|
+
/**
|
63
|
+
* Minimum velocity along Y axis the finger has to reach in order to activate handler.
|
64
|
+
* @param velocity
|
65
|
+
*/
|
20
66
|
minVelocityY(velocity: number): this;
|
67
|
+
/**
|
68
|
+
* #### Android only
|
69
|
+
* Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).
|
70
|
+
* This modifier allows that behavior to be changed to the one that is default on iOS - the averaged position of all active pointers will be used to calculate the translation values.
|
71
|
+
* @param value
|
72
|
+
*/
|
21
73
|
averageTouches(value: boolean): this;
|
74
|
+
/**
|
75
|
+
* #### iOS only
|
76
|
+
* Enables two-finger gestures on supported devices, for example iPads with trackpads.
|
77
|
+
* @param value
|
78
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only
|
79
|
+
*/
|
22
80
|
enableTrackpadTwoFingerGesture(value: boolean): this;
|
81
|
+
/**
|
82
|
+
* Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.
|
83
|
+
* @param duration
|
84
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number
|
85
|
+
*/
|
23
86
|
activateAfterLongPress(duration: number): this;
|
24
87
|
onChange(callback: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>) => void): this;
|
25
88
|
}
|
@@ -3,12 +3,47 @@ import { TapGestureConfig, TapGestureHandlerEventPayload } from '../TapGestureHa
|
|
3
3
|
export declare class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
|
4
4
|
config: BaseGestureConfig & TapGestureConfig;
|
5
5
|
constructor();
|
6
|
+
/**
|
7
|
+
* Minimum number of pointers (fingers) required to be placed before the gesture activates.
|
8
|
+
* Should be a positive integer. The default value is 1.
|
9
|
+
* @param minPointers
|
10
|
+
*/
|
6
11
|
minPointers(minPointers: number): this;
|
12
|
+
/**
|
13
|
+
* Number of tap gestures required to activate the gesture.
|
14
|
+
* The default value is 1.
|
15
|
+
* @param count
|
16
|
+
*/
|
7
17
|
numberOfTaps(count: number): this;
|
18
|
+
/**
|
19
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a tap gesture.
|
20
|
+
* @param maxDist
|
21
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdistancevalue-number
|
22
|
+
*/
|
8
23
|
maxDistance(maxDist: number): this;
|
24
|
+
/**
|
25
|
+
* Maximum time, expressed in milliseconds, that defines how fast a finger must be released after a touch.
|
26
|
+
* The default value is 500.
|
27
|
+
* @param duration
|
28
|
+
*/
|
9
29
|
maxDuration(duration: number): this;
|
30
|
+
/**
|
31
|
+
* Maximum time, expressed in milliseconds, that can pass before the next tap — if many taps are required.
|
32
|
+
* The default value is 500.
|
33
|
+
* @param delay
|
34
|
+
*/
|
10
35
|
maxDelay(delay: number): this;
|
36
|
+
/**
|
37
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel along the X axis during a tap gesture.
|
38
|
+
* @param delta
|
39
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdeltaxvalue-number
|
40
|
+
*/
|
11
41
|
maxDeltaX(delta: number): this;
|
42
|
+
/**
|
43
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel along the Y axis during a tap gesture.
|
44
|
+
* @param delta
|
45
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdeltayvalue-number
|
46
|
+
*/
|
12
47
|
maxDeltaY(delta: number): this;
|
13
48
|
}
|
14
49
|
export type TapGestureType = InstanceType<typeof TapGesture>;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
export { Directions } from './Directions';
|
2
2
|
export { State } from './State';
|
3
|
-
export { MouseButton } from './web/interfaces';
|
4
3
|
export { PointerType } from './PointerType';
|
5
4
|
export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
|
6
5
|
export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
|
7
6
|
export type { GestureEvent, HandlerStateChangeEvent, GestureEventPayload, HandlerStateChangeEventPayload, GestureTouchEvent, TouchData, GestureUpdateEvent, GestureStateChangeEvent, } from './handlers/gestureHandlerCommon';
|
7
|
+
export { MouseButton } from './handlers/gestureHandlerCommon';
|
8
8
|
export type { GestureType } from './handlers/gestures/gesture';
|
9
9
|
export type { TapGestureHandlerEventPayload, TapGestureHandlerProps, } from './handlers/TapGestureHandler';
|
10
10
|
export type { ForceTouchGestureHandlerEventPayload, ForceTouchGestureHandlerProps, } from './handlers/ForceTouchGestureHandler';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react-native/types/modules/codegen" />
|
2
|
-
import type { Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
2
|
+
import type { Int32, WithDefault, Float } from 'react-native/Libraries/Types/CodegenTypes';
|
3
3
|
import type { ViewProps, ColorValue } from 'react-native';
|
4
4
|
interface NativeProps extends ViewProps {
|
5
5
|
exclusive?: WithDefault<boolean, true>;
|
@@ -9,6 +9,9 @@ interface NativeProps extends ViewProps {
|
|
9
9
|
rippleColor?: ColorValue;
|
10
10
|
rippleRadius?: Int32;
|
11
11
|
touchSoundDisabled?: WithDefault<boolean, false>;
|
12
|
+
borderWidth?: Float;
|
13
|
+
borderColor?: ColorValue;
|
14
|
+
borderStyle?: WithDefault<string, 'solid'>;
|
12
15
|
}
|
13
16
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
14
17
|
export default _default;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import PanGestureHandler from './handlers/PanGestureHandler';
|
2
|
+
import TapGestureHandler from './handlers/TapGestureHandler';
|
3
|
+
import LongPressGestureHandler from './handlers/LongPressGestureHandler';
|
4
|
+
import PinchGestureHandler from './handlers/PinchGestureHandler';
|
5
|
+
import RotationGestureHandler from './handlers/RotationGestureHandler';
|
6
|
+
import FlingGestureHandler from './handlers/FlingGestureHandler';
|
7
|
+
import NativeViewGestureHandler from './handlers/NativeViewGestureHandler';
|
8
|
+
import ManualGestureHandler from './handlers/ManualGestureHandler';
|
9
|
+
import HoverGestureHandler from './handlers/HoverGestureHandler';
|
10
|
+
import HammerNativeViewGestureHandler from '../web_hammer/NativeViewGestureHandler';
|
11
|
+
import HammerPanGestureHandler from '../web_hammer/PanGestureHandler';
|
12
|
+
import HammerTapGestureHandler from '../web_hammer/TapGestureHandler';
|
13
|
+
import HammerLongPressGestureHandler from '../web_hammer/LongPressGestureHandler';
|
14
|
+
import HammerPinchGestureHandler from '../web_hammer/PinchGestureHandler';
|
15
|
+
import HammerRotationGestureHandler from '../web_hammer/RotationGestureHandler';
|
16
|
+
import HammerFlingGestureHandler from '../web_hammer/FlingGestureHandler';
|
17
|
+
export declare const Gestures: {
|
18
|
+
NativeViewGestureHandler: typeof NativeViewGestureHandler;
|
19
|
+
PanGestureHandler: typeof PanGestureHandler;
|
20
|
+
TapGestureHandler: typeof TapGestureHandler;
|
21
|
+
LongPressGestureHandler: typeof LongPressGestureHandler;
|
22
|
+
PinchGestureHandler: typeof PinchGestureHandler;
|
23
|
+
RotationGestureHandler: typeof RotationGestureHandler;
|
24
|
+
FlingGestureHandler: typeof FlingGestureHandler;
|
25
|
+
ManualGestureHandler: typeof ManualGestureHandler;
|
26
|
+
HoverGestureHandler: typeof HoverGestureHandler;
|
27
|
+
};
|
28
|
+
export declare const HammerGestures: {
|
29
|
+
NativeViewGestureHandler: typeof HammerNativeViewGestureHandler;
|
30
|
+
PanGestureHandler: typeof HammerPanGestureHandler;
|
31
|
+
TapGestureHandler: typeof HammerTapGestureHandler;
|
32
|
+
LongPressGestureHandler: typeof HammerLongPressGestureHandler;
|
33
|
+
PinchGestureHandler: typeof HammerPinchGestureHandler;
|
34
|
+
RotationGestureHandler: typeof HammerRotationGestureHandler;
|
35
|
+
FlingGestureHandler: typeof HammerFlingGestureHandler;
|
36
|
+
};
|
@@ -4,10 +4,8 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
4
4
|
private numberOfPointersRequired;
|
5
5
|
private direction;
|
6
6
|
private maxDurationMs;
|
7
|
-
private
|
7
|
+
private minVelocity;
|
8
8
|
private delayTimeout;
|
9
|
-
private startX;
|
10
|
-
private startY;
|
11
9
|
private maxNumberOfPointersSimultaneously;
|
12
10
|
private keyPointer;
|
13
11
|
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
@@ -18,7 +16,9 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
18
16
|
protected onPointerDown(event: AdaptedEvent): void;
|
19
17
|
protected onPointerAdd(event: AdaptedEvent): void;
|
20
18
|
private newPointerAction;
|
19
|
+
private pointerMoveAction;
|
21
20
|
protected onPointerMove(event: AdaptedEvent): void;
|
21
|
+
protected onPointerOutOfBounds(event: AdaptedEvent): void;
|
22
22
|
protected onPointerUp(event: AdaptedEvent): void;
|
23
23
|
protected onPointerRemove(event: AdaptedEvent): void;
|
24
24
|
private onUp;
|
@@ -1,13 +1,15 @@
|
|
1
1
|
import { State } from '../../State';
|
2
|
-
import { Config, AdaptedEvent
|
2
|
+
import { Config, AdaptedEvent } from '../interfaces';
|
3
3
|
import EventManager from '../tools/EventManager';
|
4
4
|
import PointerTracker from '../tools/PointerTracker';
|
5
5
|
import { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate';
|
6
|
+
import IGestureHandler from './IGestureHandler';
|
7
|
+
import { MouseButton } from '../../handlers/gestureHandlerCommon';
|
6
8
|
import { PointerType } from '../../PointerType';
|
7
|
-
export default abstract class GestureHandler {
|
9
|
+
export default abstract class GestureHandler implements IGestureHandler {
|
8
10
|
private lastSentState;
|
9
11
|
protected currentState: State;
|
10
|
-
protected
|
12
|
+
protected shouldCancelWhenOutside: boolean;
|
11
13
|
protected hasCustomActivationCriteria: boolean;
|
12
14
|
protected enabled: boolean;
|
13
15
|
private viewRef;
|
@@ -20,8 +22,8 @@ export default abstract class GestureHandler {
|
|
20
22
|
protected active: boolean;
|
21
23
|
protected shouldResetProgress: boolean;
|
22
24
|
protected pointerType: PointerType;
|
23
|
-
protected delegate: GestureHandlerDelegate<unknown>;
|
24
|
-
constructor(delegate: GestureHandlerDelegate<unknown>);
|
25
|
+
protected delegate: GestureHandlerDelegate<unknown, IGestureHandler>;
|
26
|
+
constructor(delegate: GestureHandlerDelegate<unknown, IGestureHandler>);
|
25
27
|
protected init(viewRef: number, propsRef: React.RefObject<unknown>): void;
|
26
28
|
attachEventManager(manager: EventManager<unknown>): void;
|
27
29
|
protected onCancel(): void;
|
@@ -39,7 +41,7 @@ export default abstract class GestureHandler {
|
|
39
41
|
* @param {boolean} sendIfDisabled - Used when handler becomes disabled. With this flag orchestrator will be forced to send cancel event
|
40
42
|
*/
|
41
43
|
cancel(sendIfDisabled?: boolean): void;
|
42
|
-
activate(
|
44
|
+
activate(force?: boolean): void;
|
43
45
|
end(): void;
|
44
46
|
isAwaiting(): boolean;
|
45
47
|
setAwaiting(value: boolean): void;
|
@@ -49,10 +51,10 @@ export default abstract class GestureHandler {
|
|
49
51
|
setShouldResetProgress(value: boolean): void;
|
50
52
|
getActivationIndex(): number;
|
51
53
|
setActivationIndex(value: number): void;
|
52
|
-
shouldWaitForHandlerFailure(handler:
|
53
|
-
shouldRequireToWaitForFailure(handler:
|
54
|
-
shouldRecognizeSimultaneously(handler:
|
55
|
-
shouldBeCancelledByOther(handler:
|
54
|
+
shouldWaitForHandlerFailure(handler: IGestureHandler): boolean;
|
55
|
+
shouldRequireToWaitForFailure(handler: IGestureHandler): boolean;
|
56
|
+
shouldRecognizeSimultaneously(handler: IGestureHandler): boolean;
|
57
|
+
shouldBeCancelledByOther(handler: IGestureHandler): boolean;
|
56
58
|
protected onPointerDown(event: AdaptedEvent): void;
|
57
59
|
protected onPointerAdd(event: AdaptedEvent): void;
|
58
60
|
protected onPointerUp(event: AdaptedEvent): void;
|
@@ -81,7 +83,7 @@ export default abstract class GestureHandler {
|
|
81
83
|
getTag(): number;
|
82
84
|
setTag(tag: number): void;
|
83
85
|
getConfig(): Config;
|
84
|
-
getDelegate(): GestureHandlerDelegate<unknown>;
|
86
|
+
getDelegate(): GestureHandlerDelegate<unknown, IGestureHandler>;
|
85
87
|
getTracker(): PointerTracker;
|
86
88
|
getTrackedPointersID(): number[];
|
87
89
|
getState(): State;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { PointerType } from '../../PointerType';
|
2
|
+
import type { MouseButton } from '../../handlers/gestureHandlerCommon';
|
3
|
+
import type { State } from '../../State';
|
4
|
+
import type { Config } from '../interfaces';
|
5
|
+
import type EventManager from '../tools/EventManager';
|
6
|
+
import type { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate';
|
7
|
+
import type PointerTracker from '../tools/PointerTracker';
|
8
|
+
export default interface IGestureHandler {
|
9
|
+
getTag: () => number;
|
10
|
+
getState: () => State;
|
11
|
+
getConfig: () => Config;
|
12
|
+
getDelegate: () => GestureHandlerDelegate<unknown, this>;
|
13
|
+
attachEventManager: (manager: EventManager<unknown>) => void;
|
14
|
+
isButtonInConfig: (mouseButton: MouseButton | undefined) => boolean | number | undefined;
|
15
|
+
getPointerType: () => PointerType;
|
16
|
+
getTracker: () => PointerTracker;
|
17
|
+
getTrackedPointersID: () => number[];
|
18
|
+
begin: () => void;
|
19
|
+
activate: (force: boolean) => void;
|
20
|
+
end: () => void;
|
21
|
+
fail: () => void;
|
22
|
+
cancel: () => void;
|
23
|
+
reset: () => void;
|
24
|
+
isEnabled: () => boolean;
|
25
|
+
isActive: () => boolean;
|
26
|
+
setActive: (value: boolean) => void;
|
27
|
+
isAwaiting: () => boolean;
|
28
|
+
setAwaiting: (value: boolean) => void;
|
29
|
+
setActivationIndex: (value: number) => void;
|
30
|
+
setShouldResetProgress: (value: boolean) => void;
|
31
|
+
shouldWaitForHandlerFailure: (handler: IGestureHandler) => boolean;
|
32
|
+
shouldRequireToWaitForFailure: (handler: IGestureHandler) => boolean;
|
33
|
+
shouldRecognizeSimultaneously: (handler: IGestureHandler) => boolean;
|
34
|
+
shouldBeCancelledByOther: (handler: IGestureHandler) => boolean;
|
35
|
+
sendEvent: (newState: State, oldState: State) => void;
|
36
|
+
updateGestureConfig: (config: Config) => void;
|
37
|
+
isButton?: () => boolean;
|
38
|
+
}
|
@@ -21,4 +21,5 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
21
21
|
shouldRecognizeSimultaneously(handler: GestureHandler): boolean;
|
22
22
|
shouldBeCancelledByOther(_handler: GestureHandler): boolean;
|
23
23
|
disallowsInterruption(): boolean;
|
24
|
+
isButton(): boolean;
|
24
25
|
}
|