react-native-gesture-handler 2.17.0 → 2.18.0
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/ReanimatedSwipeable/package.json +6 -0
- package/android/build.gradle +0 -105
- package/android/gradle.properties +0 -7
- package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +22 -10
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +16 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +7 -8
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +14 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +3 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +3 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +8 -7
- package/android/src/main/jni/cpp-adapter.cpp +5 -3
- package/apple/Handlers/RNFlingHandler.m +1 -0
- package/apple/Handlers/RNForceTouchHandler.m +2 -0
- package/apple/Handlers/RNLongPressHandler.m +2 -1
- package/apple/Handlers/RNManualHandler.m +1 -0
- package/apple/Handlers/RNNativeViewHandler.mm +31 -27
- package/apple/Handlers/RNPanHandler.m +1 -0
- package/apple/Handlers/RNPinchHandler.m +1 -0
- package/apple/Handlers/RNRotationHandler.m +1 -0
- package/apple/Handlers/RNTapHandler.m +1 -0
- package/apple/RNGestureHandlerModule.mm +3 -2
- package/apple/RNRootViewGestureRecognizer.m +5 -0
- package/lib/commonjs/Directions.js +2 -2
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +2 -2
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +2 -2
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureButtons.js +3 -3
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureButtonsProps.js +6 -0
- package/lib/commonjs/components/GestureButtonsProps.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +1 -1
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +334 -0
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -0
- package/lib/commonjs/components/Pressable/PressableProps.js +6 -0
- package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -0
- package/lib/commonjs/components/Pressable/index.js +24 -0
- package/lib/commonjs/components/Pressable/index.js.map +1 -0
- package/lib/commonjs/components/Pressable/utils.js +136 -0
- package/lib/commonjs/components/Pressable/utils.js.map +1 -0
- package/lib/commonjs/components/ReanimatedSwipeable.js +317 -0
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +3 -3
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +4 -4
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchableProps.js +6 -0
- package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js +6 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +2 -2
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js +3 -4
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js +2 -0
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +21 -19
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +3 -3
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -86
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -9
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +2 -2
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +21 -31
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +5 -5
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +7 -7
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js +5 -5
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js +12 -0
- package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -0
- package/lib/commonjs/handlers/handlersRegistry.js +0 -6
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +91 -0
- package/lib/commonjs/handlers/utils.js.map +1 -0
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/init.js +1 -1
- package/lib/commonjs/init.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js +2 -2
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mocks.js +2 -2
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/utils.js +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +1 -1
- package/lib/commonjs/web/Gestures.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +4 -4
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +6 -11
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js +2 -2
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +4 -11
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/LeastSquareSolver.js +18 -18
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +2 -2
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +4 -4
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +6 -6
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js +2 -0
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/Directions.js +2 -2
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +2 -2
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +2 -2
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureButtons.js +3 -3
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureButtonsProps.js +2 -0
- package/lib/module/components/GestureButtonsProps.js.map +1 -0
- package/lib/module/components/GestureComponents.js +1 -1
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +1 -1
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +309 -0
- package/lib/module/components/Pressable/Pressable.js.map +1 -0
- package/lib/module/components/Pressable/PressableProps.js +2 -0
- package/lib/module/components/Pressable/PressableProps.js.map +1 -0
- package/lib/module/components/Pressable/index.js +3 -0
- package/lib/module/components/Pressable/index.js.map +1 -0
- package/lib/module/components/Pressable/utils.js +120 -0
- package/lib/module/components/Pressable/utils.js.map +1 -0
- package/lib/module/components/ReanimatedSwipeable.js +293 -0
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -0
- package/lib/module/components/Swipeable.js +3 -3
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +4 -4
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchableProps.js +2 -0
- package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -0
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedbackProps.js +2 -0
- package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -0
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +2 -2
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js +3 -4
- package/lib/module/ghQueueMicrotask.js.map +1 -1
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/module/handlers/GestureHandlerEventPayload.js +2 -0
- package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +6 -5
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/createNativeWrapper.js +3 -3
- package/lib/module/handlers/createNativeWrapper.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +0 -72
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +4 -4
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +18 -28
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +5 -5
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +6 -6
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureComposition.js +5 -5
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/handlers/getNextHandlerTag.js +5 -0
- package/lib/module/handlers/getNextHandlerTag.js.map +1 -0
- package/lib/module/handlers/handlersRegistry.js +0 -4
- package/lib/module/handlers/handlersRegistry.js.map +1 -1
- package/lib/module/handlers/utils.js +73 -0
- package/lib/module/handlers/utils.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/init.js +1 -1
- package/lib/module/init.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js +2 -2
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mocks.js +2 -2
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/utils.js +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/Gestures.js +1 -1
- package/lib/module/web/Gestures.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +4 -4
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +6 -11
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/EventManager.js +2 -2
- package/lib/module/web/tools/EventManager.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +4 -11
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/LeastSquareSolver.js +18 -18
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +2 -2
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +1 -1
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +4 -4
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +6 -6
- package/lib/module/web/tools/VelocityTracker.js.map +1 -1
- package/lib/module/web_hammer/NodeManager.js +1 -1
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
- package/lib/typescript/components/GestureButtons.d.ts +2 -85
- package/lib/typescript/components/GestureButtonsProps.d.ts +99 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +1 -1
- package/lib/typescript/components/Pressable/Pressable.d.ts +3 -0
- package/lib/typescript/components/Pressable/PressableProps.d.ts +116 -0
- package/lib/typescript/components/Pressable/index.d.ts +2 -0
- package/lib/typescript/components/Pressable/utils.d.ts +15 -0
- package/lib/typescript/components/ReanimatedSwipeable.d.ts +125 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +4 -16
- package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +14 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +2 -9
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +9 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +2 -1
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +2 -6
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +1 -10
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +159 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +2 -35
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +2 -6
- package/lib/typescript/handlers/PanGestureHandler.d.ts +3 -51
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +2 -23
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +2 -23
- package/lib/typescript/handlers/TapGestureHandler.d.ts +2 -6
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -5
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +10 -9
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +1 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +2 -1
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +2 -8
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +2 -1
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +2 -1
- package/lib/typescript/handlers/gestures/panGesture.d.ts +2 -1
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +2 -1
- package/lib/typescript/handlers/getNextHandlerTag.d.ts +1 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +1 -2
- package/lib/typescript/handlers/utils.d.ts +6 -0
- package/lib/typescript/index.d.ts +12 -9
- package/lib/typescript/jestUtils/jestUtils.d.ts +9 -7
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/NodeManager.d.ts +4 -5
- package/package.json +14 -16
- package/src/Directions.ts +2 -2
- package/src/RNGestureHandlerModule.web.ts +2 -2
- package/src/components/DrawerLayout.tsx +7 -9
- package/src/components/GestureButtons.tsx +13 -123
- package/src/components/GestureButtonsProps.ts +115 -0
- package/src/components/GestureComponents.tsx +1 -1
- package/src/components/GestureHandlerButton.tsx +1 -1
- package/src/components/GestureHandlerRootView.android.tsx +1 -1
- package/src/components/GestureHandlerRootView.tsx +1 -1
- package/src/components/Pressable/Pressable.tsx +398 -0
- package/src/components/Pressable/PressableProps.tsx +149 -0
- package/src/components/Pressable/index.ts +2 -0
- package/src/components/Pressable/utils.ts +180 -0
- package/src/components/ReanimatedSwipeable.tsx +629 -0
- package/src/components/Swipeable.tsx +6 -6
- package/src/components/touchables/GenericTouchable.tsx +9 -36
- package/src/components/touchables/GenericTouchableProps.ts +26 -0
- package/src/components/touchables/TouchableHighlight.tsx +2 -4
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +7 -17
- package/src/components/touchables/TouchableNativeFeedbackProps.tsx +12 -0
- package/src/components/touchables/TouchableOpacity.tsx +3 -5
- package/src/components/touchables/TouchableWithoutFeedback.tsx +2 -1
- package/src/getShadowNodeFromRef.ts +2 -2
- package/src/ghQueueMicrotask.ts +7 -4
- package/src/handlers/FlingGestureHandler.ts +1 -6
- package/src/handlers/ForceTouchGestureHandler.ts +1 -12
- package/src/handlers/GestureHandlerEventPayload.ts +184 -0
- package/src/handlers/LongPressGestureHandler.ts +1 -40
- package/src/handlers/NativeViewGestureHandler.ts +1 -7
- package/src/handlers/PanGestureHandler.ts +1 -58
- package/src/handlers/PinchGestureHandler.ts +1 -27
- package/src/handlers/RotationGestureHandler.ts +1 -27
- package/src/handlers/TapGestureHandler.ts +1 -6
- package/src/handlers/createHandler.tsx +6 -11
- package/src/handlers/createNativeWrapper.tsx +3 -3
- package/src/handlers/gestureHandlerCommon.ts +3 -79
- package/src/handlers/gestureHandlerTypesCompat.ts +16 -30
- package/src/handlers/gestures/GestureDetector/Wrap.tsx +1 -1
- package/src/handlers/gestures/GestureDetector/attachHandlers.ts +4 -7
- package/src/handlers/gestures/GestureDetector/dropHandlers.ts +1 -1
- package/src/handlers/gestures/GestureDetector/index.tsx +1 -1
- package/src/handlers/gestures/GestureDetector/updateHandlers.ts +20 -30
- package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +1 -1
- package/src/handlers/gestures/GestureDetector/utils.ts +5 -5
- package/src/handlers/gestures/flingGesture.ts +2 -4
- package/src/handlers/gestures/forceTouchGesture.ts +2 -4
- package/src/handlers/gestures/gesture.ts +17 -15
- package/src/handlers/gestures/gestureComposition.ts +5 -5
- package/src/handlers/gestures/gestureStateManager.ts +1 -1
- package/src/handlers/gestures/longPressGesture.ts +2 -4
- package/src/handlers/gestures/nativeGesture.ts +2 -4
- package/src/handlers/gestures/panGesture.ts +2 -4
- package/src/handlers/gestures/pinchGesture.ts +1 -1
- package/src/handlers/gestures/rotationGesture.ts +1 -1
- package/src/handlers/gestures/tapGesture.ts +2 -4
- package/src/handlers/getNextHandlerTag.ts +5 -0
- package/src/handlers/handlersRegistry.ts +0 -6
- package/src/handlers/utils.ts +75 -0
- package/src/index.ts +25 -36
- package/src/init.ts +1 -1
- package/src/jestUtils/jestUtils.ts +12 -10
- package/src/mocks.ts +2 -2
- package/src/utils.ts +1 -1
- package/src/web/Gestures.ts +1 -1
- package/src/web/detectors/RotationGestureDetector.ts +1 -1
- package/src/web/detectors/ScaleGestureDetector.ts +4 -4
- package/src/web/handlers/FlingGestureHandler.ts +1 -1
- package/src/web/handlers/GestureHandler.ts +8 -14
- package/src/web/handlers/NativeViewGestureHandler.ts +3 -3
- package/src/web/handlers/PanGestureHandler.ts +1 -1
- package/src/web/handlers/TapGestureHandler.ts +1 -1
- package/src/web/tools/EventManager.ts +2 -2
- package/src/web/tools/GestureHandlerWebDelegate.ts +3 -8
- package/src/web/tools/LeastSquareSolver.ts +18 -18
- package/src/web/tools/PointerEventManager.ts +2 -2
- package/src/web/tools/PointerTracker.ts +2 -1
- package/src/web/tools/TouchEventManager.ts +4 -4
- package/src/web/tools/VelocityTracker.ts +6 -6
- package/src/web_hammer/NodeManager.ts +2 -11
|
@@ -29,8 +29,8 @@ export class ComposedGesture extends Gesture {
|
|
|
29
29
|
if (gesture instanceof BaseGesture) {
|
|
30
30
|
const newConfig = { ...gesture.config };
|
|
31
31
|
|
|
32
|
-
//
|
|
33
|
-
//
|
|
32
|
+
// No need to extend `blocksHandlers` here, because it's not changed in composition.
|
|
33
|
+
// The same effect is achieved by reversing the order of 2 gestures in `Exclusive`
|
|
34
34
|
newConfig.simultaneousWith = extendRelation(
|
|
35
35
|
newConfig.simultaneousWith,
|
|
36
36
|
simultaneousGestures
|
|
@@ -71,7 +71,7 @@ export class ComposedGesture extends Gesture {
|
|
|
71
71
|
|
|
72
72
|
export class SimultaneousGesture extends ComposedGesture {
|
|
73
73
|
prepare() {
|
|
74
|
-
//
|
|
74
|
+
// This piece of magic works something like this:
|
|
75
75
|
// for every gesture in the array
|
|
76
76
|
const simultaneousArrays = this.gestures.map((gesture) =>
|
|
77
77
|
// we take the array it's in
|
|
@@ -97,7 +97,7 @@ export class SimultaneousGesture extends ComposedGesture {
|
|
|
97
97
|
|
|
98
98
|
export class ExclusiveGesture extends ComposedGesture {
|
|
99
99
|
prepare() {
|
|
100
|
-
//
|
|
100
|
+
// Transforms the array of gestures into array of grouped raw (not composed) gestures
|
|
101
101
|
// i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]
|
|
102
102
|
const gestureArrays = this.gestures.map((gesture) =>
|
|
103
103
|
gesture.toGestureArray()
|
|
@@ -112,7 +112,7 @@ export class ExclusiveGesture extends ComposedGesture {
|
|
|
112
112
|
this.requireGesturesToFail.concat(requireToFail)
|
|
113
113
|
);
|
|
114
114
|
|
|
115
|
-
//
|
|
115
|
+
// Every group gets to wait for all groups before it
|
|
116
116
|
requireToFail = requireToFail.concat(gestureArrays[i]);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -13,7 +13,7 @@ const warningMessage = tagMessage(
|
|
|
13
13
|
'react-native-reanimated is required in order to use synchronous state management'
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// Check if reanimated module is available, but look for useSharedValue as conditional
|
|
17
17
|
// require of reanimated can sometimes return content of `utils.ts` file (?)
|
|
18
18
|
const REANIMATED_AVAILABLE = Reanimated?.useSharedValue !== undefined;
|
|
19
19
|
const setGestureState = Reanimated?.setGestureState;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseGesture, BaseGestureConfig } from './gesture';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
LongPressGestureHandlerEventPayload,
|
|
5
|
-
} from '../LongPressGestureHandler';
|
|
2
|
+
import { LongPressGestureConfig } from '../LongPressGestureHandler';
|
|
3
|
+
import type { LongPressGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
|
|
6
4
|
|
|
7
5
|
export class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {
|
|
8
6
|
public config: BaseGestureConfig & LongPressGestureConfig = {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseGestureConfig, BaseGesture } from './gesture';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
NativeViewGestureHandlerPayload,
|
|
5
|
-
} from '../NativeViewGestureHandler';
|
|
2
|
+
import { NativeViewGestureConfig } from '../NativeViewGestureHandler';
|
|
3
|
+
import type { NativeViewGestureHandlerPayload } from '../GestureHandlerEventPayload';
|
|
6
4
|
|
|
7
5
|
export class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {
|
|
8
6
|
public config: BaseGestureConfig & NativeViewGestureConfig = {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
|
|
2
2
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
PanGestureHandlerEventPayload,
|
|
6
|
-
} from '../PanGestureHandler';
|
|
3
|
+
import { PanGestureConfig } from '../PanGestureHandler';
|
|
4
|
+
import type { PanGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
|
|
7
5
|
|
|
8
6
|
export type PanGestureChangeEventPayload = {
|
|
9
7
|
changeX: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContinousBaseGesture } from './gesture';
|
|
2
|
-
import { PinchGestureHandlerEventPayload } from '../
|
|
2
|
+
import type { PinchGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
|
|
3
3
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
4
4
|
|
|
5
5
|
export type PinchGestureChangeEventPayload = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContinousBaseGesture } from './gesture';
|
|
2
|
-
import { RotationGestureHandlerEventPayload } from '../
|
|
2
|
+
import type { RotationGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
|
|
3
3
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
4
4
|
|
|
5
5
|
type RotationGestureChangeEventPayload = {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseGestureConfig, BaseGesture } from './gesture';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
TapGestureHandlerEventPayload,
|
|
5
|
-
} from '../TapGestureHandler';
|
|
2
|
+
import { TapGestureConfig } from '../TapGestureHandler';
|
|
3
|
+
import type { TapGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
|
|
6
4
|
|
|
7
5
|
export class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
|
|
8
6
|
public config: BaseGestureConfig & TapGestureConfig = {};
|
|
@@ -7,12 +7,6 @@ const gestures = new Map<number, GestureType>();
|
|
|
7
7
|
const oldHandlers = new Map<number, GestureHandlerCallbacks>();
|
|
8
8
|
const testIDs = new Map<string, number>();
|
|
9
9
|
|
|
10
|
-
let handlerTag = 1;
|
|
11
|
-
|
|
12
|
-
export function getNextHandlerTag(): number {
|
|
13
|
-
return handlerTag++;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
10
|
export function registerHandler(
|
|
17
11
|
handlerTag: number,
|
|
18
12
|
handler: GestureType,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';
|
|
3
|
+
import { handlerIDToTag } from './handlersRegistry';
|
|
4
|
+
import { toArray } from '../utils';
|
|
5
|
+
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
6
|
+
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
7
|
+
|
|
8
|
+
function isConfigParam(param: unknown, name: string) {
|
|
9
|
+
// param !== Object(param) returns false if `param` is a function
|
|
10
|
+
// or an object and returns true if `param` is null
|
|
11
|
+
return (
|
|
12
|
+
param !== undefined &&
|
|
13
|
+
(param !== Object(param) ||
|
|
14
|
+
!('__isNative' in (param as Record<string, unknown>))) &&
|
|
15
|
+
name !== 'onHandlerStateChange' &&
|
|
16
|
+
name !== 'onGestureEvent'
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function filterConfig(
|
|
21
|
+
props: Record<string, unknown>,
|
|
22
|
+
validProps: string[],
|
|
23
|
+
defaults: Record<string, unknown> = {}
|
|
24
|
+
) {
|
|
25
|
+
const filteredConfig = { ...defaults };
|
|
26
|
+
for (const key of validProps) {
|
|
27
|
+
let value = props[key];
|
|
28
|
+
if (isConfigParam(value, key)) {
|
|
29
|
+
if (key === 'simultaneousHandlers' || key === 'waitFor') {
|
|
30
|
+
value = transformIntoHandlerTags(props[key]);
|
|
31
|
+
} else if (key === 'hitSlop' && typeof value !== 'object') {
|
|
32
|
+
value = { top: value, left: value, bottom: value, right: value };
|
|
33
|
+
}
|
|
34
|
+
filteredConfig[key] = value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return filteredConfig;
|
|
38
|
+
}
|
|
39
|
+
function transformIntoHandlerTags(handlerIDs: any) {
|
|
40
|
+
handlerIDs = toArray(handlerIDs);
|
|
41
|
+
|
|
42
|
+
if (Platform.OS === 'web') {
|
|
43
|
+
return handlerIDs
|
|
44
|
+
.map(({ current }: { current: any }) => current)
|
|
45
|
+
.filter((handle: any) => handle);
|
|
46
|
+
}
|
|
47
|
+
// converts handler string IDs into their numeric tags
|
|
48
|
+
return handlerIDs
|
|
49
|
+
.map(
|
|
50
|
+
(handlerID: any) =>
|
|
51
|
+
handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1
|
|
52
|
+
)
|
|
53
|
+
.filter((handlerTag: number) => handlerTag > 0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function findNodeHandle(
|
|
57
|
+
node: null | number | React.Component<any, any> | React.ComponentClass<any>
|
|
58
|
+
): null | number | React.Component<any, any> | React.ComponentClass<any> {
|
|
59
|
+
if (Platform.OS === 'web') {
|
|
60
|
+
return node;
|
|
61
|
+
}
|
|
62
|
+
return findNodeHandleRN(node);
|
|
63
|
+
}
|
|
64
|
+
let flushOperationsScheduled = false;
|
|
65
|
+
|
|
66
|
+
export function scheduleFlushOperations() {
|
|
67
|
+
if (!flushOperationsScheduled) {
|
|
68
|
+
flushOperationsScheduled = true;
|
|
69
|
+
ghQueueMicrotask(() => {
|
|
70
|
+
RNGestureHandlerModule.flushOperations();
|
|
71
|
+
|
|
72
|
+
flushOperationsScheduled = false;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,16 +6,16 @@ export { PointerType } from './PointerType';
|
|
|
6
6
|
export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
|
|
7
7
|
export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
|
|
8
8
|
export type {
|
|
9
|
-
//
|
|
9
|
+
// Event types
|
|
10
10
|
GestureEvent,
|
|
11
11
|
HandlerStateChangeEvent,
|
|
12
|
-
//
|
|
12
|
+
// Event payloads types
|
|
13
13
|
GestureEventPayload,
|
|
14
14
|
HandlerStateChangeEventPayload,
|
|
15
|
-
//
|
|
15
|
+
// Pointer events
|
|
16
16
|
GestureTouchEvent,
|
|
17
17
|
TouchData,
|
|
18
|
-
//
|
|
18
|
+
// New api event types
|
|
19
19
|
GestureUpdateEvent,
|
|
20
20
|
GestureStateChangeEvent,
|
|
21
21
|
} from './handlers/gestureHandlerCommon';
|
|
@@ -23,35 +23,24 @@ export { MouseButton } from './handlers/gestureHandlerCommon';
|
|
|
23
23
|
export type { GestureType } from './handlers/gestures/gesture';
|
|
24
24
|
export type {
|
|
25
25
|
TapGestureHandlerEventPayload,
|
|
26
|
-
TapGestureHandlerProps,
|
|
27
|
-
} from './handlers/TapGestureHandler';
|
|
28
|
-
export type {
|
|
29
26
|
ForceTouchGestureHandlerEventPayload,
|
|
30
|
-
ForceTouchGestureHandlerProps,
|
|
31
|
-
} from './handlers/ForceTouchGestureHandler';
|
|
32
|
-
export type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';
|
|
33
|
-
export type {
|
|
34
27
|
LongPressGestureHandlerEventPayload,
|
|
35
|
-
LongPressGestureHandlerProps,
|
|
36
|
-
} from './handlers/LongPressGestureHandler';
|
|
37
|
-
export type {
|
|
38
28
|
PanGestureHandlerEventPayload,
|
|
39
|
-
PanGestureHandlerProps,
|
|
40
|
-
} from './handlers/PanGestureHandler';
|
|
41
|
-
export type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';
|
|
42
|
-
export type {
|
|
43
29
|
PinchGestureHandlerEventPayload,
|
|
44
|
-
PinchGestureHandlerProps,
|
|
45
|
-
} from './handlers/PinchGestureHandler';
|
|
46
|
-
export type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';
|
|
47
|
-
export type {
|
|
48
30
|
RotationGestureHandlerEventPayload,
|
|
49
|
-
|
|
50
|
-
} from './handlers/RotationGestureHandler';
|
|
51
|
-
export type {
|
|
31
|
+
NativeViewGestureHandlerPayload,
|
|
52
32
|
FlingGestureHandlerEventPayload,
|
|
53
|
-
|
|
54
|
-
} from './handlers/
|
|
33
|
+
} from './handlers/GestureHandlerEventPayload';
|
|
34
|
+
export type { TapGestureHandlerProps } from './handlers/TapGestureHandler';
|
|
35
|
+
export type { ForceTouchGestureHandlerProps } from './handlers/ForceTouchGestureHandler';
|
|
36
|
+
export type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';
|
|
37
|
+
export type { LongPressGestureHandlerProps } from './handlers/LongPressGestureHandler';
|
|
38
|
+
export type { PanGestureHandlerProps } from './handlers/PanGestureHandler';
|
|
39
|
+
export type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';
|
|
40
|
+
export type { PinchGestureHandlerProps } from './handlers/PinchGestureHandler';
|
|
41
|
+
export type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';
|
|
42
|
+
export type { RotationGestureHandlerProps } from './handlers/RotationGestureHandler';
|
|
43
|
+
export type { FlingGestureHandlerProps } from './handlers/FlingGestureHandler';
|
|
55
44
|
export { TapGestureHandler } from './handlers/TapGestureHandler';
|
|
56
45
|
export { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';
|
|
57
46
|
export { LongPressGestureHandler } from './handlers/LongPressGestureHandler';
|
|
@@ -60,10 +49,7 @@ export { PinchGestureHandler } from './handlers/PinchGestureHandler';
|
|
|
60
49
|
export { RotationGestureHandler } from './handlers/RotationGestureHandler';
|
|
61
50
|
export { FlingGestureHandler } from './handlers/FlingGestureHandler';
|
|
62
51
|
export { default as createNativeWrapper } from './handlers/createNativeWrapper';
|
|
63
|
-
export type {
|
|
64
|
-
NativeViewGestureHandlerPayload,
|
|
65
|
-
NativeViewGestureHandlerProps,
|
|
66
|
-
} from './handlers/NativeViewGestureHandler';
|
|
52
|
+
export type { NativeViewGestureHandlerProps } from './handlers/NativeViewGestureHandler';
|
|
67
53
|
export { GestureDetector } from './handlers/gestures/GestureDetector';
|
|
68
54
|
export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';
|
|
69
55
|
export type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';
|
|
@@ -89,7 +75,7 @@ export type {
|
|
|
89
75
|
BaseButtonProps,
|
|
90
76
|
RectButtonProps,
|
|
91
77
|
BorderlessButtonProps,
|
|
92
|
-
} from './components/
|
|
78
|
+
} from './components/GestureButtonsProps';
|
|
93
79
|
export {
|
|
94
80
|
RawButton,
|
|
95
81
|
BaseButton,
|
|
@@ -118,10 +104,10 @@ export {
|
|
|
118
104
|
} from './components/GestureComponents';
|
|
119
105
|
export { HoverEffect } from './handlers/gestures/hoverGesture';
|
|
120
106
|
export type {
|
|
121
|
-
//
|
|
107
|
+
// Events
|
|
122
108
|
GestureHandlerGestureEvent,
|
|
123
109
|
GestureHandlerStateChangeEvent,
|
|
124
|
-
//
|
|
110
|
+
// Event payloads
|
|
125
111
|
GestureHandlerGestureEventNativeEvent,
|
|
126
112
|
GestureHandlerStateChangeNativeEvent,
|
|
127
113
|
NativeViewGestureHandlerGestureEvent,
|
|
@@ -140,7 +126,7 @@ export type {
|
|
|
140
126
|
RotationGestureHandlerStateChangeEvent,
|
|
141
127
|
FlingGestureHandlerGestureEvent,
|
|
142
128
|
FlingGestureHandlerStateChangeEvent,
|
|
143
|
-
//
|
|
129
|
+
// Handlers props
|
|
144
130
|
NativeViewGestureHandlerProperties,
|
|
145
131
|
TapGestureHandlerProperties,
|
|
146
132
|
LongPressGestureHandlerProperties,
|
|
@@ -149,7 +135,7 @@ export type {
|
|
|
149
135
|
RotationGestureHandlerProperties,
|
|
150
136
|
FlingGestureHandlerProperties,
|
|
151
137
|
ForceTouchGestureHandlerProperties,
|
|
152
|
-
//
|
|
138
|
+
// Buttons props
|
|
153
139
|
RawButtonProperties,
|
|
154
140
|
BaseButtonProperties,
|
|
155
141
|
RectButtonProperties,
|
|
@@ -158,6 +144,9 @@ export type {
|
|
|
158
144
|
|
|
159
145
|
export type { SwipeableProps } from './components/Swipeable';
|
|
160
146
|
export { default as Swipeable } from './components/Swipeable';
|
|
147
|
+
export type { PressableProps } from './components/Pressable';
|
|
148
|
+
export { default as Pressable } from './components/Pressable';
|
|
149
|
+
|
|
161
150
|
export type {
|
|
162
151
|
DrawerLayoutProps,
|
|
163
152
|
DrawerPosition,
|
package/src/init.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function initialize() {
|
|
|
8
8
|
startListening();
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// Since isFabric() may give wrong results before the first render, we call this
|
|
12
12
|
// method during render of GestureHandlerRootView
|
|
13
13
|
export function maybeInitializeFabric() {
|
|
14
14
|
if (isFabric() && !fabricInitialized) {
|
|
@@ -3,12 +3,10 @@ import { DeviceEventEmitter } from 'react-native';
|
|
|
3
3
|
import { ReactTestInstance } from 'react-test-renderer';
|
|
4
4
|
import {
|
|
5
5
|
FlingGestureHandler,
|
|
6
|
-
FlingGestureHandlerEventPayload,
|
|
7
6
|
flingHandlerName,
|
|
8
7
|
} from '../handlers/FlingGestureHandler';
|
|
9
8
|
import {
|
|
10
9
|
ForceTouchGestureHandler,
|
|
11
|
-
ForceTouchGestureHandlerEventPayload,
|
|
12
10
|
forceTouchHandlerName,
|
|
13
11
|
} from '../handlers/ForceTouchGestureHandler';
|
|
14
12
|
import {
|
|
@@ -28,38 +26,42 @@ import { TapGesture } from '../handlers/gestures/tapGesture';
|
|
|
28
26
|
import { findHandlerByTestID } from '../handlers/handlersRegistry';
|
|
29
27
|
import {
|
|
30
28
|
LongPressGestureHandler,
|
|
31
|
-
LongPressGestureHandlerEventPayload,
|
|
32
29
|
longPressHandlerName,
|
|
33
30
|
} from '../handlers/LongPressGestureHandler';
|
|
31
|
+
import type {
|
|
32
|
+
FlingGestureHandlerEventPayload,
|
|
33
|
+
ForceTouchGestureHandlerEventPayload,
|
|
34
|
+
LongPressGestureHandlerEventPayload,
|
|
35
|
+
NativeViewGestureHandlerPayload,
|
|
36
|
+
PanGestureHandlerEventPayload,
|
|
37
|
+
PinchGestureHandlerEventPayload,
|
|
38
|
+
RotationGestureHandlerEventPayload,
|
|
39
|
+
TapGestureHandlerEventPayload,
|
|
40
|
+
} from '../handlers/GestureHandlerEventPayload';
|
|
34
41
|
import {
|
|
35
42
|
NativeViewGestureHandler,
|
|
36
|
-
NativeViewGestureHandlerPayload,
|
|
37
43
|
nativeViewHandlerName,
|
|
38
44
|
} from '../handlers/NativeViewGestureHandler';
|
|
39
45
|
import {
|
|
40
46
|
PanGestureHandler,
|
|
41
|
-
PanGestureHandlerEventPayload,
|
|
42
47
|
panHandlerName,
|
|
43
48
|
} from '../handlers/PanGestureHandler';
|
|
44
49
|
import {
|
|
45
50
|
PinchGestureHandler,
|
|
46
|
-
PinchGestureHandlerEventPayload,
|
|
47
51
|
pinchHandlerName,
|
|
48
52
|
} from '../handlers/PinchGestureHandler';
|
|
49
53
|
import {
|
|
50
54
|
RotationGestureHandler,
|
|
51
|
-
RotationGestureHandlerEventPayload,
|
|
52
55
|
rotationHandlerName,
|
|
53
56
|
} from '../handlers/RotationGestureHandler';
|
|
54
57
|
import {
|
|
55
58
|
TapGestureHandler,
|
|
56
|
-
TapGestureHandlerEventPayload,
|
|
57
59
|
tapHandlerName,
|
|
58
60
|
} from '../handlers/TapGestureHandler';
|
|
59
61
|
import { State } from '../State';
|
|
60
62
|
import { hasProperty, withPrevAndCurrent } from '../utils';
|
|
61
63
|
|
|
62
|
-
//
|
|
64
|
+
// Load fireEvent conditionally, so RNGH may be used in setups without testing-library
|
|
63
65
|
let fireEvent = (
|
|
64
66
|
_element: ReactTestInstance,
|
|
65
67
|
_name: string,
|
|
@@ -72,7 +74,7 @@ try {
|
|
|
72
74
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
73
75
|
fireEvent = require('@testing-library/react-native').fireEvent;
|
|
74
76
|
} catch (_e) {
|
|
75
|
-
//
|
|
77
|
+
// Do nothing if not available
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
type GestureHandlerTestEvent<
|
package/src/mocks.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { State } from './State';
|
|
|
14
14
|
import { Directions } from './Directions';
|
|
15
15
|
|
|
16
16
|
const NOOP = () => {
|
|
17
|
-
//
|
|
17
|
+
// Do nothing
|
|
18
18
|
};
|
|
19
19
|
const PanGestureHandler = View;
|
|
20
20
|
const attachGestureHandler = NOOP;
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
updateGestureHandler,
|
|
64
64
|
flushOperations,
|
|
65
65
|
install,
|
|
66
|
-
//
|
|
66
|
+
// Probably can be removed
|
|
67
67
|
Directions,
|
|
68
68
|
State,
|
|
69
69
|
} as const;
|
package/src/utils.ts
CHANGED
|
@@ -43,7 +43,7 @@ export function tagMessage(msg: string) {
|
|
|
43
43
|
return `[react-native-gesture-handler] ${msg}`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// Helper method to check whether Fabric is enabled, however global.nativeFabricUIManager
|
|
47
47
|
// may not be initialized before the first render
|
|
48
48
|
export function isFabric(): boolean {
|
|
49
49
|
// @ts-expect-error nativeFabricUIManager is not yet included in the RN types
|
package/src/web/Gestures.ts
CHANGED
|
@@ -9,7 +9,7 @@ import NativeViewGestureHandler from './handlers/NativeViewGestureHandler';
|
|
|
9
9
|
import ManualGestureHandler from './handlers/ManualGestureHandler';
|
|
10
10
|
import HoverGestureHandler from './handlers/HoverGestureHandler';
|
|
11
11
|
|
|
12
|
-
//Hammer Handlers
|
|
12
|
+
// Hammer Handlers
|
|
13
13
|
import HammerNativeViewGestureHandler from '../web_hammer/NativeViewGestureHandler';
|
|
14
14
|
import HammerPanGestureHandler from '../web_hammer/PanGestureHandler';
|
|
15
15
|
import HammerTapGestureHandler from '../web_hammer/TapGestureHandler';
|
|
@@ -48,7 +48,7 @@ export default class RotationGestureDetector
|
|
|
48
48
|
this.anchorX = (firstPointerCoords.x + secondPointerCoords.x) / 2;
|
|
49
49
|
this.anchorY = (firstPointerCoords.y + secondPointerCoords.y) / 2;
|
|
50
50
|
|
|
51
|
-
//Angle diff should be positive when rotating in clockwise direction
|
|
51
|
+
// Angle diff should be positive when rotating in clockwise direction
|
|
52
52
|
const angle: number = -Math.atan2(vectorY, vectorX);
|
|
53
53
|
|
|
54
54
|
this.rotation = Number.isNaN(this.previousAngle)
|
|
@@ -72,7 +72,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
|
72
72
|
? event.pointerId
|
|
73
73
|
: undefined;
|
|
74
74
|
|
|
75
|
-
//Determine focal point
|
|
75
|
+
// Determine focal point
|
|
76
76
|
|
|
77
77
|
const div: number = pointerUp ? numOfPointers - 1 : numOfPointers;
|
|
78
78
|
|
|
@@ -81,7 +81,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
|
81
81
|
const focusX = coordsSum.x / div;
|
|
82
82
|
const focusY = coordsSum.y / div;
|
|
83
83
|
|
|
84
|
-
//Determine average deviation from focal point
|
|
84
|
+
// Determine average deviation from focal point
|
|
85
85
|
|
|
86
86
|
let devSumX = 0;
|
|
87
87
|
let devSumY = 0;
|
|
@@ -103,7 +103,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
|
103
103
|
|
|
104
104
|
const span = Math.hypot(spanX, spanY);
|
|
105
105
|
|
|
106
|
-
//Begin/end events
|
|
106
|
+
// Begin/end events
|
|
107
107
|
const wasInProgress: boolean = this.inProgress;
|
|
108
108
|
this.focusX = focusX;
|
|
109
109
|
this.focusY = focusY;
|
|
@@ -128,7 +128,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
|
128
128
|
this.inProgress = this.onScaleBegin(this);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
//Handle motion
|
|
131
|
+
// Handle motion
|
|
132
132
|
if (action !== EventTypes.MOVE) {
|
|
133
133
|
return true;
|
|
134
134
|
}
|
|
@@ -69,7 +69,7 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
69
69
|
const axialDirectionsList = Object.values(Directions);
|
|
70
70
|
const diagonalDirectionsList = Object.values(DiagonalDirections);
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
// List of alignments to all activated directions
|
|
73
73
|
const axialAlignmentList = axialDirectionsList.map((direction) =>
|
|
74
74
|
getAlignment(direction, AXIAL_DEVIATION_COSINE)
|
|
75
75
|
);
|
|
@@ -333,10 +333,10 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
333
333
|
this.tryToSendMoveEvent(true, event);
|
|
334
334
|
}
|
|
335
335
|
protected onPointerMoveOver(_event: AdaptedEvent): void {
|
|
336
|
-
//
|
|
336
|
+
// Used only by hover gesture handler atm
|
|
337
337
|
}
|
|
338
338
|
protected onPointerMoveOut(_event: AdaptedEvent): void {
|
|
339
|
-
//
|
|
339
|
+
// Used only by hover gesture handler atm
|
|
340
340
|
}
|
|
341
341
|
private tryToSendMoveEvent(out: boolean, event: AdaptedEvent): void {
|
|
342
342
|
if ((out && this.shouldCancelWhenOutside) || !this.enabled) {
|
|
@@ -569,7 +569,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
protected transformNativeEvent(): Record<string, unknown> {
|
|
572
|
-
//
|
|
572
|
+
// Those properties are shared by most handlers and if not this method will be overriden
|
|
573
573
|
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
|
574
574
|
const lastRelativeCoords = this.tracker.getRelativeCoordsAverage();
|
|
575
575
|
|
|
@@ -726,15 +726,9 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
726
726
|
const offsetX: number = x - rect.pageX;
|
|
727
727
|
const offsetY: number = y - rect.pageY;
|
|
728
728
|
|
|
729
|
-
|
|
730
|
-
offsetX >= left &&
|
|
731
|
-
|
|
732
|
-
offsetY >= top &&
|
|
733
|
-
offsetY <= bottom
|
|
734
|
-
) {
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
|
-
return false;
|
|
729
|
+
return (
|
|
730
|
+
offsetX >= left && offsetX <= right && offsetY >= top && offsetY <= bottom
|
|
731
|
+
);
|
|
738
732
|
}
|
|
739
733
|
|
|
740
734
|
public isButtonInConfig(mouseButton: MouseButton | undefined) {
|
|
@@ -849,11 +843,11 @@ function invokeNullableMethod(
|
|
|
849
843
|
|
|
850
844
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
851
845
|
if (value?.setValue) {
|
|
852
|
-
//Reanimated API
|
|
846
|
+
// Reanimated API
|
|
853
847
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
854
848
|
value.setValue(nativeValue);
|
|
855
849
|
} else {
|
|
856
|
-
//RN Animated API
|
|
850
|
+
// RN Animated API
|
|
857
851
|
method.__nodeConfig.argMapping[index] = [key, nativeValue];
|
|
858
852
|
}
|
|
859
853
|
}
|
|
@@ -7,8 +7,8 @@ import GestureHandler from './GestureHandler';
|
|
|
7
7
|
export default class NativeViewGestureHandler extends GestureHandler {
|
|
8
8
|
private buttonRole!: boolean;
|
|
9
9
|
|
|
10
|
-
//TODO: Implement logic for activation on start
|
|
11
|
-
|
|
10
|
+
// TODO: Implement logic for activation on start
|
|
11
|
+
// @ts-ignore Logic yet to be implemented
|
|
12
12
|
private shouldActivateOnStart = false;
|
|
13
13
|
private disallowInterruption = false;
|
|
14
14
|
|
|
@@ -28,7 +28,7 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
|
28
28
|
const view = this.delegate.getView() as HTMLElement;
|
|
29
29
|
|
|
30
30
|
view.style['touchAction'] = 'auto';
|
|
31
|
-
|
|
31
|
+
// @ts-ignore Turns on defualt touch behavior on Safari
|
|
32
32
|
view.style['WebkitTouchCallout'] = 'auto';
|
|
33
33
|
|
|
34
34
|
this.buttonRole = view.getAttribute('role') === 'button';
|
|
@@ -210,7 +210,7 @@ export default class PanGestureHandler extends GestureHandler {
|
|
|
210
210
|
clearTimeout(this.activationTimeout);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
//
|
|
213
|
+
// Events Handling
|
|
214
214
|
protected onPointerDown(event: AdaptedEvent): void {
|
|
215
215
|
if (!this.isButtonInConfig(event.button)) {
|
|
216
216
|
return;
|
|
@@ -28,8 +28,8 @@ export default abstract class EventManager<T> {
|
|
|
28
28
|
protected onPointerUp(_event: AdaptedEvent): void {}
|
|
29
29
|
protected onPointerRemove(_event: AdaptedEvent): void {}
|
|
30
30
|
protected onPointerMove(_event: AdaptedEvent): void {}
|
|
31
|
-
protected onPointerLeave(_event: AdaptedEvent): void {} //
|
|
32
|
-
protected onPointerEnter(_event: AdaptedEvent): void {} //
|
|
31
|
+
protected onPointerLeave(_event: AdaptedEvent): void {} // Called only when pointer is pressed (or touching)
|
|
32
|
+
protected onPointerEnter(_event: AdaptedEvent): void {} // Called only when pointer is pressed (or touching)
|
|
33
33
|
protected onPointerCancel(_event: AdaptedEvent): void {
|
|
34
34
|
// When pointer cancel is triggered and there are more pointers on the view, only one pointer is cancelled
|
|
35
35
|
// Because we want all pointers to be cancelled by that event, we are doing it manually by reseting handler and changing activePointersCounter to 0
|
|
@@ -37,16 +37,11 @@ export class GestureHandlerWebDelegate
|
|
|
37
37
|
|
|
38
38
|
this.addContextMenuListeners(config);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.view.style['userSelect'] = 'none';
|
|
43
|
-
} else {
|
|
44
|
-
this.view.style['webkitUserSelect'] = config.userSelect;
|
|
45
|
-
this.view.style['userSelect'] = config.userSelect;
|
|
46
|
-
}
|
|
40
|
+
this.view.style['userSelect'] = config.userSelect ?? 'none';
|
|
41
|
+
this.view.style['webkitUserSelect'] = config.userSelect ?? 'none';
|
|
47
42
|
|
|
48
43
|
this.view.style['touchAction'] = config.touchAction ?? 'none';
|
|
49
|
-
|
|
44
|
+
// @ts-ignore This one disables default events on Safari
|
|
50
45
|
this.view.style['WebkitTouchCallout'] = 'none';
|
|
51
46
|
|
|
52
47
|
this.eventManagers.push(new PointerEventManager(this.view));
|