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
|
@@ -4,6 +4,9 @@ import type { PanGestureConfig } from '../PanGestureHandler';
|
|
|
4
4
|
import type { BaseGestureConfig } from './gesture';
|
|
5
5
|
import { ContinousBaseGesture } from './gesture';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated `PanGestureChangeEventPayload` is deprecated and will be removed in the future. Please use `PanGestureActiveEvent` instead.
|
|
9
|
+
*/
|
|
7
10
|
export type PanGestureChangeEventPayload = {
|
|
8
11
|
changeX: number;
|
|
9
12
|
changeY: number;
|
|
@@ -30,6 +33,9 @@ function changeEventCalculator(
|
|
|
30
33
|
return { ...current, ...changePayload };
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated `PanGesture` is deprecated and will be removed in the future. Please use `usePanGesture` instead.
|
|
38
|
+
*/
|
|
33
39
|
export class PanGesture extends ContinousBaseGesture<
|
|
34
40
|
PanGestureHandlerEventPayload,
|
|
35
41
|
PanGestureChangeEventPayload
|
|
@@ -219,4 +225,7 @@ export class PanGesture extends ContinousBaseGesture<
|
|
|
219
225
|
}
|
|
220
226
|
}
|
|
221
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated `PanGestureType` is deprecated and will be removed in the future. Please use `PanGesture` instead.
|
|
230
|
+
*/
|
|
222
231
|
export type PanGestureType = InstanceType<typeof PanGesture>;
|
|
@@ -2,6 +2,9 @@ import type { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
|
2
2
|
import type { PinchGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
|
|
3
3
|
import { ContinousBaseGesture } from './gesture';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated `PinchGestureChangeEventPayload` is deprecated and will be removed in the future. Please use `PinchGestureActiveEvent` instead.
|
|
7
|
+
*/
|
|
5
8
|
export type PinchGestureChangeEventPayload = {
|
|
6
9
|
scaleChange: number;
|
|
7
10
|
};
|
|
@@ -25,6 +28,9 @@ function changeEventCalculator(
|
|
|
25
28
|
return { ...current, ...changePayload };
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated `PinchGesture` is deprecated and will be removed in the future. Please use `usePinchGesture` instead.
|
|
33
|
+
*/
|
|
28
34
|
export class PinchGesture extends ContinousBaseGesture<
|
|
29
35
|
PinchGestureHandlerEventPayload,
|
|
30
36
|
PinchGestureChangeEventPayload
|
|
@@ -48,4 +54,7 @@ export class PinchGesture extends ContinousBaseGesture<
|
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated `PinchGestureType` is deprecated and will be removed in the future. Please use `PinchGesture` instead.
|
|
59
|
+
*/
|
|
51
60
|
export type PinchGestureType = InstanceType<typeof PinchGesture>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentClass } from 'react';
|
|
2
2
|
|
|
3
|
+
import { ghQueueMicrotask } from '../../ghQueueMicrotask';
|
|
3
4
|
import { tagMessage } from '../../utils';
|
|
4
5
|
import { NativeProxy } from '../../v3/NativeProxy';
|
|
5
6
|
import type {
|
|
@@ -82,7 +83,25 @@ let Reanimated:
|
|
|
82
83
|
|
|
83
84
|
try {
|
|
84
85
|
Reanimated = require('react-native-reanimated');
|
|
85
|
-
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
|
|
87
|
+
const Worklets = require('react-native-worklets');
|
|
88
|
+
|
|
89
|
+
// Make sure worklets are initialized before attempting to install UI runtime bindings
|
|
90
|
+
Worklets?.scheduleOnUI(() => {
|
|
91
|
+
'worklet';
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
ghQueueMicrotask(() => {
|
|
95
|
+
const decorated = NativeProxy.installUIRuntimeBindings();
|
|
96
|
+
|
|
97
|
+
if (!decorated) {
|
|
98
|
+
console.warn(
|
|
99
|
+
tagMessage(
|
|
100
|
+
'Failed to install UI runtime bindings. Please report this at https://github.com/software-mansion/react-native-gesture-handler/issues.'
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
86
105
|
} catch (e) {
|
|
87
106
|
// When 'react-native-reanimated' is not available we want to quietly continue
|
|
88
107
|
// @ts-ignore TS demands the variable to be initialized
|
|
@@ -93,7 +112,6 @@ if (!Reanimated?.useSharedValue) {
|
|
|
93
112
|
// @ts-ignore Make sure the loaded module is actually Reanimated, if it's not
|
|
94
113
|
// reset the module to undefined so we can fallback to the default implementation
|
|
95
114
|
Reanimated = undefined;
|
|
96
|
-
NativeProxy.setReanimatedAvailable(false);
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
if (Reanimated !== undefined && !Reanimated.setGestureState) {
|
|
@@ -25,6 +25,9 @@ function changeEventCalculator(
|
|
|
25
25
|
return { ...current, ...changePayload };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated `RotationGesture` is deprecated and will be removed in the future. Please use `useRotationGesture` instead.
|
|
30
|
+
*/
|
|
28
31
|
export class RotationGesture extends ContinousBaseGesture<
|
|
29
32
|
RotationGestureHandlerEventPayload,
|
|
30
33
|
RotationGestureChangeEventPayload
|
|
@@ -48,4 +51,7 @@ export class RotationGesture extends ContinousBaseGesture<
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated `RotationGestureType` is deprecated and will be removed in the future. Please use `RotationGesture` instead.
|
|
56
|
+
*/
|
|
51
57
|
export type RotationGestureType = InstanceType<typeof RotationGesture>;
|
|
@@ -3,6 +3,9 @@ import type { TapGestureConfig } from '../TapGestureHandler';
|
|
|
3
3
|
import type { BaseGestureConfig } from './gesture';
|
|
4
4
|
import { BaseGesture } from './gesture';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated `TapGesture` is deprecated and will be removed in the future. Please use `useTapGesture` instead.
|
|
8
|
+
*/
|
|
6
9
|
export class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
|
|
7
10
|
public override config: BaseGestureConfig & TapGestureConfig = {};
|
|
8
11
|
|
|
@@ -84,4 +87,7 @@ export class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
|
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated `TapGestureType` is deprecated and will be removed in the future. Please use `TapGesture` instead.
|
|
92
|
+
*/
|
|
87
93
|
export type TapGestureType = InstanceType<typeof TapGesture>;
|
package/src/mocks/module.tsx
CHANGED
|
@@ -2,6 +2,8 @@ const NOOP = () => {
|
|
|
2
2
|
// Do nothing
|
|
3
3
|
};
|
|
4
4
|
|
|
5
|
+
const NOOPTrue = () => true;
|
|
6
|
+
|
|
5
7
|
const attachGestureHandler = NOOP;
|
|
6
8
|
const createGestureHandler = NOOP;
|
|
7
9
|
const dropGestureHandler = NOOP;
|
|
@@ -9,7 +11,7 @@ const setGestureHandlerConfig = NOOP;
|
|
|
9
11
|
const updateGestureHandlerConfig = NOOP;
|
|
10
12
|
const flushOperations = NOOP;
|
|
11
13
|
const configureRelations = NOOP;
|
|
12
|
-
const
|
|
14
|
+
const installUIRuntimeBindings = NOOPTrue;
|
|
13
15
|
const install = NOOP;
|
|
14
16
|
|
|
15
17
|
export default {
|
|
@@ -19,7 +21,7 @@ export default {
|
|
|
19
21
|
setGestureHandlerConfig,
|
|
20
22
|
updateGestureHandlerConfig,
|
|
21
23
|
configureRelations,
|
|
22
|
-
|
|
24
|
+
installUIRuntimeBindings,
|
|
23
25
|
flushOperations,
|
|
24
26
|
install,
|
|
25
27
|
} as const;
|
|
@@ -3,15 +3,13 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
3
3
|
import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
4
|
|
|
5
5
|
export interface Spec extends TurboModule {
|
|
6
|
-
// This method returns a boolean only to force the codegen to generate
|
|
7
|
-
// a synchronous method. The returned value doesn't have any meaning.
|
|
8
6
|
createGestureHandler: (
|
|
9
7
|
handlerName: string,
|
|
10
8
|
handlerTag: Double,
|
|
11
9
|
// Record<> is not supported by codegen
|
|
12
10
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
13
11
|
config: Object
|
|
14
|
-
) =>
|
|
12
|
+
) => void;
|
|
15
13
|
attachGestureHandler: (
|
|
16
14
|
handlerTag: Double,
|
|
17
15
|
newView: Double,
|
|
@@ -25,7 +23,7 @@ export interface Spec extends TurboModule {
|
|
|
25
23
|
configureRelations: (handlerTag: Double, relations: Object) => void;
|
|
26
24
|
dropGestureHandler: (handlerTag: Double) => void;
|
|
27
25
|
flushOperations: () => void;
|
|
28
|
-
|
|
26
|
+
installUIRuntimeBindings: () => boolean;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
export default TurboModuleRegistry.getEnforcing<Spec>('RNGestureHandlerModule');
|
|
@@ -2,6 +2,7 @@ import type { ColorValue, ViewProps } from 'react-native';
|
|
|
2
2
|
import type {
|
|
3
3
|
Float,
|
|
4
4
|
Int32,
|
|
5
|
+
UnsafeMixed,
|
|
5
6
|
WithDefault,
|
|
6
7
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
8
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
@@ -19,8 +20,11 @@ interface NativeProps extends ViewProps {
|
|
|
19
20
|
'box-none' | 'none' | 'box-only' | 'auto',
|
|
20
21
|
'auto'
|
|
21
22
|
>;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
tapAnimationInDuration?: WithDefault<Int32, 50>;
|
|
24
|
+
tapAnimationOutDuration?: WithDefault<Int32, 100>;
|
|
25
|
+
longPressDuration?: WithDefault<Int32, -1>;
|
|
26
|
+
longPressAnimationOutDuration?: WithDefault<Int32, -1>;
|
|
27
|
+
needsOffscreenAlphaCompositing?: WithDefault<boolean, false>;
|
|
24
28
|
activeOpacity?: WithDefault<Float, 1>;
|
|
25
29
|
activeScale?: WithDefault<Float, 1>;
|
|
26
30
|
activeUnderlayOpacity?: WithDefault<Float, 0>;
|
|
@@ -54,17 +58,28 @@ interface NativeProps extends ViewProps {
|
|
|
54
58
|
borderBlockEndColor?: ColorValue;
|
|
55
59
|
borderBlockStartColor?: ColorValue;
|
|
56
60
|
|
|
57
|
-
// Border radius —
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
// Border radius — declared as UnsafeMixed (folly::dynamic on iOS,
|
|
62
|
+
// DynamicFromObject on Android) so codegen forwards the raw value
|
|
63
|
+
// without coercing to Float. This lets the Android view manager parse
|
|
64
|
+
// both numeric points and percentage strings via
|
|
65
|
+
// LengthPercentage.setFromDynamic, matching RN's standard View. The
|
|
66
|
+
// non-logical variants are declared explicitly so they're dispatched
|
|
67
|
+
// through our delegate instead of falling through to
|
|
68
|
+
// BaseViewManagerDelegate, which casts to Double and would crash on a
|
|
69
|
+
// string value.
|
|
70
|
+
borderRadius?: UnsafeMixed;
|
|
71
|
+
borderTopLeftRadius?: UnsafeMixed;
|
|
72
|
+
borderTopRightRadius?: UnsafeMixed;
|
|
73
|
+
borderBottomLeftRadius?: UnsafeMixed;
|
|
74
|
+
borderBottomRightRadius?: UnsafeMixed;
|
|
75
|
+
borderTopStartRadius?: UnsafeMixed;
|
|
76
|
+
borderTopEndRadius?: UnsafeMixed;
|
|
77
|
+
borderBottomStartRadius?: UnsafeMixed;
|
|
78
|
+
borderBottomEndRadius?: UnsafeMixed;
|
|
79
|
+
borderEndEndRadius?: UnsafeMixed;
|
|
80
|
+
borderEndStartRadius?: UnsafeMixed;
|
|
81
|
+
borderStartEndRadius?: UnsafeMixed;
|
|
82
|
+
borderStartStartRadius?: UnsafeMixed;
|
|
68
83
|
}
|
|
69
84
|
|
|
70
85
|
export default codegenNativeComponent<NativeProps>('RNGestureHandlerButton');
|
package/src/v3/NativeProxy.ts
CHANGED
|
@@ -16,11 +16,13 @@ export const NativeProxy = {
|
|
|
16
16
|
handlerTag: number,
|
|
17
17
|
config?: T
|
|
18
18
|
) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
scheduleOperationToBeFlushed(() => {
|
|
20
|
+
RNGestureHandlerModule.createGestureHandler(
|
|
21
|
+
handlerName,
|
|
22
|
+
handlerTag,
|
|
23
|
+
config || {}
|
|
24
|
+
);
|
|
25
|
+
});
|
|
24
26
|
},
|
|
25
27
|
setGestureHandlerConfig: <
|
|
26
28
|
TConfig,
|
|
@@ -59,7 +61,7 @@ export const NativeProxy = {
|
|
|
59
61
|
RNGestureHandlerModule.configureRelations(handlerTag, relations);
|
|
60
62
|
});
|
|
61
63
|
},
|
|
62
|
-
|
|
63
|
-
RNGestureHandlerModule.
|
|
64
|
+
installUIRuntimeBindings: () => {
|
|
65
|
+
return RNGestureHandlerModule.installUIRuntimeBindings();
|
|
64
66
|
},
|
|
65
67
|
} as const;
|
|
@@ -43,7 +43,7 @@ export const NativeProxy = {
|
|
|
43
43
|
configureRelations: (handlerTag: number, relations: GestureRelations) => {
|
|
44
44
|
RNGestureHandlerModule.configureRelations(handlerTag, relations);
|
|
45
45
|
},
|
|
46
|
-
|
|
47
|
-
RNGestureHandlerModule.
|
|
46
|
+
installUIRuntimeBindings: () => {
|
|
47
|
+
return RNGestureHandlerModule.installUIRuntimeBindings();
|
|
48
48
|
},
|
|
49
49
|
} as const;
|
|
@@ -15,17 +15,25 @@ import type {
|
|
|
15
15
|
type CallbackEventType = GestureEvent<NativeHandlerData>;
|
|
16
16
|
type EndCallbackEventType = GestureEndEvent<NativeHandlerData>;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
type RawButtonInnerProps = RawButtonProps & {
|
|
19
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const RawButtonInner = createNativeWrapper<
|
|
22
23
|
React.ComponentRef<typeof GestureHandlerButton>,
|
|
23
|
-
|
|
24
|
+
RawButtonInnerProps
|
|
24
25
|
>(GestureHandlerButton, {
|
|
25
26
|
shouldCancelWhenOutside: false,
|
|
26
|
-
shouldActivateOnStart:
|
|
27
|
+
shouldActivateOnStart: false,
|
|
27
28
|
});
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated `RawButton` is deprecated, use `Clickable` instead
|
|
32
|
+
*/
|
|
33
|
+
export const RawButton = (props: RawButtonProps) => (
|
|
34
|
+
<RawButtonInner {...props} needsOffscreenAlphaCompositing />
|
|
35
|
+
);
|
|
36
|
+
|
|
29
37
|
/**
|
|
30
38
|
* @deprecated `BaseButton` is deprecated, use `Touchable` instead
|
|
31
39
|
*/
|
|
@@ -69,16 +77,16 @@ export const BaseButton = (props: BaseButtonProps) => {
|
|
|
69
77
|
};
|
|
70
78
|
|
|
71
79
|
const onDeactivate = (e: EndCallbackEventType) => {
|
|
80
|
+
props.onDeactivate?.(e);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const onFinalize = (e: EndCallbackEventType) => {
|
|
72
84
|
onActiveStateChange?.(false);
|
|
73
85
|
|
|
74
86
|
if (!e.canceled && !longPressDetected.current) {
|
|
75
87
|
onPress?.(e.pointerInside);
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
props.onDeactivate?.(e);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onFinalize = (e: EndCallbackEventType) => {
|
|
82
90
|
if (longPressTimeout.current !== undefined) {
|
|
83
91
|
clearTimeout(longPressTimeout.current);
|
|
84
92
|
longPressTimeout.current = undefined;
|
|
@@ -308,7 +308,7 @@ const Pressable = (props: PressableProps) => {
|
|
|
308
308
|
stateMachine.handleEvent(StateMachineEvent.NATIVE_BEGIN);
|
|
309
309
|
},
|
|
310
310
|
onActivate: () => {
|
|
311
|
-
if (Platform.OS !== 'android'
|
|
311
|
+
if (Platform.OS !== 'android') {
|
|
312
312
|
// Native.onActivate is broken with Android + hitSlop
|
|
313
313
|
stateMachine.handleEvent(StateMachineEvent.NATIVE_START);
|
|
314
314
|
}
|
|
@@ -331,6 +331,7 @@ const Pressable = (props: PressableProps) => {
|
|
|
331
331
|
block,
|
|
332
332
|
requireToFail,
|
|
333
333
|
hitSlop: appliedHitSlop,
|
|
334
|
+
shouldActivateOnStart: Platform.OS === 'web',
|
|
334
335
|
});
|
|
335
336
|
|
|
336
337
|
const gesture = useSimultaneousGestures(
|
|
@@ -1,46 +1,100 @@
|
|
|
1
1
|
import React, { useCallback, useRef } from 'react';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import type { ButtonProps } from '../../../components/GestureHandlerButton';
|
|
5
4
|
import GestureHandlerButton from '../../../components/GestureHandlerButton';
|
|
6
|
-
import
|
|
5
|
+
import { NativeDetector } from '../../detectors/NativeDetector';
|
|
6
|
+
import { useNativeGesture } from '../../hooks';
|
|
7
7
|
import type {
|
|
8
|
+
AnimationDuration,
|
|
8
9
|
CallbackEventType,
|
|
9
10
|
EndCallbackEventType,
|
|
10
11
|
TouchableProps,
|
|
11
12
|
} from './TouchableProps';
|
|
12
13
|
|
|
13
|
-
const TouchableButton = createNativeWrapper<
|
|
14
|
-
React.ComponentRef<typeof GestureHandlerButton>,
|
|
15
|
-
ButtonProps
|
|
16
|
-
>(GestureHandlerButton, {
|
|
17
|
-
shouldCancelWhenOutside: true,
|
|
18
|
-
shouldActivateOnStart: false,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
14
|
const isAndroid = Platform.OS === 'android';
|
|
22
15
|
const TRANSPARENT_RIPPLE = { rippleColor: 'transparent' as const };
|
|
16
|
+
const DEFAULT_IN_DURATION_MS = 50;
|
|
17
|
+
const DEFAULT_OUT_DURATION_MS = 100;
|
|
18
|
+
|
|
19
|
+
enum PointerState {
|
|
20
|
+
UNKNOWN,
|
|
21
|
+
INSIDE,
|
|
22
|
+
OUTSIDE,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Clamp user-supplied durations to finite, non-negative milliseconds.
|
|
26
|
+
// Negative, NaN, or Infinity values would produce invalid CSS transitions
|
|
27
|
+
// on web and negative setTimeout delays in branch 3 of the press-out path.
|
|
28
|
+
function sanitizeDuration(value: number): number {
|
|
29
|
+
return Number.isFinite(value) && value >= 0 ? value : 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function resolveAnimationDuration(value: AnimationDuration | undefined) {
|
|
33
|
+
if (value === undefined) {
|
|
34
|
+
return {
|
|
35
|
+
tapAnimationInDuration: DEFAULT_IN_DURATION_MS,
|
|
36
|
+
tapAnimationOutDuration: DEFAULT_OUT_DURATION_MS,
|
|
37
|
+
longPressAnimationOutDuration: DEFAULT_OUT_DURATION_MS,
|
|
38
|
+
hoverAnimationInDuration: DEFAULT_IN_DURATION_MS,
|
|
39
|
+
hoverAnimationOutDuration: DEFAULT_OUT_DURATION_MS,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof value === 'number') {
|
|
44
|
+
const sanitized = sanitizeDuration(value);
|
|
45
|
+
return {
|
|
46
|
+
tapAnimationInDuration: sanitized,
|
|
47
|
+
tapAnimationOutDuration: sanitized,
|
|
48
|
+
longPressAnimationOutDuration: sanitized,
|
|
49
|
+
hoverAnimationInDuration: sanitized,
|
|
50
|
+
hoverAnimationOutDuration: sanitized,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The union guarantees variant 2 supplies top-level `in`/`out`, variant 3
|
|
55
|
+
// supplies both category objects — so per-category fallback to base is
|
|
56
|
+
// always defined for well-typed input; the 0 fallbacks here are unreachable.
|
|
57
|
+
const baseIn = 'in' in value ? value.in : 0;
|
|
58
|
+
const baseOut = 'out' in value ? value.out : 0;
|
|
59
|
+
const tapOut = value.tap?.out ?? baseOut;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
tapAnimationInDuration: sanitizeDuration(value.tap?.in ?? baseIn),
|
|
63
|
+
tapAnimationOutDuration: sanitizeDuration(tapOut),
|
|
64
|
+
longPressAnimationOutDuration: sanitizeDuration(
|
|
65
|
+
value.longPress?.out ?? tapOut
|
|
66
|
+
),
|
|
67
|
+
hoverAnimationInDuration: sanitizeDuration(value.hover?.in ?? baseIn),
|
|
68
|
+
hoverAnimationOutDuration: sanitizeDuration(value.hover?.out ?? baseOut),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
23
71
|
|
|
24
72
|
export const Touchable = (props: TouchableProps) => {
|
|
25
73
|
const {
|
|
26
|
-
underlayColor = '
|
|
74
|
+
underlayColor = 'transparent',
|
|
27
75
|
defaultUnderlayOpacity = 0,
|
|
76
|
+
activeUnderlayOpacity = 0.105,
|
|
28
77
|
defaultOpacity = 1,
|
|
78
|
+
animationDuration,
|
|
29
79
|
androidRipple,
|
|
30
80
|
delayLongPress = 600,
|
|
31
81
|
onLongPress,
|
|
32
82
|
onPress,
|
|
33
83
|
onPressIn,
|
|
34
84
|
onPressOut,
|
|
35
|
-
onActiveStateChange,
|
|
36
85
|
children,
|
|
37
86
|
disabled = false,
|
|
87
|
+
cancelOnLeave = true,
|
|
38
88
|
ref,
|
|
39
89
|
...rest
|
|
40
90
|
} = props;
|
|
41
91
|
|
|
92
|
+
const resolvedDurations = resolveAnimationDuration(animationDuration);
|
|
93
|
+
const resolvedDelayLongPress = sanitizeDuration(delayLongPress);
|
|
94
|
+
|
|
42
95
|
const shouldUseNativeRipple = isAndroid && androidRipple !== undefined;
|
|
43
96
|
|
|
97
|
+
const pointerState = useRef<PointerState>(PointerState.UNKNOWN);
|
|
44
98
|
const longPressDetected = useRef(false);
|
|
45
99
|
const longPressTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(
|
|
46
100
|
undefined
|
|
@@ -55,57 +109,96 @@ export const Touchable = (props: TouchableProps) => {
|
|
|
55
109
|
longPressDetected.current = false;
|
|
56
110
|
|
|
57
111
|
if (onLongPress && !longPressTimeout.current) {
|
|
58
|
-
longPressTimeout.current = setTimeout(
|
|
112
|
+
longPressTimeout.current = setTimeout(
|
|
113
|
+
wrappedLongPress,
|
|
114
|
+
resolvedDelayLongPress
|
|
115
|
+
);
|
|
59
116
|
}
|
|
60
|
-
}, [onLongPress,
|
|
117
|
+
}, [onLongPress, resolvedDelayLongPress, wrappedLongPress]);
|
|
61
118
|
|
|
62
119
|
const onBegin = useCallback(
|
|
63
120
|
(e: CallbackEventType) => {
|
|
64
121
|
if (!e.pointerInside) {
|
|
122
|
+
pointerState.current = PointerState.OUTSIDE;
|
|
65
123
|
return;
|
|
66
124
|
}
|
|
67
125
|
|
|
68
126
|
onPressIn?.(e);
|
|
69
127
|
startLongPressTimer();
|
|
128
|
+
|
|
129
|
+
pointerState.current = PointerState.INSIDE;
|
|
70
130
|
},
|
|
71
131
|
[startLongPressTimer, onPressIn]
|
|
72
132
|
);
|
|
73
133
|
|
|
74
|
-
const onActivate = useCallback(
|
|
75
|
-
(e
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
longPressTimeout.current = undefined;
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
[onActiveStateChange]
|
|
84
|
-
);
|
|
134
|
+
const onActivate = useCallback((e: CallbackEventType) => {
|
|
135
|
+
if (!e.pointerInside && longPressTimeout.current !== undefined) {
|
|
136
|
+
clearTimeout(longPressTimeout.current);
|
|
137
|
+
longPressTimeout.current = undefined;
|
|
138
|
+
}
|
|
139
|
+
}, []);
|
|
85
140
|
|
|
86
|
-
const
|
|
141
|
+
const onFinalize = useCallback(
|
|
87
142
|
(e: EndCallbackEventType) => {
|
|
88
|
-
|
|
143
|
+
if (pointerState.current === PointerState.INSIDE) {
|
|
144
|
+
onPressOut?.(e);
|
|
145
|
+
}
|
|
89
146
|
|
|
90
|
-
if (!e.canceled && !longPressDetected.current) {
|
|
91
|
-
onPress?.(e
|
|
147
|
+
if (!e.canceled && !longPressDetected.current && e.pointerInside) {
|
|
148
|
+
onPress?.(e);
|
|
92
149
|
}
|
|
93
|
-
},
|
|
94
|
-
[onActiveStateChange, onPress]
|
|
95
|
-
);
|
|
96
150
|
|
|
97
|
-
|
|
98
|
-
(e: EndCallbackEventType) => {
|
|
99
|
-
onPressOut?.(e);
|
|
151
|
+
pointerState.current = PointerState.UNKNOWN;
|
|
100
152
|
|
|
101
153
|
if (longPressTimeout.current !== undefined) {
|
|
102
154
|
clearTimeout(longPressTimeout.current);
|
|
103
155
|
longPressTimeout.current = undefined;
|
|
104
156
|
}
|
|
105
157
|
},
|
|
106
|
-
[onPressOut]
|
|
158
|
+
[onPressOut, onPress]
|
|
107
159
|
);
|
|
108
160
|
|
|
161
|
+
const onUpdate = useCallback(
|
|
162
|
+
(e: CallbackEventType) => {
|
|
163
|
+
if (pointerState.current === PointerState.UNKNOWN) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (e.pointerInside) {
|
|
168
|
+
if (pointerState.current === PointerState.OUTSIDE) {
|
|
169
|
+
onPressIn?.(e);
|
|
170
|
+
}
|
|
171
|
+
pointerState.current = PointerState.INSIDE;
|
|
172
|
+
} else {
|
|
173
|
+
if (pointerState.current === PointerState.INSIDE) {
|
|
174
|
+
onPressOut?.(e);
|
|
175
|
+
|
|
176
|
+
if (longPressTimeout.current !== undefined) {
|
|
177
|
+
clearTimeout(longPressTimeout.current);
|
|
178
|
+
longPressTimeout.current = undefined;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
pointerState.current = PointerState.OUTSIDE;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
[onPressIn, onPressOut]
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const nativeGesture = useNativeGesture({
|
|
188
|
+
onBegin,
|
|
189
|
+
onActivate,
|
|
190
|
+
onFinalize,
|
|
191
|
+
onUpdate,
|
|
192
|
+
hitSlop: props.hitSlop,
|
|
193
|
+
testID: props.testID,
|
|
194
|
+
enabled: !disabled,
|
|
195
|
+
shouldCancelWhenOutside: cancelOnLeave,
|
|
196
|
+
disableReanimated: true,
|
|
197
|
+
shouldActivateOnStart: false,
|
|
198
|
+
disallowInterruption: true,
|
|
199
|
+
yieldsToContinuousGestures: true,
|
|
200
|
+
});
|
|
201
|
+
|
|
109
202
|
const rippleProps = shouldUseNativeRipple
|
|
110
203
|
? {
|
|
111
204
|
rippleColor: androidRipple?.color,
|
|
@@ -116,19 +209,20 @@ export const Touchable = (props: TouchableProps) => {
|
|
|
116
209
|
: TRANSPARENT_RIPPLE;
|
|
117
210
|
|
|
118
211
|
return (
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
212
|
+
<NativeDetector gesture={nativeGesture}>
|
|
213
|
+
<GestureHandlerButton
|
|
214
|
+
{...rest}
|
|
215
|
+
{...rippleProps}
|
|
216
|
+
{...resolvedDurations}
|
|
217
|
+
ref={ref ?? null}
|
|
218
|
+
enabled={!disabled}
|
|
219
|
+
defaultOpacity={defaultOpacity}
|
|
220
|
+
defaultUnderlayOpacity={defaultUnderlayOpacity}
|
|
221
|
+
activeUnderlayOpacity={activeUnderlayOpacity}
|
|
222
|
+
underlayColor={underlayColor}
|
|
223
|
+
longPressDuration={resolvedDelayLongPress}>
|
|
224
|
+
{children}
|
|
225
|
+
</GestureHandlerButton>
|
|
226
|
+
</NativeDetector>
|
|
133
227
|
);
|
|
134
228
|
};
|