react-native-gesture-handler 3.0.0-beta.3 → 3.0.0-beta.5
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 +34 -8
- 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 +68 -7
- 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/Extensions.kt +21 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +160 -55
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerDetectorView.kt +75 -98
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +7 -10
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +64 -2
- 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 +82 -33
- package/apple/RNGestureHandlerButton.h +12 -2
- package/apple/RNGestureHandlerButton.mm +208 -38
- package/apple/RNGestureHandlerButtonComponentView.mm +102 -6
- package/apple/RNGestureHandlerDetector.mm +99 -75
- package/apple/RNGestureHandlerModule.mm +11 -14
- package/apple/RNGestureHandlerRegistry.h +14 -1
- package/apple/RNGestureHandlerRegistry.m +56 -0
- package/apple/RNRootViewGestureRecognizer.m +4 -15
- package/lib/module/RNGestureHandlerModule.web.js +5 -1
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/components/GestureButtons.js +23 -12
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.web.js +113 -31
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +2 -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/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js +38 -5
- package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.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/useDetectorUpdater.js +1 -2
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +11 -48
- 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/reanimatedWrapper.js +14 -2
- package/lib/module/handlers/gestures/reanimatedWrapper.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/mocks/module.js +3 -2
- package/lib/module/mocks/module.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.ts +28 -13
- package/lib/module/v3/NativeProxy.js +5 -3
- package/lib/module/v3/NativeProxy.js.map +1 -1
- package/lib/module/v3/NativeProxy.web.js +2 -2
- package/lib/module/v3/NativeProxy.web.js.map +1 -1
- package/lib/module/v3/components/GestureButtons.js +11 -6
- 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 +119 -32
- package/lib/module/v3/components/Touchable/Touchable.js.map +1 -1
- package/lib/module/v3/detectors/HostGestureDetector.web.js +180 -59
- package/lib/module/v3/detectors/HostGestureDetector.web.js.map +1 -1
- package/lib/module/v3/detectors/NativeDetector.js +3 -2
- package/lib/module/v3/detectors/NativeDetector.js.map +1 -1
- package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js +3 -4
- package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js.map +1 -1
- package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js +4 -2
- package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js.map +1 -1
- package/lib/module/v3/detectors/useGestureRelationsUpdater.js +23 -0
- package/lib/module/v3/detectors/useGestureRelationsUpdater.js.map +1 -0
- 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/detectors/utils.js +10 -8
- package/lib/module/v3/detectors/utils.js.map +1 -1
- 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 +4 -22
- package/lib/module/v3/hooks/useGesture.js.map +1 -1
- package/lib/module/v3/hooks/utils/configUtils.js +8 -6
- package/lib/module/v3/hooks/utils/configUtils.js.map +1 -1
- package/lib/module/v3/hooks/utils/eventHandlersUtils.js +31 -29
- package/lib/module/v3/hooks/utils/eventHandlersUtils.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/v3/hooks/utils/reanimatedUtils.js +8 -2
- package/lib/module/v3/hooks/utils/reanimatedUtils.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/NodeManager.js +44 -0
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +9 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts.map +1 -1
- package/lib/typescript/components/GestureButtons.d.ts +14 -6
- package/lib/typescript/components/GestureButtons.d.ts.map +1 -1
- package/lib/typescript/components/GestureHandlerButton.d.ts +62 -8
- package/lib/typescript/components/GestureHandlerButton.d.ts.map +1 -1
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +14 -3
- 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/PressableProps.d.ts +1 -1
- package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/stateDefinitions.d.ts.map +1 -1
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +16 -14
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts.map +1 -1
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts +2 -1
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts.map +1 -1
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts +30 -34
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts.map +1 -1
- package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +0 -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/reanimatedWrapper.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/mocks/module.d.ts +1 -1
- package/lib/typescript/mocks/module.d.ts.map +1 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +2 -2
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -1
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +19 -11
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -1
- package/lib/typescript/v3/NativeProxy.d.ts +1 -1
- package/lib/typescript/v3/NativeProxy.d.ts.map +1 -1
- package/lib/typescript/v3/NativeProxy.web.d.ts +1 -1
- package/lib/typescript/v3/NativeProxy.web.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureButtons.d.ts +1 -37
- package/lib/typescript/v3/components/GestureButtons.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureButtonsProps.d.ts +1 -1
- package/lib/typescript/v3/components/GestureButtonsProps.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 +48 -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/NativeDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/VirtualDetector/InterceptingGestureDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/VirtualDetector/VirtualDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/useGestureRelationsUpdater.d.ts +3 -0
- package/lib/typescript/v3/detectors/useGestureRelationsUpdater.d.ts.map +1 -0
- 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/detectors/utils.d.ts +3 -3
- package/lib/typescript/v3/detectors/utils.d.ts.map +1 -1
- 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/eventHandlersUtils.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/hooks/utils/reanimatedUtils.d.ts +1 -0
- package/lib/typescript/v3/hooks/utils/reanimatedUtils.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/NodeManager.d.ts +7 -0
- package/lib/typescript/web/tools/NodeManager.d.ts.map +1 -1
- package/lib/typescript/web/tools/PointerEventManager.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/RNGestureHandlerModule.web.ts +5 -1
- package/src/components/GestureButtons.tsx +33 -16
- package/src/components/GestureHandlerButton.tsx +70 -8
- package/src/components/GestureHandlerButton.web.tsx +184 -48
- package/src/components/Pressable/Pressable.tsx +3 -1
- package/src/components/Pressable/PressableProps.tsx +2 -1
- package/src/components/Pressable/stateDefinitions.ts +3 -0
- package/src/components/ReanimatedDrawerLayout.tsx +27 -23
- package/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx +51 -5
- package/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts +31 -39
- package/src/components/touchables/GenericTouchable.tsx +2 -5
- package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +1 -2
- package/src/handlers/gestures/GestureDetector/utils.ts +11 -53
- 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/reanimatedWrapper.ts +20 -2
- package/src/handlers/gestures/rotationGesture.ts +6 -0
- package/src/handlers/gestures/tapGesture.ts +6 -0
- package/src/mocks/module.tsx +4 -2
- package/src/specs/NativeRNGestureHandlerModule.ts +2 -4
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +28 -13
- package/src/v3/NativeProxy.ts +9 -7
- package/src/v3/NativeProxy.web.ts +2 -2
- package/src/v3/components/GestureButtons.tsx +18 -10
- package/src/v3/components/GestureButtonsProps.ts +1 -0
- package/src/v3/components/Pressable.tsx +2 -1
- package/src/v3/components/Touchable/Touchable.tsx +144 -50
- package/src/v3/components/Touchable/TouchableProps.ts +64 -2
- package/src/v3/detectors/HostGestureDetector.web.tsx +268 -108
- package/src/v3/detectors/NativeDetector.tsx +3 -2
- package/src/v3/detectors/VirtualDetector/InterceptingGestureDetector.tsx +3 -4
- package/src/v3/detectors/VirtualDetector/VirtualDetector.tsx +5 -2
- package/src/v3/detectors/useGestureRelationsUpdater.ts +30 -0
- package/src/v3/detectors/useNativeGestureRole.ts +8 -0
- package/src/v3/detectors/useNativeGestureRole.web.ts +42 -0
- package/src/v3/detectors/utils.ts +28 -12
- 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 +4 -18
- package/src/v3/hooks/utils/configUtils.ts +18 -8
- package/src/v3/hooks/utils/eventHandlersUtils.ts +43 -32
- package/src/v3/hooks/utils/index.ts +0 -1
- package/src/v3/hooks/utils/propsWhiteList.ts +1 -0
- package/src/v3/hooks/utils/reanimatedUtils.ts +10 -10
- 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/NodeManager.ts +57 -0
- package/src/web/tools/PointerEventManager.ts +12 -0
- package/lib/module/RNRenderer.js +0 -6
- package/lib/module/RNRenderer.js.map +0 -1
- package/lib/module/RNRenderer.web.js +0 -6
- package/lib/module/RNRenderer.web.js.map +0 -1
- package/lib/typescript/RNRenderer.d.ts +0 -2
- package/lib/typescript/RNRenderer.d.ts.map +0 -1
- package/lib/typescript/RNRenderer.web.d.ts +0 -4
- package/lib/typescript/RNRenderer.web.d.ts.map +0 -1
- package/src/RNRenderer.ts +0 -3
- package/src/RNRenderer.web.ts +0 -3
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ForwardedRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import React, {
|
|
3
|
+
useCallback,
|
|
4
|
+
useEffect,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useMemo,
|
|
7
|
+
} from 'react';
|
|
3
8
|
import type { LayoutChangeEvent } from 'react-native';
|
|
4
9
|
import { I18nManager, StyleSheet, View } from 'react-native';
|
|
5
10
|
import Animated, {
|
|
@@ -14,9 +19,16 @@ import Animated, {
|
|
|
14
19
|
withSpring,
|
|
15
20
|
} from 'react-native-reanimated';
|
|
16
21
|
|
|
22
|
+
import { Reanimated } from '../../handlers/gestures/reanimatedWrapper';
|
|
23
|
+
import { tagMessage } from '../../utils';
|
|
17
24
|
import { GestureDetector } from '../../v3/detectors';
|
|
18
25
|
import type { PanGestureActiveEvent } from '../../v3/hooks/gestures';
|
|
19
26
|
import { usePanGesture, useTapGesture } from '../../v3/hooks/gestures';
|
|
27
|
+
import {
|
|
28
|
+
maybeUnpackValue,
|
|
29
|
+
SHARED_VALUE_OFFSET,
|
|
30
|
+
} from '../../v3/hooks/utils/reanimatedUtils';
|
|
31
|
+
import type { SharedValueOrT } from '../../v3/types';
|
|
20
32
|
import type {
|
|
21
33
|
SwipeableMethods,
|
|
22
34
|
SwipeableProps,
|
|
@@ -44,8 +56,8 @@ const Swipeable = (props: SwipeableProps) => {
|
|
|
44
56
|
testID,
|
|
45
57
|
children,
|
|
46
58
|
enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
dragOffsetFromLeft = DEFAULT_DRAG_OFFSET,
|
|
60
|
+
dragOffsetFromRight = -DEFAULT_DRAG_OFFSET,
|
|
49
61
|
friction = DEFAULT_FRICTION,
|
|
50
62
|
overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
|
|
51
63
|
onSwipeableOpenStartDrag,
|
|
@@ -63,6 +75,40 @@ const Swipeable = (props: SwipeableProps) => {
|
|
|
63
75
|
...remainingProps
|
|
64
76
|
} = props;
|
|
65
77
|
|
|
78
|
+
if (__DEV__) {
|
|
79
|
+
const checkValue = (value: SharedValueOrT<number>) => {
|
|
80
|
+
'worklet';
|
|
81
|
+
if (maybeUnpackValue<number>(value) > 0) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
tagMessage('dragOffsetFromRight should be non-positive.')
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
checkValue(dragOffsetFromRight);
|
|
89
|
+
|
|
90
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!Reanimated?.isSharedValue<number>(dragOffsetFromRight)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const listenerId = Math.random() + SHARED_VALUE_OFFSET;
|
|
97
|
+
|
|
98
|
+
Reanimated?.runOnUI(() => {
|
|
99
|
+
'worklet';
|
|
100
|
+
dragOffsetFromRight.addListener(listenerId, checkValue);
|
|
101
|
+
})();
|
|
102
|
+
|
|
103
|
+
return () => {
|
|
104
|
+
Reanimated?.runOnUI(() => {
|
|
105
|
+
'worklet';
|
|
106
|
+
dragOffsetFromRight.removeListener(listenerId);
|
|
107
|
+
})();
|
|
108
|
+
};
|
|
109
|
+
}, [dragOffsetFromRight, checkValue]);
|
|
110
|
+
}
|
|
111
|
+
|
|
66
112
|
const shouldEnableTap = useSharedValue<boolean>(false);
|
|
67
113
|
const rowState = useSharedValue<number>(0);
|
|
68
114
|
|
|
@@ -468,9 +514,9 @@ const Swipeable = (props: SwipeableProps) => {
|
|
|
468
514
|
});
|
|
469
515
|
|
|
470
516
|
const panGesture = usePanGesture({
|
|
471
|
-
enabled: enabled
|
|
517
|
+
enabled: enabled ?? true,
|
|
472
518
|
enableTrackpadTwoFingerGesture: enableTrackpadTwoFingerGesture,
|
|
473
|
-
activeOffsetX: [
|
|
519
|
+
activeOffsetX: [dragOffsetFromRight, dragOffsetFromLeft],
|
|
474
520
|
simultaneousWith,
|
|
475
521
|
requireToFail,
|
|
476
522
|
block,
|
|
@@ -3,17 +3,14 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
3
3
|
import type { SharedValue } from 'react-native-reanimated';
|
|
4
4
|
|
|
5
5
|
import type { HitSlop } from '../../handlers/gestureHandlerCommon';
|
|
6
|
-
import type { AnyGesture } from '../../v3/types';
|
|
6
|
+
import type { AnyGesture, WithSharedValue } from '../../v3/types';
|
|
7
7
|
|
|
8
8
|
export enum SwipeDirection {
|
|
9
9
|
LEFT = 'left',
|
|
10
10
|
RIGHT = 'right',
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
13
|
+
export type SwipeableProps = {
|
|
17
14
|
ref?: React.Ref<SwipeableMethods>;
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -23,27 +20,6 @@ export interface SwipeableProps {
|
|
|
23
20
|
|
|
24
21
|
children?: React.ReactNode;
|
|
25
22
|
|
|
26
|
-
/**
|
|
27
|
-
* Indicates whether `ReanimatedSwipeable` should be analyzing stream of touch events or not.
|
|
28
|
-
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean
|
|
29
|
-
*/
|
|
30
|
-
enabled?: boolean;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.
|
|
34
|
-
* When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.
|
|
35
|
-
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings
|
|
36
|
-
*/
|
|
37
|
-
hitSlop?: HitSlop;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Enables two-finger gestures on supported devices, for example iPads with
|
|
41
|
-
* trackpads. If not enabled the gesture will require click + drag, with
|
|
42
|
-
* `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger
|
|
43
|
-
* the gesture.
|
|
44
|
-
*/
|
|
45
|
-
enableTrackpadTwoFingerGesture?: boolean;
|
|
46
|
-
|
|
47
23
|
/**
|
|
48
24
|
* Specifies how much the visual interaction will be delayed compared to the
|
|
49
25
|
* gesture distance. e.g. value of 1 will indicate that the swipeable panel
|
|
@@ -66,18 +42,6 @@ export interface SwipeableProps {
|
|
|
66
42
|
*/
|
|
67
43
|
rightThreshold?: number;
|
|
68
44
|
|
|
69
|
-
/**
|
|
70
|
-
* Distance that the panel must be dragged from the left edge to be considered
|
|
71
|
-
* a swipe. The default value is 10.
|
|
72
|
-
*/
|
|
73
|
-
dragOffsetFromLeftEdge?: number;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Distance that the panel must be dragged from the right edge to be considered
|
|
77
|
-
* a swipe. The default value is 10.
|
|
78
|
-
*/
|
|
79
|
-
dragOffsetFromRightEdge?: number;
|
|
80
|
-
|
|
81
45
|
/**
|
|
82
46
|
* Value indicating if the swipeable panel can be pulled further than the left
|
|
83
47
|
* actions panel's width. It is set to true by default as long as the left
|
|
@@ -204,7 +168,35 @@ export interface SwipeableProps {
|
|
|
204
168
|
* used with the swipeable's gesture handler.
|
|
205
169
|
*/
|
|
206
170
|
block?: AnyGesture | AnyGesture[];
|
|
207
|
-
}
|
|
171
|
+
} & WithSharedValue<{
|
|
172
|
+
/**
|
|
173
|
+
* Indicates whether `ReanimatedSwipeable` should be analyzing stream of touch events or not.
|
|
174
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean
|
|
175
|
+
*/
|
|
176
|
+
enabled?: boolean | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.
|
|
179
|
+
* When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.
|
|
180
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings
|
|
181
|
+
*/
|
|
182
|
+
hitSlop?: HitSlop | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Enables two-finger gestures on supported devices, for example iPads with
|
|
185
|
+
* trackpads. If not enabled the gesture will require click + drag, with
|
|
186
|
+
* `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger
|
|
187
|
+
* the gesture.
|
|
188
|
+
*/
|
|
189
|
+
enableTrackpadTwoFingerGesture?: boolean | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* The horizontal offset from the starting point required to trigger a right-swipe gesture. Defaults to 10.
|
|
192
|
+
*/
|
|
193
|
+
dragOffsetFromLeft?: number;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The horizontal offset from the starting point required to trigger a left-swipe gesture. Defaults to -10.
|
|
197
|
+
*/
|
|
198
|
+
dragOffsetFromRight?: number;
|
|
199
|
+
}>;
|
|
208
200
|
|
|
209
201
|
export interface SwipeableMethods {
|
|
210
202
|
close: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import { Animated
|
|
3
|
+
import { Animated } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
GestureEvent,
|
|
@@ -174,10 +174,7 @@ export default class GenericTouchable extends Component<
|
|
|
174
174
|
// Need to handle case with external cancellation (e.g. by ScrollView)
|
|
175
175
|
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
|
176
176
|
} else if (
|
|
177
|
-
|
|
178
|
-
// And Android "Active" state is achieving on first move of a finger, not on press in.
|
|
179
|
-
// On iOS event on "Began" is not delivered.
|
|
180
|
-
state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) &&
|
|
177
|
+
state === State.BEGAN &&
|
|
181
178
|
this.STATE === TOUCHABLE_STATE.UNDETERMINED
|
|
182
179
|
) {
|
|
183
180
|
// Moving inside requires
|
|
@@ -10,7 +10,7 @@ import { dropHandlers } from './dropHandlers';
|
|
|
10
10
|
import { needsToReattach } from './needsToReattach';
|
|
11
11
|
import type { AttachedGestureState, GestureDetectorState } from './types';
|
|
12
12
|
import { updateHandlers } from './updateHandlers';
|
|
13
|
-
import { useForceRender
|
|
13
|
+
import { useForceRender } from './utils';
|
|
14
14
|
|
|
15
15
|
// Returns a function that's responsible for updating the attached gestures
|
|
16
16
|
// If the view has changed, it will reattach the handlers to the new view
|
|
@@ -34,7 +34,6 @@ export function useDetectorUpdater(
|
|
|
34
34
|
didUnderlyingViewChange ||
|
|
35
35
|
needsToReattach(preparedGesture, gesturesToAttach)
|
|
36
36
|
) {
|
|
37
|
-
validateDetectorChildren(state.viewRef);
|
|
38
37
|
dropHandlers(preparedGesture);
|
|
39
38
|
attachHandlers({
|
|
40
39
|
preparedGesture,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useCallback, useRef, useState } from 'react';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
3
2
|
|
|
4
|
-
import { RNRenderer } from '../../../RNRenderer';
|
|
5
3
|
import { isTestEnv, tagMessage } from '../../../utils';
|
|
6
4
|
import type {
|
|
7
5
|
GestureHandlerNativeEvent,
|
|
@@ -36,6 +34,16 @@ export const ALLOWED_PROPS = [
|
|
|
36
34
|
...nativeViewGestureHandlerProps,
|
|
37
35
|
];
|
|
38
36
|
|
|
37
|
+
// In some environments (e.g. `Next.js`) Reanimated Babel plugin might not be used.
|
|
38
|
+
// In that case we would wrongly suggest to add `runOnJS` to gesture configuration, even if the user doesn't use worklets at all.
|
|
39
|
+
// To prevent this, we check whether the plugin is enabled by defining a worklet and checking if the `__workletHash` property is available.
|
|
40
|
+
function emptyWorklet() {
|
|
41
|
+
'worklet';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// @ts-expect-error if `emptyWorklet` is a worklet, `__workletHash` will be available, if not then the check will return false.
|
|
45
|
+
const wasBabelPluginEnabled = emptyWorklet.__workletHash !== undefined;
|
|
46
|
+
|
|
39
47
|
function convertToHandlerTag(ref: GestureRef): number {
|
|
40
48
|
if (typeof ref === 'number') {
|
|
41
49
|
return ref;
|
|
@@ -105,7 +113,7 @@ export function checkGestureCallbacksForWorklets(gesture: GestureType) {
|
|
|
105
113
|
const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets;
|
|
106
114
|
// If none of the callbacks are worklets and the gesture is not explicitly marked with
|
|
107
115
|
// `.runOnJS(true)` show a warning
|
|
108
|
-
if (areAllNotWorklets && !isTestEnv()) {
|
|
116
|
+
if (areAllNotWorklets && wasBabelPluginEnabled && !isTestEnv()) {
|
|
109
117
|
console.warn(
|
|
110
118
|
tagMessage(
|
|
111
119
|
`None of the callbacks in the gesture are worklets. If you wish to run them on the JS thread use '.runOnJS(true)' modifier on the gesture to make this explicit. Otherwise, mark the callbacks as 'worklet' to run them on the UI thread.`
|
|
@@ -114,56 +122,6 @@ export function checkGestureCallbacksForWorklets(gesture: GestureType) {
|
|
|
114
122
|
}
|
|
115
123
|
}
|
|
116
124
|
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
-
export function validateDetectorChildren(ref: any) {
|
|
119
|
-
// Finds the first native view under the Wrap component and traverses the fiber tree upwards
|
|
120
|
-
// to check whether there is more than one native view as a pseudo-direct child of GestureDetector
|
|
121
|
-
// i.e. this is not ok:
|
|
122
|
-
// Wrap
|
|
123
|
-
// |
|
|
124
|
-
// / \
|
|
125
|
-
// / \
|
|
126
|
-
// / \
|
|
127
|
-
// / \
|
|
128
|
-
// NativeView NativeView
|
|
129
|
-
//
|
|
130
|
-
// but this is fine:
|
|
131
|
-
// Wrap
|
|
132
|
-
// |
|
|
133
|
-
// NativeView
|
|
134
|
-
// |
|
|
135
|
-
// / \
|
|
136
|
-
// / \
|
|
137
|
-
// / \
|
|
138
|
-
// / \
|
|
139
|
-
// NativeView NativeView
|
|
140
|
-
if (__DEV__ && Platform.OS !== 'web') {
|
|
141
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
142
|
-
const wrapType =
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
144
|
-
ref._reactInternals.elementType;
|
|
145
|
-
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
147
|
-
let instance =
|
|
148
|
-
RNRenderer.findHostInstance_DEPRECATED(
|
|
149
|
-
ref
|
|
150
|
-
)._internalFiberInstanceHandleDEV;
|
|
151
|
-
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
153
|
-
while (instance && instance.elementType !== wrapType) {
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
155
|
-
if (instance.sibling) {
|
|
156
|
-
throw new Error(
|
|
157
|
-
'GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.'
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
162
|
-
instance = instance.return;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
125
|
export function useForceRender() {
|
|
168
126
|
const [renderState, setRenderState] = useState(false);
|
|
169
127
|
const forceRender = useCallback(() => {
|
|
@@ -3,6 +3,9 @@ import type { FlingGestureHandlerEventPayload } from '../GestureHandlerEventPayl
|
|
|
3
3
|
import type { BaseGestureConfig } from './gesture';
|
|
4
4
|
import { BaseGesture } from './gesture';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated `FlingGesture` is deprecated and will be removed in the future. Please use `useFlingGesture` instead.
|
|
8
|
+
*/
|
|
6
9
|
export class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {
|
|
7
10
|
public override config: BaseGestureConfig & FlingGestureConfig = {};
|
|
8
11
|
|
|
@@ -34,4 +37,7 @@ export class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {
|
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated `FlingGestureType` is deprecated and will be removed in the future. Please use `FlingGesture` instead.
|
|
42
|
+
*/
|
|
37
43
|
export type FlingGestureType = InstanceType<typeof FlingGesture>;
|
|
@@ -5,7 +5,7 @@ import type { BaseGestureConfig } from './gesture';
|
|
|
5
5
|
import { ContinousBaseGesture } from './gesture';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @deprecated
|
|
8
|
+
* @deprecated `ForceTouchGestureChangeEventPayload` is deprecated and will be removed in the future.
|
|
9
9
|
*/
|
|
10
10
|
export type ForceTouchGestureChangeEventPayload = {
|
|
11
11
|
forceChange: number;
|
|
@@ -31,7 +31,7 @@ function changeEventCalculator(
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @deprecated
|
|
34
|
+
* @deprecated `ForceTouchGesture` is deprecated and will be removed in the future.
|
|
35
35
|
*/
|
|
36
36
|
export class ForceTouchGesture extends ContinousBaseGesture<
|
|
37
37
|
ForceTouchGestureHandlerEventPayload,
|
|
@@ -91,6 +91,6 @@ export class ForceTouchGesture extends ContinousBaseGesture<
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* @deprecated
|
|
94
|
+
* @deprecated `ForceTouchGestureType` is deprecated and will be removed in the future.
|
|
95
95
|
*/
|
|
96
96
|
export type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;
|
|
@@ -22,6 +22,9 @@ import type {
|
|
|
22
22
|
import { getNextHandlerTag } from '../getNextHandlerTag';
|
|
23
23
|
import type { GestureStateManagerType } from './gestureStateManager';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated `GestureType` is deprecated and will be removed in the future. Please use `SingleGesture` instead.
|
|
27
|
+
*/
|
|
25
28
|
export type GestureType =
|
|
26
29
|
| BaseGesture<Record<string, unknown>>
|
|
27
30
|
| BaseGesture<Record<string, never>>
|
|
@@ -35,6 +38,9 @@ export type GestureType =
|
|
|
35
38
|
| BaseGesture<NativeViewGestureHandlerPayload>
|
|
36
39
|
| BaseGesture<HoverGestureHandlerEventPayload>;
|
|
37
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated `GestureRef` is deprecated and will be removed in the future.
|
|
43
|
+
*/
|
|
38
44
|
export type GestureRef =
|
|
39
45
|
| number
|
|
40
46
|
| GestureType
|
|
@@ -12,6 +12,9 @@ function extendRelation(
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated `ComposedGesture` is deprecated and will be removed in the future. Please use `useCompetingGestures` instead.
|
|
17
|
+
*/
|
|
15
18
|
export class ComposedGesture extends Gesture {
|
|
16
19
|
protected gestures: Gesture[] = [];
|
|
17
20
|
protected simultaneousGestures: GestureType[] = [];
|
|
@@ -70,6 +73,9 @@ export class ComposedGesture extends Gesture {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated `SimultaneousGesture` is deprecated and will be removed in the future. Please use `useSimultaneousGestures` instead.
|
|
78
|
+
*/
|
|
73
79
|
export class SimultaneousGesture extends ComposedGesture {
|
|
74
80
|
override prepare() {
|
|
75
81
|
// This piece of magic works something like this:
|
|
@@ -96,6 +102,9 @@ export class SimultaneousGesture extends ComposedGesture {
|
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated `ExclusiveGesture` is deprecated and will be removed in the future. Please use `useExclusiveGestures` instead.
|
|
107
|
+
*/
|
|
99
108
|
export class ExclusiveGesture extends ComposedGesture {
|
|
100
109
|
override prepare() {
|
|
101
110
|
// Transforms the array of gestures into array of grouped raw (not composed) gestures
|
|
@@ -119,7 +128,19 @@ export class ExclusiveGesture extends ComposedGesture {
|
|
|
119
128
|
}
|
|
120
129
|
}
|
|
121
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @deprecated `ComposedGestureType` is deprecated and will be removed in the future. Please use `ComposedGesture` instead.
|
|
133
|
+
*/
|
|
122
134
|
export type ComposedGestureType = InstanceType<typeof ComposedGesture>;
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated `RaceGestureType` is deprecated and will be removed in the future. Please use `ComposedGesture` instead.
|
|
137
|
+
*/
|
|
123
138
|
export type RaceGestureType = ComposedGestureType;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated `SimultaneousGestureType` is deprecated and will be removed in the future. Please use `ComposedGesture` instead.
|
|
141
|
+
*/
|
|
124
142
|
export type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated `ExclusiveGestureType` is deprecated and will be removed in the future. Please use `ComposedGesture` instead.
|
|
145
|
+
*/
|
|
125
146
|
export type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;
|
|
@@ -16,6 +16,8 @@ import { RotationGesture } from './rotationGesture';
|
|
|
16
16
|
import { TapGesture } from './tapGesture';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
+
* @deprecated `Gesture` builder API is deprecated and will be removed in a future version of Gesture Handler. Please migrate to the new, hook-based API.
|
|
20
|
+
*
|
|
19
21
|
* `Gesture` is the object that allows you to create and compose gestures.
|
|
20
22
|
*
|
|
21
23
|
* ### Remarks
|
|
@@ -25,6 +27,8 @@ import { TapGesture } from './tapGesture';
|
|
|
25
27
|
*/
|
|
26
28
|
export const GestureObjects = {
|
|
27
29
|
/**
|
|
30
|
+
* @deprecated `Gesture.Tap()` is deprecated and will be removed in the future. Please use `useTapGesture` instead.
|
|
31
|
+
*
|
|
28
32
|
* A discrete gesture that recognizes one or many taps.
|
|
29
33
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture
|
|
30
34
|
*/
|
|
@@ -33,6 +37,8 @@ export const GestureObjects = {
|
|
|
33
37
|
},
|
|
34
38
|
|
|
35
39
|
/**
|
|
40
|
+
* @deprecated `Gesture.Pan()` is deprecated and will be removed in the future. Please use `usePanGesture` instead.
|
|
41
|
+
*
|
|
36
42
|
* A continuous gesture that can recognize a panning (dragging) gesture and track its movement.
|
|
37
43
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture
|
|
38
44
|
*/
|
|
@@ -41,6 +47,8 @@ export const GestureObjects = {
|
|
|
41
47
|
},
|
|
42
48
|
|
|
43
49
|
/**
|
|
50
|
+
* @deprecated `Gesture.Pinch()` is deprecated and will be removed in the future. Please use `usePinchGesture` instead.
|
|
51
|
+
*
|
|
44
52
|
* A continuous gesture that recognizes pinch gesture. It allows for tracking the distance between two fingers and use that information to scale or zoom your content.
|
|
45
53
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pinch-gesture
|
|
46
54
|
*/
|
|
@@ -49,6 +57,8 @@ export const GestureObjects = {
|
|
|
49
57
|
},
|
|
50
58
|
|
|
51
59
|
/**
|
|
60
|
+
* @deprecated `Gesture.Rotation()` is deprecated and will be removed in the future. Please use `useRotationGesture` instead.
|
|
61
|
+
*
|
|
52
62
|
* A continuous gesture that can recognize rotation and track its movement.
|
|
53
63
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/rotation-gesture
|
|
54
64
|
*/
|
|
@@ -57,6 +67,8 @@ export const GestureObjects = {
|
|
|
57
67
|
},
|
|
58
68
|
|
|
59
69
|
/**
|
|
70
|
+
* @deprecated `Gesture.Fling()` is deprecated and will be removed in the future. Please use `useFlingGesture` instead.
|
|
71
|
+
*
|
|
60
72
|
* A discrete gesture that activates when the movement is sufficiently fast.
|
|
61
73
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture
|
|
62
74
|
*/
|
|
@@ -65,6 +77,8 @@ export const GestureObjects = {
|
|
|
65
77
|
},
|
|
66
78
|
|
|
67
79
|
/**
|
|
80
|
+
* @deprecated `Gesture.LongPress()` is deprecated and will be removed in the future. Please use `useLongPressGesture` instead.
|
|
81
|
+
*
|
|
68
82
|
* A discrete gesture that activates when the corresponding view is pressed for a sufficiently long time.
|
|
69
83
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture
|
|
70
84
|
*/
|
|
@@ -73,7 +87,7 @@ export const GestureObjects = {
|
|
|
73
87
|
},
|
|
74
88
|
|
|
75
89
|
/**
|
|
76
|
-
* @deprecated ForceTouch
|
|
90
|
+
* @deprecated `Gesture.ForceTouch()` is deprecated and will be removed in the future.
|
|
77
91
|
*
|
|
78
92
|
* #### iOS only
|
|
79
93
|
* A continuous gesture that recognizes force of a touch. It allows for tracking pressure of touch on some iOS devices.
|
|
@@ -84,6 +98,8 @@ export const GestureObjects = {
|
|
|
84
98
|
},
|
|
85
99
|
|
|
86
100
|
/**
|
|
101
|
+
* @deprecated `Gesture.Native()` is deprecated and will be removed in the future. Please use `useNativeGesture` instead.
|
|
102
|
+
*
|
|
87
103
|
* A gesture that allows other touch handling components to participate in RNGH's gesture system.
|
|
88
104
|
* When used, the other component should be the direct child of a `GestureDetector`.
|
|
89
105
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/native-gesture
|
|
@@ -93,6 +109,8 @@ export const GestureObjects = {
|
|
|
93
109
|
},
|
|
94
110
|
|
|
95
111
|
/**
|
|
112
|
+
* @deprecated `Gesture.Manual()` is deprecated and will be removed in the future. Please use `useManualGesture` instead.
|
|
113
|
+
*
|
|
96
114
|
* A plain gesture that has no specific activation criteria nor event data set.
|
|
97
115
|
* Its state has to be controlled manually using a state manager.
|
|
98
116
|
* It will not fail when all the pointers are lifted from the screen.
|
|
@@ -103,6 +121,8 @@ export const GestureObjects = {
|
|
|
103
121
|
},
|
|
104
122
|
|
|
105
123
|
/**
|
|
124
|
+
* @deprecated `Gesture.Hover()` is deprecated and will be removed in the future. Please use `useHoverGesture` instead.
|
|
125
|
+
*
|
|
106
126
|
* A continuous gesture that can recognize hovering above the view it's attached to.
|
|
107
127
|
* The hover effect may be activated by moving a mouse or a stylus over the view.
|
|
108
128
|
*
|
|
@@ -113,6 +133,8 @@ export const GestureObjects = {
|
|
|
113
133
|
},
|
|
114
134
|
|
|
115
135
|
/**
|
|
136
|
+
* @deprecated `Gesture.Race()` is deprecated and will be removed in the future. Please use `useCompetingGestures` instead.
|
|
137
|
+
*
|
|
116
138
|
* Builds a composed gesture consisting of gestures provided as parameters.
|
|
117
139
|
* The first one that becomes active cancels the rest of gestures.
|
|
118
140
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#race
|
|
@@ -122,6 +144,8 @@ export const GestureObjects = {
|
|
|
122
144
|
},
|
|
123
145
|
|
|
124
146
|
/**
|
|
147
|
+
* @deprecated `Gesture.Simultaneous()` is deprecated and will be removed in the future. Please use `useSimultaneousGestures` instead.
|
|
148
|
+
*
|
|
125
149
|
* Builds a composed gesture that allows all base gestures to run simultaneously.
|
|
126
150
|
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneous
|
|
127
151
|
*/
|
|
@@ -130,6 +154,8 @@ export const GestureObjects = {
|
|
|
130
154
|
},
|
|
131
155
|
|
|
132
156
|
/**
|
|
157
|
+
* @deprecated `Gesture.Exclusive()` is deprecated and will be removed in the future. Please use `useExclusiveGestures` instead.
|
|
158
|
+
*
|
|
133
159
|
* Builds a composed gesture where only one of the provided gestures can become active.
|
|
134
160
|
* Priority is decided through the order of gestures: the first one has higher priority
|
|
135
161
|
* than the second one, second one has higher priority than the third one, and so on.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { State } from '../../State';
|
|
2
2
|
import { tagMessage } from '../../utils';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated `LegacyGestureStateManagerType` is deprecated and will be removed in the future. Please use the new, hook-based API instead.
|
|
6
|
+
*/
|
|
4
7
|
export interface GestureStateManagerType {
|
|
5
8
|
begin: () => void;
|
|
6
9
|
activate: () => void;
|
|
@@ -49,6 +52,9 @@ function create(handlerTag: number): GestureStateManagerType {
|
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated `LegacyGestureStateManager` is deprecated and will be removed in the future. Please use the new, hook-based API instead.
|
|
57
|
+
*/
|
|
52
58
|
export const GestureStateManager = {
|
|
53
59
|
create,
|
|
54
60
|
};
|
|
@@ -41,6 +41,9 @@ function changeEventCalculator(
|
|
|
41
41
|
return { ...current, ...changePayload };
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated `HoverGesture` is deprecated and will be removed in the future. Please use `useHoverGesture` instead.
|
|
46
|
+
*/
|
|
44
47
|
export class HoverGesture extends ContinousBaseGesture<
|
|
45
48
|
HoverGestureHandlerEventPayload,
|
|
46
49
|
HoverGestureChangeEventPayload
|
|
@@ -75,4 +78,7 @@ export class HoverGesture extends ContinousBaseGesture<
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated `HoverGestureType` is deprecated and will be removed in the future. Please use `HoverGesture` instead.
|
|
83
|
+
*/
|
|
78
84
|
export type HoverGestureType = InstanceType<typeof HoverGesture>;
|
|
@@ -3,6 +3,9 @@ import type { LongPressGestureConfig } from '../LongPressGestureHandler';
|
|
|
3
3
|
import type { BaseGestureConfig } from './gesture';
|
|
4
4
|
import { BaseGesture } from './gesture';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated `LongPressGesture` is deprecated and will be removed in the future. Please use `useLongPressGesture` instead.
|
|
8
|
+
*/
|
|
6
9
|
export class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {
|
|
7
10
|
public override config: BaseGestureConfig & LongPressGestureConfig = {};
|
|
8
11
|
|
|
@@ -43,4 +46,7 @@ export class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPa
|
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated `LongPressGestureType` is deprecated and will be removed in the future. Please use `LongPressGesture` instead.
|
|
51
|
+
*/
|
|
46
52
|
export type LongPressGestureType = InstanceType<typeof LongPressGesture>;
|
|
@@ -9,6 +9,9 @@ function changeEventCalculator(
|
|
|
9
9
|
return current;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated `ManualGesture` is deprecated and will be removed in the future. Please use `useManualGesture` instead.
|
|
14
|
+
*/
|
|
12
15
|
export class ManualGesture extends ContinousBaseGesture<
|
|
13
16
|
Record<string, never>,
|
|
14
17
|
Record<string, never>
|
|
@@ -28,4 +31,7 @@ export class ManualGesture extends ContinousBaseGesture<
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated `ManualGestureType` is deprecated and will be removed in the future. Please use `ManualGesture` instead.
|
|
36
|
+
*/
|
|
31
37
|
export type ManualGestureType = InstanceType<typeof ManualGesture>;
|
|
@@ -3,6 +3,9 @@ import type { NativeViewGestureConfig } from '../NativeViewGestureHandler';
|
|
|
3
3
|
import type { BaseGestureConfig } from './gesture';
|
|
4
4
|
import { BaseGesture } from './gesture';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated `NativeGesture` is deprecated and will be removed in the future. Please use `useNativeGesture` instead.
|
|
8
|
+
*/
|
|
6
9
|
export class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {
|
|
7
10
|
public override config: BaseGestureConfig & NativeViewGestureConfig = {};
|
|
8
11
|
|
|
@@ -31,4 +34,7 @@ export class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload>
|
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated `NativeGestureType` is deprecated and will be removed in the future. Please use `NativeGesture` instead.
|
|
39
|
+
*/
|
|
34
40
|
export type NativeGestureType = InstanceType<typeof NativeGesture>;
|