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
|
@@ -23,12 +23,12 @@ import android.view.View
|
|
|
23
23
|
import android.view.ViewGroup
|
|
24
24
|
import android.view.accessibility.AccessibilityNodeInfo
|
|
25
25
|
import androidx.core.view.children
|
|
26
|
-
import androidx.interpolator.view.animation.
|
|
26
|
+
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
|
27
27
|
import com.facebook.react.R
|
|
28
|
+
import com.facebook.react.bridge.Dynamic
|
|
28
29
|
import com.facebook.react.module.annotations.ReactModule
|
|
29
30
|
import com.facebook.react.uimanager.BackgroundStyleApplicator
|
|
30
31
|
import com.facebook.react.uimanager.LengthPercentage
|
|
31
|
-
import com.facebook.react.uimanager.LengthPercentageType
|
|
32
32
|
import com.facebook.react.uimanager.PixelUtil
|
|
33
33
|
import com.facebook.react.uimanager.PointerEvents
|
|
34
34
|
import com.facebook.react.uimanager.ReactPointerEventsView
|
|
@@ -42,6 +42,8 @@ import com.facebook.react.uimanager.style.BorderStyle
|
|
|
42
42
|
import com.facebook.react.uimanager.style.LogicalEdge
|
|
43
43
|
import com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate
|
|
44
44
|
import com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerInterface
|
|
45
|
+
import com.swmansion.gesturehandler.core.GestureHandler
|
|
46
|
+
import com.swmansion.gesturehandler.core.HoverGestureHandler
|
|
45
47
|
import com.swmansion.gesturehandler.core.NativeViewGestureHandler
|
|
46
48
|
import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager.ButtonViewGroup
|
|
47
49
|
|
|
@@ -176,74 +178,76 @@ class RNGestureHandlerButtonViewManager :
|
|
|
176
178
|
view.setOverflow(overflow)
|
|
177
179
|
}
|
|
178
180
|
|
|
179
|
-
private fun setBorderRadiusInternal(view: ButtonViewGroup, prop: BorderRadiusProp, value:
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
private fun setBorderRadiusInternal(view: ButtonViewGroup, prop: BorderRadiusProp, value: Dynamic) {
|
|
182
|
+
// setFromDynamic returns null for null Dynamics, negative numbers, and
|
|
183
|
+
// unparseable strings — which is what we want for "unset" so that
|
|
184
|
+
// general / physical radii continue to cascade.
|
|
185
|
+
val lp = LengthPercentage.setFromDynamic(value)
|
|
182
186
|
BackgroundStyleApplicator.setBorderRadius(view, prop, lp)
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
@ReactProp(name = ViewProps.BORDER_RADIUS)
|
|
186
|
-
override fun setBorderRadius(view: ButtonViewGroup,
|
|
187
|
-
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_RADIUS,
|
|
190
|
+
override fun setBorderRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
191
|
+
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_RADIUS, value)
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
@ReactProp(name = "borderTopLeftRadius")
|
|
191
|
-
override fun setBorderTopLeftRadius(view: ButtonViewGroup, value:
|
|
195
|
+
override fun setBorderTopLeftRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
192
196
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_TOP_LEFT_RADIUS, value)
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
@ReactProp(name = "borderTopRightRadius")
|
|
196
|
-
override fun setBorderTopRightRadius(view: ButtonViewGroup, value:
|
|
200
|
+
override fun setBorderTopRightRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
197
201
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_TOP_RIGHT_RADIUS, value)
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
@ReactProp(name = "borderBottomRightRadius")
|
|
201
|
-
override fun setBorderBottomRightRadius(view: ButtonViewGroup, value:
|
|
205
|
+
override fun setBorderBottomRightRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
202
206
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_BOTTOM_RIGHT_RADIUS, value)
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
@ReactProp(name = "borderBottomLeftRadius")
|
|
206
|
-
override fun setBorderBottomLeftRadius(view: ButtonViewGroup, value:
|
|
210
|
+
override fun setBorderBottomLeftRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
207
211
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_BOTTOM_LEFT_RADIUS, value)
|
|
208
212
|
}
|
|
209
213
|
|
|
210
214
|
@ReactProp(name = "borderTopStartRadius")
|
|
211
|
-
override fun setBorderTopStartRadius(view: ButtonViewGroup, value:
|
|
215
|
+
override fun setBorderTopStartRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
212
216
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_TOP_START_RADIUS, value)
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
@ReactProp(name = "borderTopEndRadius")
|
|
216
|
-
override fun setBorderTopEndRadius(view: ButtonViewGroup, value:
|
|
220
|
+
override fun setBorderTopEndRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
217
221
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_TOP_END_RADIUS, value)
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
@ReactProp(name = "borderBottomStartRadius")
|
|
221
|
-
override fun setBorderBottomStartRadius(view: ButtonViewGroup, value:
|
|
225
|
+
override fun setBorderBottomStartRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
222
226
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_BOTTOM_START_RADIUS, value)
|
|
223
227
|
}
|
|
224
228
|
|
|
225
229
|
@ReactProp(name = "borderBottomEndRadius")
|
|
226
|
-
override fun setBorderBottomEndRadius(view: ButtonViewGroup, value:
|
|
230
|
+
override fun setBorderBottomEndRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
227
231
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_BOTTOM_END_RADIUS, value)
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
@ReactProp(name = "borderEndEndRadius")
|
|
231
|
-
override fun setBorderEndEndRadius(view: ButtonViewGroup, value:
|
|
235
|
+
override fun setBorderEndEndRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
232
236
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_END_END_RADIUS, value)
|
|
233
237
|
}
|
|
234
238
|
|
|
235
239
|
@ReactProp(name = "borderEndStartRadius")
|
|
236
|
-
override fun setBorderEndStartRadius(view: ButtonViewGroup, value:
|
|
240
|
+
override fun setBorderEndStartRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
237
241
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_END_START_RADIUS, value)
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
@ReactProp(name = "borderStartEndRadius")
|
|
241
|
-
override fun setBorderStartEndRadius(view: ButtonViewGroup, value:
|
|
245
|
+
override fun setBorderStartEndRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
242
246
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_START_END_RADIUS, value)
|
|
243
247
|
}
|
|
244
248
|
|
|
245
249
|
@ReactProp(name = "borderStartStartRadius")
|
|
246
|
-
override fun setBorderStartStartRadius(view: ButtonViewGroup, value:
|
|
250
|
+
override fun setBorderStartStartRadius(view: ButtonViewGroup, value: Dynamic) {
|
|
247
251
|
setBorderRadiusInternal(view, BorderRadiusProp.BORDER_START_START_RADIUS, value)
|
|
248
252
|
}
|
|
249
253
|
|
|
@@ -267,14 +271,29 @@ class RNGestureHandlerButtonViewManager :
|
|
|
267
271
|
view.isSoundEffectsEnabled = !touchSoundDisabled
|
|
268
272
|
}
|
|
269
273
|
|
|
270
|
-
@ReactProp(name = "
|
|
271
|
-
override fun
|
|
272
|
-
view.
|
|
274
|
+
@ReactProp(name = "tapAnimationInDuration")
|
|
275
|
+
override fun setTapAnimationInDuration(view: ButtonViewGroup, value: Int) {
|
|
276
|
+
view.tapAnimationInDuration = if (value > 0) value else 0
|
|
273
277
|
}
|
|
274
278
|
|
|
275
|
-
@ReactProp(name = "
|
|
276
|
-
override fun
|
|
277
|
-
view.
|
|
279
|
+
@ReactProp(name = "tapAnimationOutDuration")
|
|
280
|
+
override fun setTapAnimationOutDuration(view: ButtonViewGroup, value: Int) {
|
|
281
|
+
view.tapAnimationOutDuration = if (value > 0) value else 0
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@ReactProp(name = "longPressDuration")
|
|
285
|
+
override fun setLongPressDuration(view: ButtonViewGroup, value: Int) {
|
|
286
|
+
view.longPressDuration = value
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@ReactProp(name = "longPressAnimationOutDuration")
|
|
290
|
+
override fun setLongPressAnimationOutDuration(view: ButtonViewGroup, value: Int) {
|
|
291
|
+
view.longPressAnimationOutDuration = value
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
@ReactProp(name = "needsOffscreenAlphaCompositing")
|
|
295
|
+
override fun setNeedsOffscreenAlphaCompositing(view: ButtonViewGroup, value: Boolean) {
|
|
296
|
+
view.needsOffscreenAlphaCompositing = value
|
|
278
297
|
}
|
|
279
298
|
|
|
280
299
|
@ReactProp(name = "defaultOpacity")
|
|
@@ -352,9 +371,11 @@ class RNGestureHandlerButtonViewManager :
|
|
|
352
371
|
var useBorderlessDrawable = false
|
|
353
372
|
|
|
354
373
|
var exclusive = true
|
|
355
|
-
var
|
|
356
|
-
var
|
|
357
|
-
|
|
374
|
+
var tapAnimationInDuration: Int = 50
|
|
375
|
+
var tapAnimationOutDuration: Int = 100
|
|
376
|
+
var longPressDuration: Int = -1
|
|
377
|
+
var longPressAnimationOutDuration: Int = -1
|
|
378
|
+
get() = if (field < 0) tapAnimationOutDuration else field
|
|
358
379
|
var activeOpacity: Float = 1.0f
|
|
359
380
|
var defaultOpacity: Float = 1.0f
|
|
360
381
|
var activeScale: Float = 1.0f
|
|
@@ -368,6 +389,7 @@ class RNGestureHandlerButtonViewManager :
|
|
|
368
389
|
set(value) = withBackgroundUpdate {
|
|
369
390
|
field = value
|
|
370
391
|
}
|
|
392
|
+
var needsOffscreenAlphaCompositing = false
|
|
371
393
|
|
|
372
394
|
override var pointerEvents: PointerEvents = PointerEvents.AUTO
|
|
373
395
|
|
|
@@ -379,11 +401,17 @@ class RNGestureHandlerButtonViewManager :
|
|
|
379
401
|
private var underlayDrawable: PaintDrawable? = null
|
|
380
402
|
private var pressInTimestamp = 0L
|
|
381
403
|
private var pendingPressOut: Runnable? = null
|
|
404
|
+
private var isPointerInsideBounds = false
|
|
382
405
|
|
|
383
406
|
// When non-null the ripple is drawn in dispatchDraw (above background, below children).
|
|
384
407
|
// When null the ripple lives on the foreground drawable instead.
|
|
385
408
|
private var selectableDrawable: Drawable? = null
|
|
386
409
|
|
|
410
|
+
// When true, dispatchDraw clips children to the resolved border-radius shape
|
|
411
|
+
// (overflow: hidden). ViewGroup's clipChildren is only a rectangular clip and
|
|
412
|
+
// wouldn't respect rounded corners.
|
|
413
|
+
private var clipChildrenToShape = false
|
|
414
|
+
|
|
387
415
|
var isTouched = false
|
|
388
416
|
|
|
389
417
|
init {
|
|
@@ -401,16 +429,7 @@ class RNGestureHandlerButtonViewManager :
|
|
|
401
429
|
}
|
|
402
430
|
|
|
403
431
|
fun setOverflow(overflow: String?) {
|
|
404
|
-
|
|
405
|
-
"hidden" -> {
|
|
406
|
-
clipChildren = true
|
|
407
|
-
clipToPadding = true
|
|
408
|
-
}
|
|
409
|
-
else -> {
|
|
410
|
-
clipChildren = false
|
|
411
|
-
clipToPadding = false
|
|
412
|
-
}
|
|
413
|
-
}
|
|
432
|
+
clipChildrenToShape = overflow == "hidden"
|
|
414
433
|
invalidate()
|
|
415
434
|
}
|
|
416
435
|
|
|
@@ -481,7 +500,32 @@ class RNGestureHandlerButtonViewManager :
|
|
|
481
500
|
if (lastEventTime != eventTime || lastAction != action || action == MotionEvent.ACTION_CANCEL) {
|
|
482
501
|
lastEventTime = eventTime
|
|
483
502
|
lastAction = action
|
|
484
|
-
|
|
503
|
+
val handled = super.onTouchEvent(event)
|
|
504
|
+
|
|
505
|
+
// Replay press-in / press-out animations across drag transitions.
|
|
506
|
+
if (handled && canRespondToTouches()) {
|
|
507
|
+
when (event.actionMasked) {
|
|
508
|
+
MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> isPointerInsideBounds = true
|
|
509
|
+
MotionEvent.ACTION_MOVE -> {
|
|
510
|
+
val inside = event.x >= 0 && event.y >= 0 && event.x < width && event.y < height
|
|
511
|
+
if (inside != isPointerInsideBounds) {
|
|
512
|
+
isPointerInsideBounds = inside
|
|
513
|
+
if (inside) {
|
|
514
|
+
// Re-establish View's pressed flag to restore ripple and the
|
|
515
|
+
// UP handler runs its normal release cleanup.
|
|
516
|
+
setPressed(true)
|
|
517
|
+
} else {
|
|
518
|
+
animatePressOut()
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP, MotionEvent.ACTION_CANCEL ->
|
|
523
|
+
isPointerInsideBounds =
|
|
524
|
+
false
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return handled
|
|
485
529
|
}
|
|
486
530
|
return false
|
|
487
531
|
}
|
|
@@ -506,6 +550,28 @@ class RNGestureHandlerButtonViewManager :
|
|
|
506
550
|
}
|
|
507
551
|
|
|
508
552
|
currentAnimator?.cancel()
|
|
553
|
+
currentAnimator = null
|
|
554
|
+
|
|
555
|
+
// Sub-frame durations: snap directly. ObjectAnimator with duration 0
|
|
556
|
+
// still defers its property write to the next frame callback, so if a
|
|
557
|
+
// follow-up animateTo() cancels it in the same frame the property never
|
|
558
|
+
// lands on its target and the next animator captures a stale starting
|
|
559
|
+
// value (e.g. an instant press-in followed by press-out in the same
|
|
560
|
+
// frame, leaving the press-out to animate default → default).
|
|
561
|
+
if (durationMs < (display?.minimumFrameTime ?: 16f)) {
|
|
562
|
+
if (hasOpacity) {
|
|
563
|
+
alpha = opacity
|
|
564
|
+
}
|
|
565
|
+
if (hasScale) {
|
|
566
|
+
scaleX = scale
|
|
567
|
+
scaleY = scale
|
|
568
|
+
}
|
|
569
|
+
if (hasUnderlay) {
|
|
570
|
+
underlayDrawable!!.alpha = (underlayOpacity * 255).toInt()
|
|
571
|
+
}
|
|
572
|
+
return
|
|
573
|
+
}
|
|
574
|
+
|
|
509
575
|
val animators = ArrayList<Animator>()
|
|
510
576
|
if (hasOpacity) {
|
|
511
577
|
animators.add(ObjectAnimator.ofFloat(this, "alpha", opacity))
|
|
@@ -520,7 +586,7 @@ class RNGestureHandlerButtonViewManager :
|
|
|
520
586
|
currentAnimator = AnimatorSet().apply {
|
|
521
587
|
playTogether(animators)
|
|
522
588
|
duration = durationMs
|
|
523
|
-
interpolator =
|
|
589
|
+
interpolator = FastOutSlowInInterpolator()
|
|
524
590
|
start()
|
|
525
591
|
}
|
|
526
592
|
}
|
|
@@ -531,27 +597,33 @@ class RNGestureHandlerButtonViewManager :
|
|
|
531
597
|
pendingPressOut = null
|
|
532
598
|
}
|
|
533
599
|
pressInTimestamp = SystemClock.uptimeMillis()
|
|
534
|
-
animateTo(activeOpacity, activeScale, activeUnderlayOpacity,
|
|
600
|
+
animateTo(activeOpacity, activeScale, activeUnderlayOpacity, tapAnimationInDuration.toLong())
|
|
535
601
|
}
|
|
536
602
|
|
|
537
603
|
private fun animatePressOut() {
|
|
538
604
|
pendingPressOut?.let { handler.removeCallbacks(it) }
|
|
539
|
-
val
|
|
540
|
-
val
|
|
605
|
+
val tapInMs = tapAnimationInDuration.toLong()
|
|
606
|
+
val tapOutMs = tapAnimationOutDuration.toLong()
|
|
607
|
+
val longPressMs = longPressDuration.toLong()
|
|
608
|
+
val longPressOutMs = longPressAnimationOutDuration.toLong()
|
|
541
609
|
val elapsed = SystemClock.uptimeMillis() - pressInTimestamp
|
|
542
610
|
|
|
543
|
-
if (elapsed >=
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
} else if (elapsed
|
|
611
|
+
if (longPressMs >= 0 && elapsed >= longPressMs) {
|
|
612
|
+
// Long-press release - use the configured long-press out duration.
|
|
613
|
+
animateTo(defaultOpacity, defaultScale, defaultUnderlayOpacity, longPressOutMs)
|
|
614
|
+
} else if (elapsed >= tapInMs) {
|
|
615
|
+
// Press-in animation fully finished — release with the configured out duration.
|
|
616
|
+
animateTo(defaultOpacity, defaultScale, defaultUnderlayOpacity, tapOutMs)
|
|
617
|
+
// elapsed * 2 to ensure there is at least half of the tapAnimationOutDuration left for the animation to play
|
|
618
|
+
} else if (elapsed * 2 >= tapOutMs) {
|
|
547
619
|
animateTo(defaultOpacity, defaultScale, defaultUnderlayOpacity, elapsed)
|
|
548
620
|
} else {
|
|
549
|
-
val remaining =
|
|
621
|
+
val remaining = tapInMs - elapsed
|
|
550
622
|
animateTo(activeOpacity, activeScale, activeUnderlayOpacity, remaining)
|
|
551
623
|
|
|
552
624
|
val runnable = Runnable {
|
|
553
625
|
pendingPressOut = null
|
|
554
|
-
animateTo(defaultOpacity, defaultScale, defaultUnderlayOpacity,
|
|
626
|
+
animateTo(defaultOpacity, defaultScale, defaultUnderlayOpacity, tapOutMs)
|
|
555
627
|
}
|
|
556
628
|
pendingPressOut = runnable
|
|
557
629
|
handler.postDelayed(runnable, remaining)
|
|
@@ -618,7 +690,14 @@ class RNGestureHandlerButtonViewManager :
|
|
|
618
690
|
canvas.restore()
|
|
619
691
|
}
|
|
620
692
|
}
|
|
621
|
-
|
|
693
|
+
if (clipChildrenToShape) {
|
|
694
|
+
canvas.save()
|
|
695
|
+
BackgroundStyleApplicator.clipToPaddingBox(this, canvas)
|
|
696
|
+
super.dispatchDraw(canvas)
|
|
697
|
+
canvas.restore()
|
|
698
|
+
} else {
|
|
699
|
+
super.dispatchDraw(canvas)
|
|
700
|
+
}
|
|
622
701
|
}
|
|
623
702
|
|
|
624
703
|
override fun verifyDrawable(who: Drawable): Boolean =
|
|
@@ -671,6 +750,14 @@ class RNGestureHandlerButtonViewManager :
|
|
|
671
750
|
pendingPressOut = null
|
|
672
751
|
currentAnimator?.cancel()
|
|
673
752
|
currentAnimator = null
|
|
753
|
+
applyStartAnimationState()
|
|
754
|
+
|
|
755
|
+
if (touchResponder === this) {
|
|
756
|
+
touchResponder = null
|
|
757
|
+
}
|
|
758
|
+
if (soundResponder === this) {
|
|
759
|
+
soundResponder = null
|
|
760
|
+
}
|
|
674
761
|
}
|
|
675
762
|
|
|
676
763
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
|
@@ -712,6 +799,16 @@ class RNGestureHandlerButtonViewManager :
|
|
|
712
799
|
isTouched = false
|
|
713
800
|
}
|
|
714
801
|
|
|
802
|
+
override fun shouldBeginWithRecordedHandlers(
|
|
803
|
+
recorded: List<GestureHandler>,
|
|
804
|
+
handler: NativeViewGestureHandler,
|
|
805
|
+
): Boolean = recorded.all {
|
|
806
|
+
it.shouldRecognizeSimultaneously(handler) ||
|
|
807
|
+
handler.shouldRecognizeSimultaneously(it) ||
|
|
808
|
+
it.view == this ||
|
|
809
|
+
it is HoverGestureHandler
|
|
810
|
+
}
|
|
811
|
+
|
|
715
812
|
private fun tryFreeingResponder() {
|
|
716
813
|
if (touchResponder === this) {
|
|
717
814
|
touchResponder = null
|
|
@@ -719,6 +816,12 @@ class RNGestureHandlerButtonViewManager :
|
|
|
719
816
|
}
|
|
720
817
|
}
|
|
721
818
|
|
|
819
|
+
private fun canRespondToTouches(): Boolean = if (exclusive) {
|
|
820
|
+
touchResponder === this
|
|
821
|
+
} else {
|
|
822
|
+
!(touchResponder?.exclusive ?: false)
|
|
823
|
+
}
|
|
824
|
+
|
|
722
825
|
private fun tryGrabbingResponder(): Boolean {
|
|
723
826
|
if (isChildTouched()) {
|
|
724
827
|
return false
|
|
@@ -728,11 +831,8 @@ class RNGestureHandlerButtonViewManager :
|
|
|
728
831
|
touchResponder = this
|
|
729
832
|
return true
|
|
730
833
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
} else {
|
|
734
|
-
!(touchResponder?.exclusive ?: false)
|
|
735
|
-
}
|
|
834
|
+
|
|
835
|
+
return canRespondToTouches()
|
|
736
836
|
}
|
|
737
837
|
|
|
738
838
|
private fun isChildTouched(children: Sequence<View> = this.children): Boolean {
|
|
@@ -806,6 +906,11 @@ class RNGestureHandlerButtonViewManager :
|
|
|
806
906
|
// by default Viewgroup would pass hotspot change events
|
|
807
907
|
}
|
|
808
908
|
|
|
909
|
+
// Default to skipping the offscreen buffer so children's border anti-aliasing
|
|
910
|
+
// at the view edge isn't clipped by the layer bounds when alpha != 1.
|
|
911
|
+
// `needsOffscreenAlphaCompositing` opts back into the standard View behavior.
|
|
912
|
+
override fun hasOverlappingRendering(): Boolean = needsOffscreenAlphaCompositing
|
|
913
|
+
|
|
809
914
|
companion object {
|
|
810
915
|
var resolveOutValue = TypedValue()
|
|
811
916
|
var touchResponder: ButtonViewGroup? = null
|