react-native-gesture-handler 3.0.0-beta.3 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +42 -38
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +22 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +3 -6
- package/android/src/main/java/com/swmansion/gesturehandler/core/ManualGestureHandler.kt +2 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +63 -6
- package/android/src/main/java/com/swmansion/gesturehandler/core/OnJSResponderCancelListener.kt +6 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +2 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +16 -6
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +17 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/ViewConfigurationHelper.kt +0 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +47 -6
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +18 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +15 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +0 -6
- package/apple/Handlers/RNForceTouchHandler.m +1 -1
- package/apple/Handlers/RNHoverHandler.m +11 -11
- package/apple/Handlers/RNLongPressHandler.m +2 -2
- package/apple/Handlers/RNManualHandler.m +5 -0
- package/apple/Handlers/RNNativeViewHandler.mm +114 -53
- package/apple/Handlers/RNPanHandler.m +7 -3
- package/apple/Handlers/RNPinchHandler.m +9 -3
- package/apple/Handlers/RNRotationHandler.m +7 -2
- package/apple/Handlers/RNTapHandler.m +1 -1
- package/apple/RNGestureHandler.h +18 -0
- package/apple/RNGestureHandler.mm +32 -6
- package/apple/RNGestureHandlerButton.h +8 -0
- package/apple/RNGestureHandlerButton.mm +102 -11
- package/apple/RNGestureHandlerButtonComponentView.mm +85 -4
- package/apple/RNGestureHandlerRegistry.h +0 -1
- package/apple/RNRootViewGestureRecognizer.m +4 -15
- package/lib/module/components/GestureButtons.js +8 -8
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.web.js +51 -9
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +1 -1
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/Pressable/stateDefinitions.js +2 -0
- package/lib/module/components/Pressable/stateDefinitions.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +2 -6
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +11 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +8 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +3 -3
- package/lib/module/handlers/gestures/gesture.js +8 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureComposition.js +28 -0
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +27 -1
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +9 -0
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +8 -0
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +8 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/manualGesture.js +8 -0
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +8 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +13 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/pinchGesture.js +13 -0
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/rotationGesture.js +8 -0
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +8 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/v3/components/GestureButtons.js +4 -4
- package/lib/module/v3/components/GestureButtons.js.map +1 -1
- package/lib/module/v3/components/Pressable.js +3 -2
- package/lib/module/v3/components/Pressable.js.map +1 -1
- package/lib/module/v3/components/Touchable/Touchable.js +67 -29
- package/lib/module/v3/components/Touchable/Touchable.js.map +1 -1
- package/lib/module/v3/detectors/HostGestureDetector.web.js +2 -0
- package/lib/module/v3/detectors/HostGestureDetector.web.js.map +1 -1
- package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js +2 -0
- package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js.map +1 -1
- package/lib/module/v3/detectors/useNativeGestureRole.js +6 -0
- package/lib/module/v3/detectors/useNativeGestureRole.js.map +1 -0
- package/lib/module/v3/detectors/useNativeGestureRole.web.js +27 -0
- package/lib/module/v3/detectors/useNativeGestureRole.web.js.map +1 -0
- package/lib/module/v3/hooks/callbacks/useReanimatedEventHandler.js +17 -2
- package/lib/module/v3/hooks/callbacks/useReanimatedEventHandler.js.map +1 -1
- package/lib/module/v3/hooks/gestures/fling/useFlingGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/fling/useFlingGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/hover/useHoverGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/hover/useHoverGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/longPress/useLongPressGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/longPress/useLongPressGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/manual/useManualGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/manual/useManualGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/native/NativeTypes.js +1 -1
- package/lib/module/v3/hooks/gestures/native/NativeTypes.js.map +1 -1
- package/lib/module/v3/hooks/gestures/native/useNativeGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/native/useNativeGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/pan/usePanGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/pan/usePanGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/pinch/usePinchGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/pinch/usePinchGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/rotation/useRotationGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/rotation/useRotationGesture.js.map +1 -1
- package/lib/module/v3/hooks/gestures/tap/useTapGesture.js +2 -1
- package/lib/module/v3/hooks/gestures/tap/useTapGesture.js.map +1 -1
- package/lib/module/v3/hooks/useGesture.js +1 -4
- package/lib/module/v3/hooks/useGesture.js.map +1 -1
- package/lib/module/v3/hooks/utils/configUtils.js +7 -3
- package/lib/module/v3/hooks/utils/configUtils.js.map +1 -1
- package/lib/module/v3/hooks/utils/index.js +1 -1
- package/lib/module/v3/hooks/utils/index.js.map +1 -1
- package/lib/module/v3/hooks/utils/propsWhiteList.js +1 -1
- package/lib/module/v3/hooks/utils/propsWhiteList.js.map +1 -1
- package/lib/module/web/constants.js +1 -0
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +18 -5
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +9 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +25 -5
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +1 -4
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +1 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +65 -17
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +1 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +4 -6
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +4 -3
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +6 -0
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +8 -2
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureLifecycleEvents.js +10 -0
- package/lib/module/web/tools/GestureLifecycleEvents.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +9 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/typescript/components/GestureButtons.d.ts.map +1 -1
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +5 -1
- package/lib/typescript/components/GestureHandlerButton.web.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/stateDefinitions.d.ts.map +1 -1
- package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +3 -3
- package/lib/typescript/handlers/gestures/gesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +27 -1
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +6 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/manualGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/panGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/tapGesture.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureButtons.d.ts +1 -0
- package/lib/typescript/v3/components/GestureButtons.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureComponents.d.ts +3 -0
- package/lib/typescript/v3/components/GestureComponents.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureComponents.web.d.ts +4 -0
- package/lib/typescript/v3/components/GestureComponents.web.d.ts.map +1 -1
- package/lib/typescript/v3/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/v3/components/Touchable/Touchable.d.ts.map +1 -1
- package/lib/typescript/v3/components/Touchable/TouchableProps.d.ts +10 -1
- package/lib/typescript/v3/components/Touchable/TouchableProps.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/HostGestureDetector.web.d.ts +1 -1
- package/lib/typescript/v3/detectors/HostGestureDetector.web.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/VirtualDetector/VirtualDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/useNativeGestureRole.d.ts +3 -0
- package/lib/typescript/v3/detectors/useNativeGestureRole.d.ts.map +1 -0
- package/lib/typescript/v3/detectors/useNativeGestureRole.web.d.ts +3 -0
- package/lib/typescript/v3/detectors/useNativeGestureRole.web.d.ts.map +1 -0
- package/lib/typescript/v3/hooks/callbacks/useReanimatedEventHandler.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/fling/useFlingGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/fling/useFlingGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/hover/useHoverGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/hover/useHoverGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/longPress/useLongPressGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/longPress/useLongPressGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/manual/useManualGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/manual/useManualGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/native/NativeTypes.d.ts +7 -0
- package/lib/typescript/v3/hooks/gestures/native/NativeTypes.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/native/useNativeGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/native/useNativeGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/pan/usePanGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/pan/usePanGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/pinch/usePinchGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/pinch/usePinchGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/rotation/useRotationGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/rotation/useRotationGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/gestures/tap/useTapGesture.d.ts +1 -1
- package/lib/typescript/v3/hooks/gestures/tap/useTapGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/useGesture.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/utils/configUtils.d.ts +2 -2
- package/lib/typescript/v3/hooks/utils/configUtils.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/utils/index.d.ts +1 -1
- package/lib/typescript/v3/hooks/utils/index.d.ts.map +1 -1
- package/lib/typescript/v3/hooks/utils/propsWhiteList.d.ts +2 -2
- package/lib/typescript/v3/hooks/utils/propsWhiteList.d.ts.map +1 -1
- package/lib/typescript/v3/types/ConfigTypes.d.ts +1 -0
- package/lib/typescript/v3/types/ConfigTypes.d.ts.map +1 -1
- package/lib/typescript/web/constants.d.ts +1 -0
- package/lib/typescript/web/constants.d.ts.map +1 -1
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts.map +1 -1
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts.map +1 -1
- package/lib/typescript/web/handlers/GestureHandler.d.ts +8 -2
- package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -1
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +2 -0
- package/lib/typescript/web/handlers/IGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +13 -3
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/interfaces.d.ts +6 -0
- package/lib/typescript/web/interfaces.d.ts.map +1 -1
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +1 -0
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts.map +1 -1
- package/lib/typescript/web/tools/GestureLifecycleEvents.d.ts +7 -0
- package/lib/typescript/web/tools/GestureLifecycleEvents.d.ts.map +1 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/GestureButtons.tsx +10 -9
- package/src/components/GestureHandlerButton.web.tsx +94 -26
- package/src/components/Pressable/Pressable.tsx +2 -1
- package/src/components/Pressable/stateDefinitions.ts +3 -0
- package/src/components/touchables/GenericTouchable.tsx +2 -5
- package/src/handlers/gestures/GestureDetector/utils.ts +11 -1
- package/src/handlers/gestures/flingGesture.ts +6 -0
- package/src/handlers/gestures/forceTouchGesture.ts +3 -3
- package/src/handlers/gestures/gesture.ts +6 -0
- package/src/handlers/gestures/gestureComposition.ts +21 -0
- package/src/handlers/gestures/gestureObjects.ts +27 -1
- package/src/handlers/gestures/gestureStateManager.ts +6 -0
- package/src/handlers/gestures/hoverGesture.ts +6 -0
- package/src/handlers/gestures/longPressGesture.ts +6 -0
- package/src/handlers/gestures/manualGesture.ts +6 -0
- package/src/handlers/gestures/nativeGesture.ts +6 -0
- package/src/handlers/gestures/panGesture.ts +9 -0
- package/src/handlers/gestures/pinchGesture.ts +9 -0
- package/src/handlers/gestures/rotationGesture.ts +6 -0
- package/src/handlers/gestures/tapGesture.ts +6 -0
- package/src/v3/components/GestureButtons.tsx +5 -5
- package/src/v3/components/Pressable.tsx +2 -1
- package/src/v3/components/Touchable/Touchable.tsx +80 -47
- package/src/v3/components/Touchable/TouchableProps.ts +15 -1
- package/src/v3/detectors/HostGestureDetector.web.tsx +4 -1
- package/src/v3/detectors/VirtualDetector/VirtualDetector.tsx +3 -0
- package/src/v3/detectors/useNativeGestureRole.ts +8 -0
- package/src/v3/detectors/useNativeGestureRole.web.ts +42 -0
- package/src/v3/hooks/callbacks/useReanimatedEventHandler.ts +23 -7
- package/src/v3/hooks/gestures/fling/useFlingGesture.ts +5 -1
- package/src/v3/hooks/gestures/hover/useHoverGesture.ts +5 -1
- package/src/v3/hooks/gestures/longPress/useLongPressGesture.ts +3 -1
- package/src/v3/hooks/gestures/manual/useManualGesture.ts +5 -1
- package/src/v3/hooks/gestures/native/NativeTypes.ts +13 -1
- package/src/v3/hooks/gestures/native/useNativeGesture.ts +5 -1
- package/src/v3/hooks/gestures/pan/usePanGesture.ts +5 -1
- package/src/v3/hooks/gestures/pinch/usePinchGesture.ts +5 -1
- package/src/v3/hooks/gestures/rotation/useRotationGesture.ts +3 -1
- package/src/v3/hooks/gestures/tap/useTapGesture.ts +5 -1
- package/src/v3/hooks/useGesture.ts +0 -4
- package/src/v3/hooks/utils/configUtils.ts +16 -5
- package/src/v3/hooks/utils/index.ts +0 -1
- package/src/v3/hooks/utils/propsWhiteList.ts +1 -0
- package/src/v3/types/ConfigTypes.ts +1 -0
- package/src/web/constants.ts +1 -0
- package/src/web/detectors/RotationGestureDetector.ts +19 -5
- package/src/web/detectors/ScaleGestureDetector.ts +9 -3
- package/src/web/handlers/GestureHandler.ts +36 -6
- package/src/web/handlers/HoverGestureHandler.ts +2 -5
- package/src/web/handlers/IGestureHandler.ts +2 -0
- package/src/web/handlers/ManualGestureHandler.ts +2 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +122 -19
- package/src/web/handlers/PanGestureHandler.ts +2 -0
- package/src/web/handlers/PinchGestureHandler.ts +5 -7
- package/src/web/handlers/RotationGestureHandler.ts +5 -5
- package/src/web/interfaces.ts +7 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +11 -3
- package/src/web/tools/GestureLifecycleEvents.ts +14 -0
- package/src/web/tools/PointerEventManager.ts +12 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
import { NATIVE_GESTURE_ROLE_ATTRIBUTE } from '../../web/constants';
|
|
5
|
+
import { NativeGestureRole } from '../../web/interfaces';
|
|
6
|
+
|
|
7
|
+
export function useNativeGestureRole(
|
|
8
|
+
viewRef: RefObject<Element | null>,
|
|
9
|
+
children: ReactNode
|
|
10
|
+
): void {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const child = viewRef.current?.firstChild;
|
|
13
|
+
|
|
14
|
+
if (!(child instanceof HTMLElement)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// @ts-ignore This exists on React.ReactNode
|
|
19
|
+
const displayName = children?.type?.displayName as string;
|
|
20
|
+
|
|
21
|
+
if (displayName === NativeGestureRole.ScrollView) {
|
|
22
|
+
child.setAttribute(
|
|
23
|
+
NATIVE_GESTURE_ROLE_ATTRIBUTE,
|
|
24
|
+
NativeGestureRole.ScrollView
|
|
25
|
+
);
|
|
26
|
+
} else if (displayName === NativeGestureRole.Switch) {
|
|
27
|
+
child.setAttribute(
|
|
28
|
+
NATIVE_GESTURE_ROLE_ATTRIBUTE,
|
|
29
|
+
NativeGestureRole.Switch
|
|
30
|
+
);
|
|
31
|
+
} else if (displayName === NativeGestureRole.Button) {
|
|
32
|
+
child.setAttribute(
|
|
33
|
+
NATIVE_GESTURE_ROLE_ATTRIBUTE,
|
|
34
|
+
NativeGestureRole.Button
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
child.removeAttribute(NATIVE_GESTURE_ROLE_ATTRIBUTE);
|
|
40
|
+
};
|
|
41
|
+
}, [children, viewRef]);
|
|
42
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { ReanimatedHandler } from '../../../handlers/gestures/reanimatedWrapper';
|
|
4
4
|
import { Reanimated } from '../../../handlers/gestures/reanimatedWrapper';
|
|
@@ -10,6 +10,12 @@ import type {
|
|
|
10
10
|
} from '../../types';
|
|
11
11
|
import { eventHandler } from './eventHandler';
|
|
12
12
|
|
|
13
|
+
const REANIMATED_EVENT_NAMES = [
|
|
14
|
+
'onGestureHandlerReanimatedEvent',
|
|
15
|
+
'onGestureHandlerReanimatedStateChange',
|
|
16
|
+
'onGestureHandlerReanimatedTouchEvent',
|
|
17
|
+
];
|
|
18
|
+
|
|
13
19
|
const workletNOOP = () => {
|
|
14
20
|
'worklet';
|
|
15
21
|
// no-op
|
|
@@ -59,14 +65,24 @@ export function useReanimatedEventHandler<
|
|
|
59
65
|
);
|
|
60
66
|
};
|
|
61
67
|
|
|
68
|
+
// Fast Refresh invalidates `useMemo` caches but preserves `useRef`, so the
|
|
69
|
+
// `handlerTag` computed with `useMemo([])` in `useGesture` can regenerate
|
|
70
|
+
// on FR. Without forcing a rebuild, the registered worklet keeps the old
|
|
71
|
+
// `handlerTag` in its closure and `isEventForHandlerWithTag` rejects every
|
|
72
|
+
// event emitted by the freshly-created native handler.
|
|
73
|
+
const prevHandlerTagRef = useRef(handlerTag);
|
|
74
|
+
const handlerTagChanged = prevHandlerTagRef.current !== handlerTag;
|
|
75
|
+
|
|
76
|
+
// Write after commit so interrupted or re-invoked renders don't desync the
|
|
77
|
+
// ref from what was actually committed.
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
prevHandlerTagRef.current = handlerTag;
|
|
80
|
+
}, [handlerTag]);
|
|
81
|
+
|
|
62
82
|
const reanimatedEvent = Reanimated?.useEvent(
|
|
63
83
|
callback,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'onGestureHandlerReanimatedStateChange',
|
|
67
|
-
'onGestureHandlerReanimatedTouchEvent',
|
|
68
|
-
],
|
|
69
|
-
!!reanimatedHandler?.doDependenciesDiffer
|
|
84
|
+
REANIMATED_EVENT_NAMES,
|
|
85
|
+
handlerTagChanged || !!reanimatedHandler?.doDependenciesDiffer
|
|
70
86
|
);
|
|
71
87
|
|
|
72
88
|
return reanimatedEvent;
|
|
@@ -8,7 +8,11 @@ import type {
|
|
|
8
8
|
FlingHandlerData,
|
|
9
9
|
} from './FlingTypes';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const EMPTY_FLING_CONFIG: FlingGestureConfig = {};
|
|
12
|
+
|
|
13
|
+
export function useFlingGesture(
|
|
14
|
+
config: FlingGestureConfig = EMPTY_FLING_CONFIG
|
|
15
|
+
): FlingGesture {
|
|
12
16
|
const flingConfig = useClonedAndRemappedConfig<
|
|
13
17
|
FlingGestureProperties,
|
|
14
18
|
FlingHandlerData
|
|
@@ -44,7 +44,11 @@ function transformHoverProps(
|
|
|
44
44
|
|
|
45
45
|
const HoverPropsMapping = new Map<string, string>([['effect', 'hoverEffect']]);
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const EMPTY_HOVER_CONFIG: HoverGestureConfig = {};
|
|
48
|
+
|
|
49
|
+
export function useHoverGesture(
|
|
50
|
+
config: HoverGestureConfig = EMPTY_HOVER_CONFIG
|
|
51
|
+
): HoverGesture {
|
|
48
52
|
const hoverConfig = useClonedAndRemappedConfig<
|
|
49
53
|
HoverGestureProperties,
|
|
50
54
|
HoverHandlerData,
|
|
@@ -28,8 +28,10 @@ function transformLongPressProps(
|
|
|
28
28
|
return config;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
const EMPTY_LONG_PRESS_CONFIG: LongPressGestureConfig = {};
|
|
32
|
+
|
|
31
33
|
export function useLongPressGesture(
|
|
32
|
-
config: LongPressGestureConfig
|
|
34
|
+
config: LongPressGestureConfig = EMPTY_LONG_PRESS_CONFIG
|
|
33
35
|
): LongPressGesture {
|
|
34
36
|
const longPressConfig = useClonedAndRemappedConfig<
|
|
35
37
|
LongPressGestureProperties,
|
|
@@ -8,7 +8,11 @@ import type {
|
|
|
8
8
|
ManualHandlerData,
|
|
9
9
|
} from './ManualTypes';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const EMPTY_MANUAL_CONFIG: ManualGestureConfig = {};
|
|
12
|
+
|
|
13
|
+
export function useManualGesture(
|
|
14
|
+
config: ManualGestureConfig = EMPTY_MANUAL_CONFIG
|
|
15
|
+
): ManualGesture {
|
|
12
16
|
const manualConfig = useClonedAndRemappedConfig<
|
|
13
17
|
ManualGestureProperties,
|
|
14
18
|
ManualHandlerData
|
|
@@ -20,11 +20,23 @@ export type NativeGestureNativeProperties = {
|
|
|
20
20
|
* `NativeViewGestureHandler` receives an `ACTIVE` state event.
|
|
21
21
|
*/
|
|
22
22
|
disallowInterruption?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Composes with `disallowInterruption`. When both are `true`, the handler still
|
|
26
|
+
* resists discrete gestures but yields to continuous gestures, so a wrapping
|
|
27
|
+
* gesture can take over the touch stream. No-op when `disallowInterruption` is
|
|
28
|
+
* `false`.
|
|
29
|
+
*/
|
|
30
|
+
yieldsToContinuousGestures?: boolean;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
export const NativeHandlerNativeProperties = new Set<
|
|
26
34
|
keyof NativeGestureNativeProperties
|
|
27
|
-
>([
|
|
35
|
+
>([
|
|
36
|
+
'shouldActivateOnStart',
|
|
37
|
+
'disallowInterruption',
|
|
38
|
+
'yieldsToContinuousGestures',
|
|
39
|
+
]);
|
|
28
40
|
|
|
29
41
|
export type NativeHandlerData = {
|
|
30
42
|
pointerInside: boolean;
|
|
@@ -8,7 +8,11 @@ import type {
|
|
|
8
8
|
NativeHandlerData,
|
|
9
9
|
} from './NativeTypes';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const EMPTY_NATIVE_CONFIG: NativeGestureConfig = {};
|
|
12
|
+
|
|
13
|
+
export function useNativeGesture(
|
|
14
|
+
config: NativeGestureConfig = EMPTY_NATIVE_CONFIG
|
|
15
|
+
): NativeGesture {
|
|
12
16
|
const nativeConfig = useClonedAndRemappedConfig<
|
|
13
17
|
NativeGestureProperties,
|
|
14
18
|
NativeHandlerData
|
|
@@ -139,7 +139,11 @@ function transformPanProps(
|
|
|
139
139
|
return config;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
const EMPTY_PAN_CONFIG: PanGestureConfig = {};
|
|
143
|
+
|
|
144
|
+
export function usePanGesture(
|
|
145
|
+
config: PanGestureConfig = EMPTY_PAN_CONFIG
|
|
146
|
+
): PanGesture {
|
|
143
147
|
if (__DEV__) {
|
|
144
148
|
validatePanConfig(config);
|
|
145
149
|
}
|
|
@@ -40,7 +40,11 @@ function transformPinchProps(
|
|
|
40
40
|
|
|
41
41
|
const PinchPropsMapping = new Map<string, string>();
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
const EMPTY_PINCH_CONFIG: PinchGestureConfig = {};
|
|
44
|
+
|
|
45
|
+
export function usePinchGesture(
|
|
46
|
+
config: PinchGestureConfig = EMPTY_PINCH_CONFIG
|
|
47
|
+
): PinchGesture {
|
|
44
48
|
const pinchConfig = useClonedAndRemappedConfig<
|
|
45
49
|
PinchGestureProperties,
|
|
46
50
|
PinchHandlerData,
|
|
@@ -42,8 +42,10 @@ function transformRotationProps(
|
|
|
42
42
|
|
|
43
43
|
const RotationPropsMapping = new Map<string, string>();
|
|
44
44
|
|
|
45
|
+
const EMPTY_ROTATION_CONFIG: RotationGestureConfig = {};
|
|
46
|
+
|
|
45
47
|
export function useRotationGesture(
|
|
46
|
-
config: RotationGestureConfig
|
|
48
|
+
config: RotationGestureConfig = EMPTY_ROTATION_CONFIG
|
|
47
49
|
): RotationGesture {
|
|
48
50
|
const rotationConfig = useClonedAndRemappedConfig<
|
|
49
51
|
RotationGestureProperties,
|
|
@@ -18,7 +18,11 @@ const TapPropsMapping = new Map<
|
|
|
18
18
|
['maxDelay', 'maxDelayMs'],
|
|
19
19
|
]);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const EMPTY_TAP_CONFIG: TapGestureConfig = {};
|
|
22
|
+
|
|
23
|
+
export function useTapGesture(
|
|
24
|
+
config: TapGestureConfig = EMPTY_TAP_CONFIG
|
|
25
|
+
): TapGesture {
|
|
22
26
|
const tapConfig = useClonedAndRemappedConfig<
|
|
23
27
|
TapGestureProperties,
|
|
24
28
|
TapHandlerData,
|
|
@@ -16,7 +16,6 @@ import type {
|
|
|
16
16
|
import { useGestureCallbacks } from './useGestureCallbacks';
|
|
17
17
|
import {
|
|
18
18
|
bindSharedValues,
|
|
19
|
-
prepareConfig,
|
|
20
19
|
prepareConfigForNativeSide,
|
|
21
20
|
prepareRelations,
|
|
22
21
|
unbindSharedValues,
|
|
@@ -41,9 +40,6 @@ export function useGesture<
|
|
|
41
40
|
);
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
// This has to be done ASAP as other hooks depend `shouldUseReanimatedDetector`.
|
|
45
|
-
prepareConfig(config);
|
|
46
|
-
|
|
47
43
|
// TODO: Call only necessary hooks depending on which callbacks are defined (?)
|
|
48
44
|
const { jsEventHandler, reanimatedEventHandler, animatedEventHandler } =
|
|
49
45
|
useGestureCallbacks(handlerTag, config);
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from './propsWhiteList';
|
|
17
17
|
import { hasWorkletEventHandlers, maybeUnpackValue } from './reanimatedUtils';
|
|
18
18
|
|
|
19
|
-
export function
|
|
19
|
+
export function resolveInternalConfigProps<
|
|
20
20
|
TConfig extends object,
|
|
21
21
|
THandlerData,
|
|
22
22
|
TExtendedHandlerData extends THandlerData,
|
|
@@ -125,7 +125,7 @@ function remapProps<
|
|
|
125
125
|
TInternalConfig extends Record<string, unknown>,
|
|
126
126
|
>(
|
|
127
127
|
config: TConfig & TInternalConfig,
|
|
128
|
-
propsMapping:
|
|
128
|
+
propsMapping: ReadonlyMap<string, string>
|
|
129
129
|
): TInternalConfig {
|
|
130
130
|
type MergedConfig = TConfig & TInternalConfig;
|
|
131
131
|
|
|
@@ -142,6 +142,11 @@ function remapProps<
|
|
|
142
142
|
return config;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
const DEFAULT_PROPS_MAPPING = new Map<string, string>();
|
|
146
|
+
const DEFAULT_PROPS_TRANSFORMER = <TConfig extends object>(
|
|
147
|
+
config: TConfig
|
|
148
|
+
): TConfig => config;
|
|
149
|
+
|
|
145
150
|
export function useClonedAndRemappedConfig<
|
|
146
151
|
TConfig extends Record<string, unknown>,
|
|
147
152
|
THandlerData,
|
|
@@ -151,8 +156,10 @@ export function useClonedAndRemappedConfig<
|
|
|
151
156
|
config: ExcludeInternalConfigProps<
|
|
152
157
|
BaseGestureConfig<TConfig, THandlerData, TExtendedHandlerData>
|
|
153
158
|
>,
|
|
154
|
-
propsMapping:
|
|
155
|
-
propsTransformer: (
|
|
159
|
+
propsMapping: ReadonlyMap<string, string> = DEFAULT_PROPS_MAPPING,
|
|
160
|
+
propsTransformer: (
|
|
161
|
+
config: TInternalConfig
|
|
162
|
+
) => TInternalConfig = DEFAULT_PROPS_TRANSFORMER
|
|
156
163
|
): BaseGestureConfig<TInternalConfig, THandlerData, TExtendedHandlerData> {
|
|
157
164
|
return useMemo(() => {
|
|
158
165
|
const clonedConfig = cloneConfig<
|
|
@@ -161,11 +168,15 @@ export function useClonedAndRemappedConfig<
|
|
|
161
168
|
TExtendedHandlerData
|
|
162
169
|
>(config);
|
|
163
170
|
|
|
164
|
-
|
|
171
|
+
const transformedConfig = propsTransformer(
|
|
165
172
|
remapProps<TConfig, TInternalConfig>(
|
|
166
173
|
clonedConfig as TConfig & TInternalConfig,
|
|
167
174
|
propsMapping
|
|
168
175
|
)
|
|
169
176
|
);
|
|
177
|
+
|
|
178
|
+
resolveInternalConfigProps(transformedConfig);
|
|
179
|
+
|
|
180
|
+
return transformedConfig;
|
|
170
181
|
}, [config, propsMapping, propsTransformer]);
|
|
171
182
|
}
|
|
@@ -77,6 +77,7 @@ export type CommonGestureConfig = {
|
|
|
77
77
|
activeCursor?: ActiveCursor | undefined;
|
|
78
78
|
mouseButton?: MouseButton | undefined;
|
|
79
79
|
cancelsTouchesInView?: boolean | undefined;
|
|
80
|
+
cancelsJSResponder?: boolean | undefined;
|
|
80
81
|
manualActivation?: boolean | undefined;
|
|
81
82
|
},
|
|
82
83
|
ActiveCursor | MouseButton
|
package/src/web/constants.ts
CHANGED
|
@@ -84,15 +84,23 @@ export default class RotationGestureDetector
|
|
|
84
84
|
this.onRotationEnd(this);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
private setKeyPointers(tracker: PointerTracker): void {
|
|
87
|
+
private setKeyPointers(tracker: PointerTracker, excludeId?: number): void {
|
|
88
88
|
if (this.keyPointers[0] && this.keyPointers[1]) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
let assigned = 0;
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
for (const id of tracker.trackedPointers.keys()) {
|
|
95
|
+
if (id === excludeId) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.keyPointers[assigned++] = id;
|
|
100
|
+
if (assigned === 2) {
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
public onTouchEvent(event: AdaptedEvent, tracker: PointerTracker): boolean {
|
|
@@ -132,7 +140,13 @@ export default class RotationGestureDetector
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
if (this.keyPointers.indexOf(event.pointerId) >= 0) {
|
|
135
|
-
|
|
143
|
+
if (tracker.trackedPointersCount <= 2) {
|
|
144
|
+
this.reset();
|
|
145
|
+
} else {
|
|
146
|
+
this.keyPointers = [NaN, NaN];
|
|
147
|
+
this.setKeyPointers(tracker, event.pointerId);
|
|
148
|
+
this.previousAngle = NaN;
|
|
149
|
+
}
|
|
136
150
|
}
|
|
137
151
|
|
|
138
152
|
break;
|
|
@@ -44,10 +44,16 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
|
44
44
|
const action: EventTypes = event.eventType;
|
|
45
45
|
const numOfPointers = tracker.trackedPointersCount;
|
|
46
46
|
|
|
47
|
+
// When the last second pointer lifts (going down to 1), pause without
|
|
48
|
+
// touching span/time state so the gesture resumes cleanly on re-add.
|
|
49
|
+
// When 3+ → 2+ pointers, fall through so configChanged resets the span
|
|
50
|
+
// baseline to the remaining pointer set and avoids a scale jump.
|
|
51
|
+
if (action === EventTypes.ADDITIONAL_POINTER_UP && numOfPointers <= 2) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
const streamComplete: boolean =
|
|
48
|
-
action === EventTypes.UP ||
|
|
49
|
-
action === EventTypes.ADDITIONAL_POINTER_UP ||
|
|
50
|
-
action === EventTypes.CANCEL;
|
|
56
|
+
action === EventTypes.UP || action === EventTypes.CANCEL;
|
|
51
57
|
|
|
52
58
|
if (action === EventTypes.DOWN || streamComplete) {
|
|
53
59
|
if (this.inProgress) {
|
|
@@ -14,6 +14,7 @@ import { tagMessage } from '../../utils';
|
|
|
14
14
|
import type {
|
|
15
15
|
GestureStateChangeEventWithHandlerData,
|
|
16
16
|
GestureUpdateEventWithHandlerData,
|
|
17
|
+
HandlerData,
|
|
17
18
|
SingleGestureName,
|
|
18
19
|
} from '../../v3/types';
|
|
19
20
|
import type {
|
|
@@ -45,7 +46,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
45
46
|
|
|
46
47
|
private viewRef: number | null = null;
|
|
47
48
|
private propsRef: React.RefObject<PropsRef> | null = null;
|
|
48
|
-
|
|
49
|
+
protected actionType: ActionType | null = null;
|
|
49
50
|
private forAnimated: boolean = false;
|
|
50
51
|
private forReanimated: boolean = false;
|
|
51
52
|
private _handlerTag!: number;
|
|
@@ -302,6 +303,12 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
302
303
|
);
|
|
303
304
|
}
|
|
304
305
|
|
|
306
|
+
public shouldBeginWithRecordedHandlers(
|
|
307
|
+
_recorded: IGestureHandler[]
|
|
308
|
+
): boolean {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
|
|
305
312
|
public shouldAttachGestureToChildView(): boolean {
|
|
306
313
|
return false;
|
|
307
314
|
}
|
|
@@ -355,8 +362,9 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
355
362
|
protected onPointerCancel(_event: AdaptedEvent): void {
|
|
356
363
|
// No need to send a cancel touch event explicitly here. `cancel` will
|
|
357
364
|
// handle cancelling all tracked touches if the handler expects pointer data.
|
|
358
|
-
|
|
359
|
-
|
|
365
|
+
if (GestureHandlerOrchestrator.instance.isHandlerRecorded(this)) {
|
|
366
|
+
this.cancel();
|
|
367
|
+
}
|
|
360
368
|
}
|
|
361
369
|
protected onPointerOutOfBounds(event: AdaptedEvent): void {
|
|
362
370
|
this.tryToSendMoveEvent(true, event);
|
|
@@ -430,11 +438,13 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
430
438
|
onGestureHandlerReanimatedStateChange,
|
|
431
439
|
}: PropsRef = this.propsRef!.current;
|
|
432
440
|
|
|
441
|
+
const isStateChange = this.lastSentState !== newState;
|
|
442
|
+
|
|
433
443
|
const resultEvent: ResultEvent = !usesNativeOrVirtualDetector(
|
|
434
444
|
this.actionType
|
|
435
445
|
)
|
|
436
446
|
? this.transformEventData(newState, oldState)
|
|
437
|
-
:
|
|
447
|
+
: isStateChange
|
|
438
448
|
? this.transformStateChangeEvent(newState, oldState)
|
|
439
449
|
: this.transformUpdateEvent(newState);
|
|
440
450
|
|
|
@@ -442,7 +452,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
442
452
|
// Here the order is flipped to avoid workarounds such as making backup of the state and setting it to undefined first, then changing it back
|
|
443
453
|
// Flipping order with setting oldState to undefined solves issue, when events were being sent twice instead of once
|
|
444
454
|
// However, this may cause trouble in the future (but for now we don't know that)
|
|
445
|
-
if (
|
|
455
|
+
if (isStateChange) {
|
|
446
456
|
this.lastSentState = newState;
|
|
447
457
|
|
|
448
458
|
if (this.forReanimated) {
|
|
@@ -456,6 +466,16 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
456
466
|
return;
|
|
457
467
|
}
|
|
458
468
|
|
|
469
|
+
// Cover only V3 path due to different event shape
|
|
470
|
+
if (!isStateChange && usesNativeOrVirtualDetector(this.actionType)) {
|
|
471
|
+
const handlerData = (
|
|
472
|
+
resultEvent.nativeEvent as GestureUpdateEventWithHandlerData<unknown>
|
|
473
|
+
).handlerData;
|
|
474
|
+
if (this.shouldSuppressActiveUpdate(handlerData)) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
459
479
|
(resultEvent.nativeEvent as GestureHandlerNativeEvent).oldState = undefined;
|
|
460
480
|
|
|
461
481
|
if (this.forReanimated) {
|
|
@@ -467,6 +487,12 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
467
487
|
}
|
|
468
488
|
};
|
|
469
489
|
|
|
490
|
+
protected shouldSuppressActiveUpdate(
|
|
491
|
+
_handlerData: HandlerData<unknown>
|
|
492
|
+
): boolean {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
|
|
470
496
|
private transformEventData(
|
|
471
497
|
newState: State,
|
|
472
498
|
oldState: State
|
|
@@ -744,7 +770,6 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
744
770
|
const enabledChanged = this.maybeUpdateEnabled(config.enabled);
|
|
745
771
|
|
|
746
772
|
if (config.hitSlop !== undefined) {
|
|
747
|
-
this.hitSlop = config.hitSlop;
|
|
748
773
|
this.hitSlop = config.hitSlop;
|
|
749
774
|
this.validateHitSlops();
|
|
750
775
|
}
|
|
@@ -1072,6 +1097,11 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
1072
1097
|
this._name = value;
|
|
1073
1098
|
}
|
|
1074
1099
|
|
|
1100
|
+
/**
|
|
1101
|
+
* Whether the handler represents a continuous gesture rather than a discrete one.
|
|
1102
|
+
*/
|
|
1103
|
+
public readonly isContinuous: boolean = false;
|
|
1104
|
+
|
|
1075
1105
|
public getTrackedPointersID(): number[] {
|
|
1076
1106
|
return this.tracker.trackedPointersIDs;
|
|
1077
1107
|
}
|
|
@@ -8,6 +8,8 @@ import GestureHandler from './GestureHandler';
|
|
|
8
8
|
import type IGestureHandler from './IGestureHandler';
|
|
9
9
|
|
|
10
10
|
export default class HoverGestureHandler extends GestureHandler {
|
|
11
|
+
public override readonly isContinuous = true;
|
|
12
|
+
|
|
11
13
|
private stylusData: StylusData | undefined;
|
|
12
14
|
|
|
13
15
|
public constructor(
|
|
@@ -52,9 +54,4 @@ export default class HoverGestureHandler extends GestureHandler {
|
|
|
52
54
|
|
|
53
55
|
super.onPointerMove(event);
|
|
54
56
|
}
|
|
55
|
-
|
|
56
|
-
protected override onPointerCancel(event: AdaptedEvent): void {
|
|
57
|
-
super.onPointerCancel(event);
|
|
58
|
-
this.reset();
|
|
59
|
-
}
|
|
60
57
|
}
|
|
@@ -22,6 +22,7 @@ export default interface IGestureHandler {
|
|
|
22
22
|
readonly delegate: GestureHandlerDelegate<unknown, this>;
|
|
23
23
|
readonly tracker: PointerTracker;
|
|
24
24
|
readonly name: SingleGestureName;
|
|
25
|
+
readonly isContinuous: boolean;
|
|
25
26
|
state: State;
|
|
26
27
|
shouldCancelWhenOutside: boolean;
|
|
27
28
|
shouldResetProgress: boolean;
|
|
@@ -53,6 +54,7 @@ export default interface IGestureHandler {
|
|
|
53
54
|
shouldRequireToWaitForFailure: (handler: IGestureHandler) => boolean;
|
|
54
55
|
shouldRecognizeSimultaneously: (handler: IGestureHandler) => boolean;
|
|
55
56
|
shouldBeCancelledByOther: (handler: IGestureHandler) => boolean;
|
|
57
|
+
shouldBeginWithRecordedHandlers: (recorded: IGestureHandler[]) => boolean;
|
|
56
58
|
shouldAttachGestureToChildView: () => boolean;
|
|
57
59
|
|
|
58
60
|
sendEvent: (newState: State, oldState: State) => void;
|
|
@@ -5,6 +5,8 @@ import GestureHandler from './GestureHandler';
|
|
|
5
5
|
import type IGestureHandler from './IGestureHandler';
|
|
6
6
|
|
|
7
7
|
export default class ManualGestureHandler extends GestureHandler {
|
|
8
|
+
public override readonly isContinuous = true;
|
|
9
|
+
|
|
8
10
|
public constructor(
|
|
9
11
|
delegate: GestureHandlerDelegate<unknown, IGestureHandler>
|
|
10
12
|
) {
|