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 +1 @@
|
|
1
|
-
{"version":3,"sources":["TouchEventManager.ts"],"names":["EventTypes","TouchEventType","EventManager","isPointerInBounds","PointerType","TouchEventManager","setListeners","view","addEventListener","event","i","changedTouches","length","adaptedEvent","mapEvent","DOWN","x","y","touchType","markAsInBounds","pointerId","activePointersCounter","eventType","ADDITIONAL_POINTER_DOWN","onPointerAdd","onPointerDown","MOVE","inBounds","pointerIndex","pointersInBounds","indexOf","ENTER","onPointerEnter","onPointerMove","LEAVE","onPointerLeave","markAsOutOfBounds","onPointerOutOfBounds","UP","ADDITIONAL_POINTER_UP","onPointerRemove","onPointerUp","CANCEL","CANCELLED","onPointerCancel","index","touchEventType","rect","getBoundingClientRect","clientX","clientY","offsetX","left","offsetY","top","identifier","pointerType","TOUCH","time","timeStamp","allTouches","touches"],"mappings":"AAAA,SAAuBA,UAAvB,EAAmCC,cAAnC,QAAyD,eAAzD;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,SAASC,iBAAT,QAAkC,UAAlC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA,eAAe,MAAMC,iBAAN,SAAgCH,YAAhC,CAA0D;AAChEI,EAAAA,YAAY,GAAS;AAC1B,SAAKC,IAAL,CAAUC,gBAAV,CAA2B,YAA3B,EAA0CC,KAAD,IAAuB;AAC9D,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,KAAK,CAACE,cAAN,CAAqBC,MAAzC,EAAiD,EAAEF,CAAnD,EAAsD;AACpD,cAAMG,YAA0B,GAAG,KAAKC,QAAL,CACjCL,KADiC,EAEjCT,UAAU,CAACe,IAFsB,EAGjCL,CAHiC,EAIjCT,cAAc,CAACc,IAJkB,CAAnC,CADoD,CAQpD;AACA;;AACA,YACE,CAACZ,iBAAiB,CAAC,KAAKI,IAAN,EAAY;AAC5BS,UAAAA,CAAC,EAAEH,YAAY,CAACG,CADY;AAE5BC,UAAAA,CAAC,EAAEJ,YAAY,CAACI;AAFY,SAAZ,CAAlB,IAIA;AACAR,QAAAA,KAAK,CAACE,cAAN,CAAqBD,CAArB,EAAwBQ,SAAxB,KAAsC,QANxC,EAOE;AACA;AACD;;AAED,aAAKC,cA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Ac,EAAEA;AAXX,KAAP;AAaD;;AA1JsE","sourcesContent":["import { AdaptedEvent, EventTypes, TouchEventType } from '../interfaces';\nimport EventManager from './EventManager';\nimport { isPointerInBounds } from '../utils';\nimport { PointerType } from '../../PointerType';\n\nexport default class TouchEventManager extends EventManager<HTMLElement> {\n public setListeners(): void {\n this.view.addEventListener('touchstart', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.DOWN,\n i,\n TouchEventType.DOWN\n );\n\n // Here we skip stylus, because in case of anything different than touch we want to handle it by using PointerEvents\n // If we leave stylus to send touch events, handlers will receive every action twice\n if (\n !isPointerInBounds(this.view, {\n x: adaptedEvent.x,\n y: adaptedEvent.y,\n }) ||\n //@ts-ignore touchType field does exist\n event.changedTouches[i].touchType === 'stylus'\n ) {\n continue;\n }\n\n this.markAsInBounds(adaptedEvent.pointerId);\n\n if (++this.activePointersCounter > 1) {\n adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_DOWN;\n this.onPointerAdd(adaptedEvent);\n } else {\n this.onPointerDown(adaptedEvent);\n }\n }\n });\n\n this.view.addEventListener('touchmove', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.MOVE,\n i,\n TouchEventType.MOVE\n );\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n const inBounds: boolean = isPointerInBounds(this.view, {\n x: adaptedEvent.x,\n y: adaptedEvent.y,\n });\n\n const pointerIndex: number = this.pointersInBounds.indexOf(\n adaptedEvent.pointerId\n );\n\n if (inBounds) {\n if (pointerIndex < 0) {\n adaptedEvent.eventType = EventTypes.ENTER;\n this.onPointerEnter(adaptedEvent);\n this.markAsInBounds(adaptedEvent.pointerId);\n } else {\n this.onPointerMove(adaptedEvent);\n }\n } else {\n if (pointerIndex >= 0) {\n adaptedEvent.eventType = EventTypes.LEAVE;\n this.onPointerLeave(adaptedEvent);\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n } else {\n this.onPointerOutOfBounds(adaptedEvent);\n }\n }\n }\n });\n\n this.view.addEventListener('touchend', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n // When we call reset on gesture handlers, it also resets their event managers\n // In some handlers (like RotationGestureHandler) reset is called before all pointers leave view\n // This means, that activePointersCounter will be set to 0, while there are still remaining pointers on view\n // Removing them will end in activePointersCounter going below 0, therefore handlers won't behave properly\n if (this.activePointersCounter === 0) {\n break;\n }\n\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.UP,\n i,\n TouchEventType.UP\n );\n\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n\n if (--this.activePointersCounter > 0) {\n adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_UP;\n this.onPointerRemove(adaptedEvent);\n } else {\n this.onPointerUp(adaptedEvent);\n }\n }\n });\n\n this.view.addEventListener('touchcancel', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.CANCEL,\n i,\n TouchEventType.CANCELLED\n );\n\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n this.onPointerCancel(adaptedEvent);\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n this.activePointersCounter = 0;\n }\n });\n }\n\n protected mapEvent(\n event: TouchEvent,\n eventType: EventTypes,\n index: number,\n touchEventType: TouchEventType\n ): AdaptedEvent {\n const rect = this.view.getBoundingClientRect();\n const clientX = event.changedTouches[index].clientX;\n const clientY = event.changedTouches[index].clientY;\n\n return {\n x: clientX,\n y: clientY,\n offsetX: clientX - rect.left,\n offsetY: clientY - rect.top,\n pointerId: event.changedTouches[index].identifier,\n eventType: eventType,\n pointerType: PointerType.TOUCH,\n time: event.timeStamp,\n allTouches: event.touches,\n changedTouches: event.changedTouches,\n touchEventType: touchEventType,\n };\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["TouchEventManager.ts"],"names":["EventTypes","TouchEventType","EventManager","isPointerInBounds","PointerType","TouchEventManager","event","i","changedTouches","length","adaptedEvent","mapEvent","DOWN","view","x","y","touchType","markAsInBounds","pointerId","activePointersCounter","eventType","ADDITIONAL_POINTER_DOWN","onPointerAdd","onPointerDown","MOVE","inBounds","pointerIndex","pointersInBounds","indexOf","ENTER","onPointerEnter","onPointerMove","LEAVE","onPointerLeave","markAsOutOfBounds","onPointerOutOfBounds","UP","ADDITIONAL_POINTER_UP","onPointerRemove","onPointerUp","CANCEL","CANCELLED","onPointerCancel","registerListeners","addEventListener","touchStartCallback","touchMoveCallback","touchEndCallback","touchCancelCallback","unregisterListeners","removeEventListener","index","touchEventType","rect","getBoundingClientRect","clientX","clientY","offsetX","left","offsetY","top","identifier","pointerType","TOUCH","time","timeStamp","allTouches","touches"],"mappings":";;AAAA,SAAuBA,UAAvB,EAAmCC,cAAnC,QAAyD,eAAzD;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,SAASC,iBAAT,QAAkC,UAAlC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA,eAAe,MAAMC,iBAAN,SAAgCH,YAAhC,CAA0D;AAAA;AAAA;;AAAA,gDACzCI,KAAD,IAA6B;AACxD,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,KAAK,CAACE,cAAN,CAAqBC,MAAzC,EAAiD,EAAEF,CAAnD,EAAsD;AACpD,cAAMG,YAA0B,GAAG,KAAKC,QAAL,CACjCL,KADiC,EAEjCN,UAAU,CAACY,IAFsB,EAGjCL,CAHiC,EAIjCN,cAAc,CAACW,IAJkB,CAAnC,CADoD,CAQpD;AACA;;AACA,YACE,CAACT,iBAAiB,CAAC,KAAKU,I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,SAFgB,EAGhB+B,KAHgB,EAIhBC,cAJgB,EAKF;AACd,UAAMC,IAAI,GAAG,KAAKxC,IAAL,CAAUyC,qBAAV,EAAb;AACA,UAAMC,OAAO,GAAGjD,KAAK,CAACE,cAAN,CAAqB2C,KAArB,EAA4BI,OAA5C;AACA,UAAMC,OAAO,GAAGlD,KAAK,CAACE,cAAN,CAAqB2C,KAArB,EAA4BK,OAA5C;AAEA,WAAO;AACL1C,MAAAA,CAAC,EAAEyC,OADE;AAELxC,MAAAA,CAAC,EAAEyC,OAFE;AAGLC,MAAAA,OAAO,EAAEF,OAAO,GAAGF,IAAI,CAACK,IAHnB;AAILC,MAAAA,OAAO,EAAEH,OAAO,GAAGH,IAAI,CAACO,GAJnB;AAKL1C,MAAAA,SAAS,EAAEZ,KAAK,CAACE,cAAN,CAAqB2C,KAArB,EAA4BU,UALlC;AAMLzC,MAAAA,SAAS,EAAEA,SANN;AAOL0C,MAAAA,WAAW,EAAE1D,WAAW,CAAC2D,KAPpB;AAQLC,MAAAA,IAAI,EAAE1D,KAAK,CAAC2D,SARP;AASLC,MAAAA,UAAU,EAAE5D,KAAK,CAAC6D,OATb;AAUL3D,MAAAA,cAAc,EAAEF,KAAK,CAACE,cAVjB;AAWL4C,MAAAA,cAAc,EAAEA;AAXX,KAAP;AAaD;;AAtKsE","sourcesContent":["import { AdaptedEvent, EventTypes, TouchEventType } from '../interfaces';\nimport EventManager from './EventManager';\nimport { isPointerInBounds } from '../utils';\nimport { PointerType } from '../../PointerType';\n\nexport default class TouchEventManager extends EventManager<HTMLElement> {\n private touchStartCallback = (event: TouchEvent): void => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.DOWN,\n i,\n TouchEventType.DOWN\n );\n\n // Here we skip stylus, because in case of anything different than touch we want to handle it by using PointerEvents\n // If we leave stylus to send touch events, handlers will receive every action twice\n if (\n !isPointerInBounds(this.view, {\n x: adaptedEvent.x,\n y: adaptedEvent.y,\n }) ||\n //@ts-ignore touchType field does exist\n event.changedTouches[i].touchType === 'stylus'\n ) {\n continue;\n }\n\n this.markAsInBounds(adaptedEvent.pointerId);\n\n if (++this.activePointersCounter > 1) {\n adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_DOWN;\n this.onPointerAdd(adaptedEvent);\n } else {\n this.onPointerDown(adaptedEvent);\n }\n }\n };\n\n private touchMoveCallback = (event: TouchEvent): void => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.MOVE,\n i,\n TouchEventType.MOVE\n );\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n const inBounds: boolean = isPointerInBounds(this.view, {\n x: adaptedEvent.x,\n y: adaptedEvent.y,\n });\n\n const pointerIndex: number = this.pointersInBounds.indexOf(\n adaptedEvent.pointerId\n );\n\n if (inBounds) {\n if (pointerIndex < 0) {\n adaptedEvent.eventType = EventTypes.ENTER;\n this.onPointerEnter(adaptedEvent);\n this.markAsInBounds(adaptedEvent.pointerId);\n } else {\n this.onPointerMove(adaptedEvent);\n }\n } else {\n if (pointerIndex >= 0) {\n adaptedEvent.eventType = EventTypes.LEAVE;\n this.onPointerLeave(adaptedEvent);\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n } else {\n this.onPointerOutOfBounds(adaptedEvent);\n }\n }\n }\n };\n\n private touchEndCallback = (event: TouchEvent): void => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n // When we call reset on gesture handlers, it also resets their event managers\n // In some handlers (like RotationGestureHandler) reset is called before all pointers leave view\n // This means, that activePointersCounter will be set to 0, while there are still remaining pointers on view\n // Removing them will end in activePointersCounter going below 0, therefore handlers won't behave properly\n if (this.activePointersCounter === 0) {\n break;\n }\n\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.UP,\n i,\n TouchEventType.UP\n );\n\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n\n if (--this.activePointersCounter > 0) {\n adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_UP;\n this.onPointerRemove(adaptedEvent);\n } else {\n this.onPointerUp(adaptedEvent);\n }\n }\n };\n\n private touchCancelCallback = (event: TouchEvent): void => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.CANCEL,\n i,\n TouchEventType.CANCELLED\n );\n\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n this.onPointerCancel(adaptedEvent);\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n this.activePointersCounter = 0;\n }\n };\n\n public registerListeners(): void {\n this.view.addEventListener('touchstart', this.touchStartCallback);\n this.view.addEventListener('touchmove', this.touchMoveCallback);\n this.view.addEventListener('touchend', this.touchEndCallback);\n this.view.addEventListener('touchcancel', this.touchCancelCallback);\n }\n\n public unregisterListeners(): void {\n this.view.removeEventListener('touchstart', this.touchStartCallback);\n this.view.removeEventListener('touchmove', this.touchMoveCallback);\n this.view.removeEventListener('touchend', this.touchEndCallback);\n this.view.removeEventListener('touchcancel', this.touchCancelCallback);\n }\n\n protected mapEvent(\n event: TouchEvent,\n eventType: EventTypes,\n index: number,\n touchEventType: TouchEventType\n ): AdaptedEvent {\n const rect = this.view.getBoundingClientRect();\n const clientX = event.changedTouches[index].clientX;\n const clientY = event.changedTouches[index].clientY;\n\n return {\n x: clientX,\n y: clientY,\n offsetX: clientX - rect.left,\n offsetY: clientY - rect.top,\n pointerId: event.changedTouches[index].identifier,\n eventType: eventType,\n pointerType: PointerType.TOUCH,\n time: event.timeStamp,\n allTouches: event.touches,\n changedTouches: event.changedTouches,\n touchEventType: touchEventType,\n };\n }\n}\n"]}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
|
3
|
+
import { DiagonalDirections, Directions } from '../../Directions';
|
4
|
+
import { MINIMAL_FLING_VELOCITY } from '../constants';
|
5
|
+
export default class Vector {
|
6
|
+
constructor(x, y) {
|
7
|
+
_defineProperty(this, "x", void 0);
|
8
|
+
|
9
|
+
_defineProperty(this, "y", void 0);
|
10
|
+
|
11
|
+
_defineProperty(this, "unitX", void 0);
|
12
|
+
|
13
|
+
_defineProperty(this, "unitY", void 0);
|
14
|
+
|
15
|
+
_defineProperty(this, "_magnitude", void 0);
|
16
|
+
|
17
|
+
this.x = x;
|
18
|
+
this.y = y;
|
19
|
+
this._magnitude = Math.hypot(this.x, this.y);
|
20
|
+
const isMagnitudeSufficient = this._magnitude > MINIMAL_FLING_VELOCITY;
|
21
|
+
this.unitX = isMagnitudeSufficient ? this.x / this._magnitude : 0;
|
22
|
+
this.unitY = isMagnitudeSufficient ? this.y / this._magnitude : 0;
|
23
|
+
}
|
24
|
+
|
25
|
+
static fromDirection(direction) {
|
26
|
+
return DirectionToVectorMappings.get(direction);
|
27
|
+
}
|
28
|
+
|
29
|
+
static fromVelocity(tracker, pointerId) {
|
30
|
+
return new Vector(tracker.getVelocityX(pointerId), tracker.getVelocityY(pointerId));
|
31
|
+
}
|
32
|
+
|
33
|
+
get magnitude() {
|
34
|
+
return this._magnitude;
|
35
|
+
}
|
36
|
+
|
37
|
+
computeSimilarity(vector) {
|
38
|
+
return this.unitX * vector.unitX + this.unitY * vector.unitY;
|
39
|
+
}
|
40
|
+
|
41
|
+
isSimilar(vector, threshold) {
|
42
|
+
return this.computeSimilarity(vector) > threshold;
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
const DirectionToVectorMappings = new Map([[Directions.LEFT, new Vector(-1, 0)], [Directions.RIGHT, new Vector(1, 0)], [Directions.UP, new Vector(0, -1)], [Directions.DOWN, new Vector(0, 1)], [DiagonalDirections.UP_RIGHT, new Vector(1, -1)], [DiagonalDirections.DOWN_RIGHT, new Vector(1, 1)], [DiagonalDirections.UP_LEFT, new Vector(-1, -1)], [DiagonalDirections.DOWN_LEFT, new Vector(-1, 1)]]);
|
47
|
+
//# sourceMappingURL=Vector.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["Vector.ts"],"names":["DiagonalDirections","Directions","MINIMAL_FLING_VELOCITY","Vector","constructor","x","y","_magnitude","Math","hypot","isMagnitudeSufficient","unitX","unitY","fromDirection","direction","DirectionToVectorMappings","get","fromVelocity","tracker","pointerId","getVelocityX","getVelocityY","magnitude","computeSimilarity","vector","isSimilar","threshold","Map","LEFT","RIGHT","UP","DOWN","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;AAAA,SAASA,kBAAT,EAA6BC,UAA7B,QAA+C,kBAA/C;AACA,SAASC,sBAAT,QAAuC,cAAvC;AAGA,eAAe,MAAMC,MAAN,CAAa;AAO1BC,EAAAA,WAAW,CAACC,CAAD,EAAYC,CAAZ,EAAuB;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAChC,SAAKD,CAAL,GAASA,CAAT;AACA,SAAKC,CAAL,GAASA,CAAT;AAEA,SAAKC,UAAL,GAAkBC,IAAI,CAACC,KAAL,CAAW,KAAKJ,CAAhB,EAAmB,KAAKC,CAAxB,CAAlB;AACA,UAAMI,qBAAqB,GAAG,KAAKH,UAAL,GAAkBL,sBAAhD;AAEA,SAAKS,KAAL,GAAaD,qBAAqB,GAAG,KAAKL,CAAL,GAAS,KAAKE,UAAjB,GAA8B,CAAhE;AACA,SAAKK,KAAL,GAAaF,qBAAqB,GAAG,KAAKJ,CAAL,GAAS,KAAKC,UAAjB,GAA8B,CAAhE;AACD;;AAEmB,SAAbM,aAAa,CAACC,SAAD,EAAqD;AACvE,WAAOC,yBAAyB,CAACC,GAA1B,CAA8BF,SAA9B,CAAP;AACD;;AAEk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CAAhB,CAA7B,CARA,EASA,CAACH,kBAAkB,CAACmC,SAApB,EAA+B,IAAIhC,MAAJ,CAAW,CAAC,CAAZ,EAAe,CAAf,CAA/B,CATA,CAHgC,CAAlC","sourcesContent":["import { DiagonalDirections, Directions } from '../../Directions';\nimport { MINIMAL_FLING_VELOCITY } from '../constants';\nimport PointerTracker from './PointerTracker';\n\nexport default class Vector {\n private readonly x;\n private readonly y;\n private readonly unitX;\n private readonly unitY;\n private readonly _magnitude;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n\n this._magnitude = Math.hypot(this.x, this.y);\n const isMagnitudeSufficient = this._magnitude > MINIMAL_FLING_VELOCITY;\n\n this.unitX = isMagnitudeSufficient ? this.x / this._magnitude : 0;\n this.unitY = isMagnitudeSufficient ? this.y / this._magnitude : 0;\n }\n\n static fromDirection(direction: Directions | DiagonalDirections): Vector {\n return DirectionToVectorMappings.get(direction)!;\n }\n\n static fromVelocity(tracker: PointerTracker, pointerId: number) {\n return new Vector(\n tracker.getVelocityX(pointerId),\n tracker.getVelocityY(pointerId)\n );\n }\n\n get magnitude() {\n return this._magnitude;\n }\n\n computeSimilarity(vector: Vector) {\n return this.unitX * vector.unitX + this.unitY * vector.unitY;\n }\n\n isSimilar(vector: Vector, threshold: number) {\n return this.computeSimilarity(vector) > threshold;\n }\n}\n\nconst DirectionToVectorMappings = new Map<\n Directions | DiagonalDirections,\n Vector\n>([\n [Directions.LEFT, new Vector(-1, 0)],\n [Directions.RIGHT, new Vector(1, 0)],\n [Directions.UP, new Vector(0, -1)],\n [Directions.DOWN, new Vector(0, 1)],\n\n [DiagonalDirections.UP_RIGHT, new Vector(1, -1)],\n [DiagonalDirections.DOWN_RIGHT, new Vector(1, 1)],\n [DiagonalDirections.UP_LEFT, new Vector(-1, -1)],\n [DiagonalDirections.DOWN_LEFT, new Vector(-1, 1)],\n]);\n"]}
|
package/lib/module/web/utils.js
CHANGED
@@ -7,4 +7,6 @@ export function isPointerInBounds(view, {
|
|
7
7
|
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
8
8
|
}
|
9
9
|
export const PointerTypeMapping = new Map([['mouse', PointerType.MOUSE], ['touch', PointerType.TOUCH], ['pen', PointerType.STYLUS], ['none', PointerType.OTHER]]);
|
10
|
+
export const degToRad = degrees => degrees * Math.PI / 180;
|
11
|
+
export const coneToDeviation = degrees => Math.cos(degToRad(degrees / 2));
|
10
12
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["utils.ts"],"names":["PointerType","isPointerInBounds","view","x","y","rect","getBoundingClientRect","left","right","top","bottom","PointerTypeMapping","Map","MOUSE","TOUCH","STYLUS","OTHER"],"mappings":"AAAA,SAASA,WAAT,QAA4B,gBAA5B;
|
1
|
+
{"version":3,"sources":["utils.ts"],"names":["PointerType","isPointerInBounds","view","x","y","rect","getBoundingClientRect","left","right","top","bottom","PointerTypeMapping","Map","MOUSE","TOUCH","STYLUS","OTHER","degToRad","degrees","Math","PI","coneToDeviation","cos"],"mappings":"AAAA,SAASA,WAAT,QAA4B,gBAA5B;AAGA,OAAO,SAASC,iBAAT,CAA2BC,IAA3B,EAA8C;AAAEC,EAAAA,CAAF;AAAKC,EAAAA;AAAL,CAA9C,EAAwE;AAC7E,QAAMC,IAAa,GAAGH,IAAI,CAACI,qBAAL,EAAtB;AAEA,SAAOH,CAAC,IAAIE,IAAI,CAACE,IAAV,IAAkBJ,CAAC,IAAIE,IAAI,CAACG,KAA5B,IAAqCJ,CAAC,IAAIC,IAAI,CAACI,GAA/C,IAAsDL,CAAC,IAAIC,IAAI,CAACK,MAAvE;AACD;AAED,OAAO,MAAMC,kBAAkB,GAAG,IAAIC,GAAJ,CAA6B,CAC7D,CAAC,OAAD,EAAUZ,WAAW,CAACa,KAAtB,CAD6D,EAE7D,CAAC,OAAD,EAAUb,WAAW,CAACc,KAAtB,CAF6D,EAG7D,CAAC,KAAD,EAAQd,WAAW,CAACe,MAApB,CAH6D,EAI7D,CAAC,MAAD,EAASf,WAAW,CAACgB,KAArB,CAJ6D,CAA7B,CAA3B;AAOP,OAAO,MAAMC,QAAQ,GAAIC,OAAD,IAAsBA,OAAO,GAAGC,IAAI,CAACC,EAAhB,GAAsB,GAA5D;AAEP,OAAO,MAAMC,eAAe,GAAIH,OAAD,IAC7BC,IAAI,CAACG,GAAL,CAASL,QAAQ,CAACC,OAAO,GAAG,CAAX,CAAjB,CADK","sourcesContent":["import { PointerType } from '../PointerType';\nimport { Point } from './interfaces';\n\nexport function isPointerInBounds(view: HTMLElement, { x, y }: Point): boolean {\n const rect: DOMRect = view.getBoundingClientRect();\n\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n}\n\nexport const PointerTypeMapping = new Map<string, PointerType>([\n ['mouse', PointerType.MOUSE],\n ['touch', PointerType.TOUCH],\n ['pen', PointerType.STYLUS],\n ['none', PointerType.OTHER],\n]);\n\nexport const degToRad = (degrees: number) => (degrees * Math.PI) / 180;\n\nexport const coneToDeviation = (degrees: number) =>\n Math.cos(degToRad(degrees / 2));\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["NodeManager.ts"],"names":["gestures","getHandler","tag","Error","createGestureHandler","handlerTag","handler","dropGestureHandler","destroy","getNodes"],"mappings":"AAGA,MAAMA,QAGL,GAAG,EAHJ;AAKA,OAAO,SAASC,UAAT,CAAoBC,GAApB,EAAiC;AACtC,MAAIA,GAAG,IAAIF,QAAX,EAAqB;AACnB,WAAOA,QAAQ,CAACE,GAAD,CAAf;AACD;;AAED,QAAM,IAAIC,KAAJ,CAAW,sBAAqBD,GAAI,EAApC,CAAN;AACD;AAED,OAAO,SAASE,oBAAT,CACLC,UADK,EAELC,OAFK,EAGL;AACA,MAAID,UAAU,IAAIL,QAAlB,EAA4B;AAC1B,UAAM,IAAIG,KAAJ,CAAW,oBAAmBE,UAAW,iBAAzC,CAAN;AACD;;AACDL,EAAAA,QAAQ,CAACK,UAAD,CAAR,GAAuBC,OAAvB,CAJA,CAKA;;AACAN,EAAAA,QAAQ,CAACK,UAAD,CAAR,CAAqBA,UAArB,GAAkCA,UAAlC;AACD;AAED,OAAO,SAASE,kBAAT,CAA4BF,UAA5B,EAAgD;AACrD;AACA;AACA,MAAI,EAAEA,UAAU,IAAIL,QAAhB,CAAJ,EAA+B;AAC7B;AACD;;AACDC,EAAAA,UAAU,CAACI,UAAD,CAAV,CAAuBG,OAAvB,GANqD,CAOrD;;AACA,SAAOR,QAAQ,CAACK,UAAD,CAAf;AACD;AAED,OAAO,SAASI,QAAT,GAAoB;AACzB,SAAO,EAAE,GAAGT;AAAL,GAAP;AACD","sourcesContent":["import { ValueOf } from '../typeUtils';\nimport { HammerGestures } from '../
|
1
|
+
{"version":3,"sources":["NodeManager.ts"],"names":["gestures","getHandler","tag","Error","createGestureHandler","handlerTag","handler","dropGestureHandler","destroy","getNodes"],"mappings":"AAGA,MAAMA,QAGL,GAAG,EAHJ;AAKA,OAAO,SAASC,UAAT,CAAoBC,GAApB,EAAiC;AACtC,MAAIA,GAAG,IAAIF,QAAX,EAAqB;AACnB,WAAOA,QAAQ,CAACE,GAAD,CAAf;AACD;;AAED,QAAM,IAAIC,KAAJ,CAAW,sBAAqBD,GAAI,EAApC,CAAN;AACD;AAED,OAAO,SAASE,oBAAT,CACLC,UADK,EAELC,OAFK,EAGL;AACA,MAAID,UAAU,IAAIL,QAAlB,EAA4B;AAC1B,UAAM,IAAIG,KAAJ,CAAW,oBAAmBE,UAAW,iBAAzC,CAAN;AACD;;AACDL,EAAAA,QAAQ,CAACK,UAAD,CAAR,GAAuBC,OAAvB,CAJA,CAKA;;AACAN,EAAAA,QAAQ,CAACK,UAAD,CAAR,CAAqBA,UAArB,GAAkCA,UAAlC;AACD;AAED,OAAO,SAASE,kBAAT,CAA4BF,UAA5B,EAAgD;AACrD;AACA;AACA,MAAI,EAAEA,UAAU,IAAIL,QAAhB,CAAJ,EAA+B;AAC7B;AACD;;AACDC,EAAAA,UAAU,CAACI,UAAD,CAAV,CAAuBG,OAAvB,GANqD,CAOrD;;AACA,SAAOR,QAAQ,CAACK,UAAD,CAAf;AACD;AAED,OAAO,SAASI,QAAT,GAAoB;AACzB,SAAO,EAAE,GAAGT;AAAL,GAAP;AACD","sourcesContent":["import { ValueOf } from '../typeUtils';\nimport { HammerGestures } from '../web/Gestures';\n\nconst gestures: Record<\n number,\n InstanceType<ValueOf<typeof HammerGestures>>\n> = {};\n\nexport function getHandler(tag: number) {\n if (tag in gestures) {\n return gestures[tag];\n }\n\n throw new Error(`No handler for tag ${tag}`);\n}\n\nexport function createGestureHandler(\n handlerTag: number,\n handler: InstanceType<ValueOf<typeof HammerGestures>>\n) {\n if (handlerTag in gestures) {\n throw new Error(`Handler with tag ${handlerTag} already exists`);\n }\n gestures[handlerTag] = handler;\n // @ts-ignore no types for web handlers yet\n gestures[handlerTag].handlerTag = handlerTag;\n}\n\nexport function dropGestureHandler(handlerTag: number) {\n // Since React 18, there are cases where componentWillUnmount gets called twice in a row\n // so skip this if the tag was already removed.\n if (!(handlerTag in gestures)) {\n return;\n }\n getHandler(handlerTag).destroy();\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete gestures[handlerTag];\n}\n\nexport function getNodes() {\n return { ...gestures };\n}\n"]}
|
@@ -4,4 +4,11 @@ export declare const Directions: {
|
|
4
4
|
readonly UP: 4;
|
5
5
|
readonly DOWN: 8;
|
6
6
|
};
|
7
|
+
export declare const DiagonalDirections: {
|
8
|
+
readonly UP_RIGHT: number;
|
9
|
+
readonly DOWN_RIGHT: number;
|
10
|
+
readonly UP_LEFT: number;
|
11
|
+
readonly DOWN_LEFT: number;
|
12
|
+
};
|
7
13
|
export type Directions = typeof Directions[keyof typeof Directions];
|
14
|
+
export type DiagonalDirections = typeof DiagonalDirections[keyof typeof DiagonalDirections];
|
@@ -1,2 +1,15 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import React from 'react';
|
2
|
+
import type { ActionType } from './ActionType';
|
3
|
+
import { Gestures } from './web/Gestures';
|
4
|
+
import type { Config } from './web/interfaces';
|
5
|
+
declare const _default: {
|
6
|
+
handleSetJSResponder(tag: number, blockNativeResponder: boolean): void;
|
7
|
+
handleClearJSResponder(): void;
|
8
|
+
createGestureHandler<T>(handlerName: keyof typeof Gestures, handlerTag: number, config: T): void;
|
9
|
+
attachGestureHandler(handlerTag: number, newView: any, _actionType: ActionType, propsRef: React.RefObject<unknown>): void;
|
10
|
+
updateGestureHandler(handlerTag: number, newConfig: Config): void;
|
11
|
+
getGestureHandlerNode(handlerTag: number): import("./web/handlers/IGestureHandler").default | import("./web_hammer/NativeViewGestureHandler").default | import("./web_hammer/PanGestureHandler").default | import("./web_hammer/TapGestureHandler").default | import("./web_hammer/LongPressGestureHandler").default | import("./web_hammer/PinchGestureHandler").default | import("./web_hammer/RotationGestureHandler").default | import("./web_hammer/FlingGestureHandler").default;
|
12
|
+
dropGestureHandler(handlerTag: number): void;
|
13
|
+
flushOperations(): void;
|
14
|
+
};
|
15
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Component } from 'react';
|
3
3
|
import { Animated, StatusBarAnimation, StyleProp, ViewStyle } from 'react-native';
|
4
|
-
import { UserSelect, ActiveCursor } from '../handlers/gestureHandlerCommon';
|
4
|
+
import { UserSelect, ActiveCursor, MouseButton } from '../handlers/gestureHandlerCommon';
|
5
5
|
import { PanGestureHandler } from '../handlers/PanGestureHandler';
|
6
|
-
import { MouseButton } from '../web/interfaces';
|
7
6
|
export type DrawerPosition = 'left' | 'right';
|
8
7
|
export type DrawerState = 'Idle' | 'Dragging' | 'Settling';
|
9
8
|
export type DrawerType = 'front' | 'back' | 'slide';
|
@@ -1,22 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import {
|
3
|
-
|
4
|
-
import
|
5
|
-
export declare const
|
6
|
-
export
|
7
|
-
declare const
|
8
|
-
|
9
|
-
} & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
10
|
-
export declare const ScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & NativeViewGestureHandlerProps & React.RefAttributes<RNScrollView>>;
|
11
|
-
export type ScrollView = typeof GHScrollView & RNScrollView;
|
12
|
-
export declare const Switch: React.ForwardRefExoticComponent<RNSwitchProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
13
|
-
export type Switch = typeof Switch & RNSwitch;
|
14
|
-
export declare const TextInput: React.ForwardRefExoticComponent<RNTextInputProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
15
|
-
export type TextInput = typeof TextInput & RNTextInput;
|
16
|
-
export declare const DrawerLayoutAndroid: React.ForwardRefExoticComponent<RNDrawerLayoutAndroidProps & {
|
17
|
-
children?: React.ReactNode;
|
18
|
-
} & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
19
|
-
export type DrawerLayoutAndroid = typeof DrawerLayoutAndroid & RNDrawerLayoutAndroid;
|
20
|
-
export declare const FlatList: <ItemT = any>(props: React.PropsWithChildren<RNFlatListProps<ItemT> & React.RefAttributes<FlatList<ItemT>> & NativeViewGestureHandlerProps>, ref: React.ForwardedRef<FlatList<ItemT>>) => ReactElement | null;
|
21
|
-
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
22
|
-
export {};
|
2
|
+
import { FlatListProps } from 'react-native';
|
3
|
+
export declare const ScrollView: React.ForwardRefExoticComponent<import("react-native").ScrollViewProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
4
|
+
export declare const Switch: React.ForwardRefExoticComponent<import("react-native").SwitchProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
5
|
+
export declare const TextInput: React.ForwardRefExoticComponent<import("react-native").TextInputProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
6
|
+
export declare const DrawerLayoutAndroid: () => React.JSX.Element;
|
7
|
+
export declare const RefreshControl: React.ForwardRefExoticComponent<import("react-native").ViewProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
8
|
+
export declare const FlatList: React.ForwardRefExoticComponent<FlatListProps<unknown> & React.RefAttributes<unknown>>;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { PropsWithChildren, ForwardedRef, RefAttributes, ReactElement } from 'react';
|
3
|
+
import { ScrollView as RNScrollView, ScrollViewProps as RNScrollViewProps, Switch as RNSwitch, SwitchProps as RNSwitchProps, TextInput as RNTextInput, TextInputProps as RNTextInputProps, DrawerLayoutAndroid as RNDrawerLayoutAndroid, DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps, FlatList as RNFlatList, FlatListProps as RNFlatListProps, RefreshControl as RNRefreshControl } from 'react-native';
|
4
|
+
import { NativeViewGestureHandlerProps } from '../handlers/NativeViewGestureHandler';
|
5
|
+
export declare const RefreshControl: React.ForwardRefExoticComponent<import("react-native").RefreshControlProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
6
|
+
export type RefreshControl = typeof RefreshControl & RNRefreshControl;
|
7
|
+
declare const GHScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & {
|
8
|
+
children?: React.ReactNode;
|
9
|
+
} & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
10
|
+
export declare const ScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & NativeViewGestureHandlerProps & React.RefAttributes<RNScrollView>>;
|
11
|
+
export type ScrollView = typeof GHScrollView & RNScrollView;
|
12
|
+
export declare const Switch: React.ForwardRefExoticComponent<RNSwitchProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
13
|
+
export type Switch = typeof Switch & RNSwitch;
|
14
|
+
export declare const TextInput: React.ForwardRefExoticComponent<RNTextInputProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
15
|
+
export type TextInput = typeof TextInput & RNTextInput;
|
16
|
+
export declare const DrawerLayoutAndroid: React.ForwardRefExoticComponent<RNDrawerLayoutAndroidProps & {
|
17
|
+
children?: React.ReactNode;
|
18
|
+
} & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
|
19
|
+
export type DrawerLayoutAndroid = typeof DrawerLayoutAndroid & RNDrawerLayoutAndroid;
|
20
|
+
export declare const FlatList: <ItemT = any>(props: React.PropsWithChildren<RNFlatListProps<ItemT> & React.RefAttributes<FlatList<ItemT>> & NativeViewGestureHandlerProps>, ref: React.ForwardedRef<FlatList<ItemT>>) => ReactElement | null;
|
21
|
+
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
22
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
declare const _default:
|
1
|
+
import * as React from 'react';
|
2
|
+
import { View } from 'react-native';
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<React.RefAttributes<View>>;
|
4
4
|
export default _default;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Component } from 'react';
|
3
3
|
import { StyleProp, ViewStyle, TouchableWithoutFeedbackProps, Insets } from 'react-native';
|
4
|
-
import { GestureEvent, HandlerStateChangeEvent } from '../../handlers/gestureHandlerCommon';
|
4
|
+
import { GestureEvent, HandlerStateChangeEvent, UserSelect } from '../../handlers/gestureHandlerCommon';
|
5
5
|
import { NativeViewGestureHandlerPayload } from '../../handlers/NativeViewGestureHandler';
|
6
6
|
import { TouchableNativeFeedbackExtraProps } from './TouchableNativeFeedback.android';
|
7
7
|
/**
|
@@ -27,6 +27,7 @@ export interface GenericTouchableProps extends Omit<TouchableWithoutFeedbackProp
|
|
27
27
|
disallowInterruption?: boolean;
|
28
28
|
containerStyle?: StyleProp<ViewStyle>;
|
29
29
|
hitSlop?: Insets | number;
|
30
|
+
userSelect?: UserSelect;
|
30
31
|
}
|
31
32
|
interface InternalProps {
|
32
33
|
extraButtonProps: TouchableNativeFeedbackExtraProps;
|
@@ -1 +1 @@
|
|
1
|
-
export declare function getShadowNodeFromRef(
|
1
|
+
export declare function getShadowNodeFromRef(_ref: any): null;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getShadowNodeFromRef(ref: unknown): unknown;
|
@@ -22,7 +22,7 @@ export type NativeViewGestureHandlerPayload = {
|
|
22
22
|
*/
|
23
23
|
pointerInside: boolean;
|
24
24
|
};
|
25
|
-
export declare const nativeViewProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "mouseButton", "enableContextMenu", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange", "shouldActivateOnStart", "disallowInterruption"];
|
25
|
+
export declare const nativeViewProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "mouseButton", "enableContextMenu", "touchAction", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange", "shouldActivateOnStart", "disallowInterruption"];
|
26
26
|
export declare const nativeViewHandlerName = "NativeViewGestureHandler";
|
27
27
|
export type NativeViewGestureHandler = typeof NativeViewGestureHandler;
|
28
28
|
export declare const NativeViewGestureHandler: import("react").ComponentType<NativeViewGestureHandlerProps & import("react").RefAttributes<any>>;
|
@@ -103,7 +103,7 @@ export interface PanGestureHandlerProps extends BaseGestureHandlerProps<PanGestu
|
|
103
103
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
104
104
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
105
105
|
*/
|
106
|
-
activeOffsetY?: number | number
|
106
|
+
activeOffsetY?: number | [activeOffsetYStart: number, activeOffsetYEnd: number];
|
107
107
|
/**
|
108
108
|
* Range along X axis (in points) where fingers travels without activation of
|
109
109
|
* handler. Moving outside of this range implies activation of handler. Range
|
@@ -112,7 +112,7 @@ export interface PanGestureHandlerProps extends BaseGestureHandlerProps<PanGestu
|
|
112
112
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
113
113
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
114
114
|
*/
|
115
|
-
activeOffsetX?: number | number
|
115
|
+
activeOffsetX?: number | [activeOffsetXStart: number, activeOffsetXEnd: number];
|
116
116
|
/**
|
117
117
|
* When the finger moves outside this range (in points) along Y axis and
|
118
118
|
* handler hasn't yet activated it will fail recognizing the gesture. Range
|
@@ -121,7 +121,7 @@ export interface PanGestureHandlerProps extends BaseGestureHandlerProps<PanGestu
|
|
121
121
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
122
122
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
123
123
|
*/
|
124
|
-
failOffsetY?: number | number
|
124
|
+
failOffsetY?: number | [failOffsetYStart: number, failOffsetYEnd: number];
|
125
125
|
/**
|
126
126
|
* When the finger moves outside this range (in points) along X axis and
|
127
127
|
* handler hasn't yet activated it will fail recognizing the gesture. Range
|
@@ -130,7 +130,7 @@ export interface PanGestureHandlerProps extends BaseGestureHandlerProps<PanGestu
|
|
130
130
|
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
131
131
|
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
132
132
|
*/
|
133
|
-
failOffsetX?: number | number
|
133
|
+
failOffsetX?: number | [failOffsetXStart: number, failOffsetXEnd: number];
|
134
134
|
}
|
135
135
|
export declare const panHandlerName = "PanGestureHandler";
|
136
136
|
export type PanGestureHandler = typeof PanGestureHandler;
|
@@ -1 +1 @@
|
|
1
|
-
export
|
1
|
+
export declare function PressabilityDebugView(): null;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { PressabilityDebugView } from 'react-native/Libraries/Pressability/PressabilityDebug';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
|
@@ -2,9 +2,8 @@ import * as React from 'react';
|
|
2
2
|
import { State } from '../State';
|
3
3
|
import { TouchEventType } from '../TouchEventType';
|
4
4
|
import { ValueOf } from '../typeUtils';
|
5
|
-
import { MouseButton } from '../web/interfaces';
|
6
5
|
import { PointerType } from '../PointerType';
|
7
|
-
export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "mouseButton", "enableContextMenu", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
|
6
|
+
export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "mouseButton", "enableContextMenu", "touchAction", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
|
8
7
|
export declare const baseGestureHandlerWithMonitorProps: string[];
|
9
8
|
export interface GestureEventPayload {
|
10
9
|
handlerTag: number;
|
@@ -18,6 +17,15 @@ export interface HandlerStateChangeEventPayload extends GestureEventPayload {
|
|
18
17
|
export type HitSlop = number | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
|
19
18
|
export type UserSelect = 'none' | 'auto' | 'text';
|
20
19
|
export type ActiveCursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
|
20
|
+
export declare enum MouseButton {
|
21
|
+
LEFT = 1,
|
22
|
+
RIGHT = 2,
|
23
|
+
MIDDLE = 4,
|
24
|
+
BUTTON_4 = 8,
|
25
|
+
BUTTON_5 = 16,
|
26
|
+
ALL = 31
|
27
|
+
}
|
28
|
+
export type TouchAction = 'auto' | 'none' | 'pan-x' | 'pan-left' | 'pan-right' | 'pan-y' | 'pan-up' | 'pan-down' | 'pinch-zoom' | 'manipulation' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
|
21
29
|
export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
22
30
|
nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
|
23
31
|
}
|
@@ -49,6 +57,7 @@ export type CommonGestureConfig = {
|
|
49
57
|
activeCursor?: ActiveCursor;
|
50
58
|
mouseButton?: MouseButton;
|
51
59
|
enableContextMenu?: boolean;
|
60
|
+
touchAction?: TouchAction;
|
52
61
|
};
|
53
62
|
export type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = CommonGestureConfig & {
|
54
63
|
id?: string;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { GestureType, HandlerCallbacks } from './gesture';
|
3
3
|
import { SharedValue } from './reanimatedWrapper';
|
4
|
-
import { UserSelect } from '../gestureHandlerCommon';
|
4
|
+
import { UserSelect, TouchAction } from '../gestureHandlerCommon';
|
5
5
|
import { ComposedGesture } from './gestureComposition';
|
6
6
|
export type GestureConfigReference = {
|
7
7
|
config: GestureType[];
|
@@ -11,10 +11,47 @@ export type GestureConfigReference = {
|
|
11
11
|
useReanimatedHook: boolean;
|
12
12
|
};
|
13
13
|
interface GestureDetectorProps {
|
14
|
+
/**
|
15
|
+
* A gesture object containing the configuration and callbacks.
|
16
|
+
* Can be any of:
|
17
|
+
* - base gestures (`Tap`, `Pan`, ...)
|
18
|
+
* - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)
|
19
|
+
*/
|
14
20
|
gesture: ComposedGesture | GestureType;
|
15
21
|
children?: React.ReactNode;
|
22
|
+
/**
|
23
|
+
* #### Web only
|
24
|
+
* This parameter allows to specify which `userSelect` property should be applied to underlying view.
|
25
|
+
* Possible values are `"none" | "auto" | "text"`. Default value is set to `"none"`.
|
26
|
+
*/
|
16
27
|
userSelect?: UserSelect;
|
28
|
+
/**
|
29
|
+
* #### Web only
|
30
|
+
* Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.
|
31
|
+
* Default value is set to `false`.
|
32
|
+
*/
|
17
33
|
enableContextMenu?: boolean;
|
34
|
+
/**
|
35
|
+
* #### Web only
|
36
|
+
* This parameter allows to specify which `touchAction` property should be applied to underlying view.
|
37
|
+
* Supports all CSS touch-action values (e.g. `"none"`, `"pan-y"`). Default value is set to `"none"`.
|
38
|
+
*/
|
39
|
+
touchAction?: TouchAction;
|
18
40
|
}
|
41
|
+
/**
|
42
|
+
* `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.
|
43
|
+
*
|
44
|
+
* ### Props
|
45
|
+
* - `gesture`
|
46
|
+
* - `userSelect` (**Web only**)
|
47
|
+
* - `enableContextMenu` (**Web only**)
|
48
|
+
* - `touchAction` (**Web only**)
|
49
|
+
*
|
50
|
+
* ### Remarks
|
51
|
+
* - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.
|
52
|
+
* - Using the same instance of a gesture across multiple Gesture Detectors is not possible.
|
53
|
+
*
|
54
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector
|
55
|
+
*/
|
19
56
|
export declare const GestureDetector: (props: GestureDetectorProps) => React.JSX.Element;
|
20
57
|
export {};
|
@@ -3,7 +3,18 @@ import { FlingGestureConfig, FlingGestureHandlerEventPayload } from '../FlingGes
|
|
3
3
|
export declare class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {
|
4
4
|
config: BaseGestureConfig & FlingGestureConfig;
|
5
5
|
constructor();
|
6
|
+
/**
|
7
|
+
* Determine exact number of points required to handle the fling gesture.
|
8
|
+
* @param pointers
|
9
|
+
*/
|
6
10
|
numberOfPointers(pointers: number): this;
|
11
|
+
/**
|
12
|
+
* Expressed allowed direction of movement.
|
13
|
+
* Expected values are exported as constants in the Directions object.
|
14
|
+
* Arguments can be combined using `|` operator. Default value is set to `MouseButton.LEFT`.
|
15
|
+
* @param direction
|
16
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture/#directionvalue-directions
|
17
|
+
*/
|
7
18
|
direction(direction: number): this;
|
8
19
|
}
|
9
20
|
export type FlingGestureType = InstanceType<typeof FlingGesture>;
|
@@ -7,8 +7,22 @@ export type ForceTouchGestureChangeEventPayload = {
|
|
7
7
|
export declare class ForceTouchGesture extends ContinousBaseGesture<ForceTouchGestureHandlerEventPayload, ForceTouchGestureChangeEventPayload> {
|
8
8
|
config: BaseGestureConfig & ForceTouchGestureConfig;
|
9
9
|
constructor();
|
10
|
+
/**
|
11
|
+
* A minimal pressure that is required before gesture can activate.
|
12
|
+
* Should be a value from range [0.0, 1.0]. Default is 0.2.
|
13
|
+
* @param force
|
14
|
+
*/
|
10
15
|
minForce(force: number): this;
|
16
|
+
/**
|
17
|
+
* A maximal pressure that could be applied for gesture.
|
18
|
+
* If the pressure is greater, gesture fails. Should be a value from range [0.0, 1.0].
|
19
|
+
* @param force
|
20
|
+
*/
|
11
21
|
maxForce(force: number): this;
|
22
|
+
/**
|
23
|
+
* Value defining if haptic feedback has to be performed on activation.
|
24
|
+
* @param value
|
25
|
+
*/
|
12
26
|
feedbackOnActivation(value: boolean): this;
|
13
27
|
onChange(callback: (event: GestureUpdateEvent<GestureUpdateEvent<ForceTouchGestureHandlerEventPayload & ForceTouchGestureChangeEventPayload>>) => void): this;
|
14
28
|
}
|