react-native-gesture-handler 2.22.0 → 2.23.0
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +14 -0
- package/android/src/main/jni/cpp-adapter.cpp +19 -12
- package/apple/RNGestureHandler.mm +15 -8
- package/apple/RNGestureHandlerModule.mm +17 -5
- package/lib/commonjs/ActionType.js +3 -3
- package/lib/commonjs/ActionType.js.map +1 -1
- package/lib/commonjs/Directions.js +11 -8
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/EnableNewWebImplementation.js +2 -10
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
- package/lib/commonjs/GestureHandlerRootViewContext.js +2 -7
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -1
- package/lib/commonjs/PlatformConstants.js +1 -6
- package/lib/commonjs/PlatformConstants.js.map +1 -1
- package/lib/commonjs/PlatformConstants.web.js +1 -3
- package/lib/commonjs/PlatformConstants.web.js.map +1 -1
- package/lib/commonjs/PointerType.js +3 -5
- package/lib/commonjs/PointerType.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.js +2 -6
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +13 -39
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +22 -32
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/RNRenderer.js +1 -3
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.web.js +1 -2
- package/lib/commonjs/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/State.js +4 -3
- package/lib/commonjs/State.js.map +1 -1
- package/lib/commonjs/TouchEventType.js +3 -3
- package/lib/commonjs/TouchEventType.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +96 -115
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureButtons.js +36 -80
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureButtonsProps.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +26 -37
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +13 -27
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js +2 -6
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +4 -12
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js +4 -15
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +4 -14
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js +4 -13
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +46 -78
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -1
- package/lib/commonjs/components/Pressable/index.js +1 -3
- package/lib/commonjs/components/Pressable/index.js.map +1 -1
- package/lib/commonjs/components/Pressable/utils.js +5 -20
- package/lib/commonjs/components/Pressable/utils.js.map +1 -1
- package/lib/commonjs/components/ReanimatedDrawerLayout.js +38 -76
- package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js +133 -98
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +34 -75
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/Text.js +18 -26
- package/lib/commonjs/components/Text.js.map +1 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js +5 -14
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +40 -76
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableHighlight.js +20 -33
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +17 -31
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +5 -4
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js +17 -24
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +12 -13
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/commonjs/components/touchables/index.js +7 -12
- package/lib/commonjs/components/touchables/index.js.map +1 -1
- package/lib/commonjs/findNodeHandle.js +1 -4
- package/lib/commonjs/findNodeHandle.js.map +1 -1
- package/lib/commonjs/findNodeHandle.web.js +9 -10
- package/lib/commonjs/findNodeHandle.web.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.js +1 -6
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.web.js +0 -1
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +13 -14
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +0 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js +1 -2
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/FlingGestureHandler.js +16 -10
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +20 -23
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js +16 -10
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +17 -12
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +20 -31
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PinchGestureHandler.js +14 -8
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -1
- package/lib/commonjs/handlers/RotationGestureHandler.js +14 -8
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +16 -10
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +55 -135
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +33 -32
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +1 -2
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +9 -10
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +5 -14
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +10 -20
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -29
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +1 -10
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +12 -37
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +0 -3
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +12 -24
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +12 -48
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +3 -13
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +2 -9
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +8 -16
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +28 -56
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/commonjs/handlers/gestures/eventReceiver.js +14 -46
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +5 -12
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +8 -19
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +44 -84
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js +17 -31
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +1 -27
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +3 -9
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +2 -7
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +11 -25
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +6 -14
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/manualGesture.js +0 -6
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +5 -12
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +18 -43
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/pinchGesture.js +2 -9
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +1 -8
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestures/rotationGesture.js +2 -9
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +10 -22
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js +0 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -1
- package/lib/commonjs/handlers/handlersRegistry.js +11 -21
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +6 -26
- package/lib/commonjs/handlers/utils.js.map +1 -1
- package/lib/commonjs/index.js +75 -104
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/init.js +4 -11
- package/lib/commonjs/init.js.map +1 -1
- package/lib/commonjs/jestUtils/index.js +4 -5
- package/lib/commonjs/jestUtils/index.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js +19 -83
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mocks.js +5 -15
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/mountRegistry.js +3 -12
- package/lib/commonjs/mountRegistry.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +1 -5
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +2 -7
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +2 -7
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/commonjs/typeUtils.js.map +1 -1
- package/lib/commonjs/utils.js +15 -30
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +5 -23
- package/lib/commonjs/web/Gestures.js.map +1 -1
- package/lib/commonjs/web/constants.js +2 -4
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +26 -62
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +36 -65
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +12 -55
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +160 -273
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +8 -21
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +12 -53
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -11
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +21 -62
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +23 -138
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +19 -56
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +16 -54
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +10 -71
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +9 -17
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +17 -29
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js +7 -41
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +51 -118
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +37 -58
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +21 -40
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/KeyboardEventManager.js +4 -26
- package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/LeastSquareSolver.js +30 -67
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js +9 -16
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +10 -45
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +24 -60
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +3 -18
- package/lib/commonjs/web/tools/Vector.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +10 -32
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
- package/lib/commonjs/web/tools/WheelEventManager.js +4 -17
- package/lib/commonjs/web/tools/WheelEventManager.js.map +1 -1
- package/lib/commonjs/web/utils.js +26 -55
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +7 -19
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +3 -13
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/Errors.js +0 -3
- package/lib/commonjs/web_hammer/Errors.js.map +1 -1
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +13 -44
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js +55 -142
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +2 -11
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +5 -19
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +16 -24
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js +9 -16
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/commonjs/web_hammer/PanGestureHandler.js +8 -49
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +2 -11
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js +15 -43
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +2 -13
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/TapGestureHandler.js +33 -52
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/constants.js +13 -26
- package/lib/commonjs/web_hammer/constants.js.map +1 -1
- package/lib/commonjs/web_hammer/utils.js +4 -14
- package/lib/commonjs/web_hammer/utils.js.map +1 -1
- package/lib/module/ActionType.js +3 -1
- package/lib/module/ActionType.js.map +1 -1
- package/lib/module/Directions.js +9 -3
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +2 -5
- package/lib/module/EnableNewWebImplementation.js.map +1 -1
- package/lib/module/GestureHandlerRootViewContext.js.map +1 -1
- package/lib/module/PlatformConstants.js +0 -1
- package/lib/module/PlatformConstants.js.map +1 -1
- package/lib/module/PlatformConstants.web.js +0 -1
- package/lib/module/PlatformConstants.web.js.map +1 -1
- package/lib/module/PointerType.js +3 -4
- package/lib/module/PointerType.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +1 -0
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +12 -22
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +18 -17
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.web.js.map +1 -1
- package/lib/module/State.js +4 -1
- package/lib/module/State.js.map +1 -1
- package/lib/module/TouchEventType.js +3 -1
- package/lib/module/TouchEventType.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +87 -99
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureButtons.js +27 -55
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureButtonsProps.js.map +1 -1
- package/lib/module/components/GestureComponents.js +17 -12
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +4 -4
- package/lib/module/components/GestureComponents.web.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.web.js +1 -2
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +1 -2
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +1 -2
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.web.js +1 -2
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +44 -61
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/Pressable/PressableProps.js.map +1 -1
- package/lib/module/components/Pressable/index.js.map +1 -1
- package/lib/module/components/Pressable/utils.js +4 -14
- package/lib/module/components/Pressable/utils.js.map +1 -1
- package/lib/module/components/ReanimatedDrawerLayout.js +34 -56
- package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable.js +130 -84
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/module/components/Swipeable.js +28 -59
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/Text.js +14 -13
- package/lib/module/components/Text.js.map +1 -1
- package/lib/module/components/gestureHandlerRootHOC.js +2 -2
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +34 -63
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -1
- package/lib/module/components/touchables/TouchableHighlight.js +16 -23
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +11 -19
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.js +6 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
- package/lib/module/components/touchables/TouchableOpacity.js +13 -14
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +9 -2
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/module/components/touchables/index.js.map +1 -1
- package/lib/module/findNodeHandle.js.map +1 -1
- package/lib/module/findNodeHandle.web.js +9 -8
- package/lib/module/findNodeHandle.web.js.map +1 -1
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.web.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +13 -13
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.web.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js.map +1 -1
- package/lib/module/handlers/FlingGestureHandler.js +13 -0
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js +16 -8
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -1
- package/lib/module/handlers/LongPressGestureHandler.js +13 -0
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/NativeViewGestureHandler.js +13 -0
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/handlers/PanGestureHandler.js +15 -19
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PinchGestureHandler.js +13 -0
- package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -1
- package/lib/module/handlers/RotationGestureHandler.js +13 -0
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js +13 -0
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +54 -108
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/createNativeWrapper.js +28 -22
- package/lib/module/handlers/createNativeWrapper.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +9 -4
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js +3 -4
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +5 -6
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +8 -16
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +0 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +9 -15
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +0 -2
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +11 -14
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +12 -39
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +5 -5
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +2 -6
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +7 -9
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +25 -30
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/module/handlers/gestures/eventReceiver.js +14 -38
- package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +5 -9
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +8 -17
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +44 -73
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureComposition.js +16 -24
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +1 -14
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +3 -4
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +0 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +9 -18
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +6 -11
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/manualGesture.js +0 -4
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +5 -9
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +18 -41
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/pinchGesture.js +2 -7
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +0 -5
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/handlers/gestures/rotationGesture.js +2 -7
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +10 -19
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/handlers/getNextHandlerTag.js.map +1 -1
- package/lib/module/handlers/handlersRegistry.js +6 -8
- package/lib/module/handlers/handlersRegistry.js.map +1 -1
- package/lib/module/handlers/utils.js +4 -13
- package/lib/module/handlers/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/init.js +3 -2
- package/lib/module/init.js.map +1 -1
- package/lib/module/jestUtils/index.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js +20 -66
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mocks.js +3 -7
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/mountRegistry.js +3 -10
- package/lib/module/mountRegistry.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/module/typeUtils.js.map +1 -1
- package/lib/module/utils.js +8 -13
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/Gestures.js +2 -1
- package/lib/module/web/Gestures.js.map +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +26 -59
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +36 -61
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +11 -45
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +159 -259
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +7 -13
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/IGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +11 -46
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -6
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +20 -54
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +22 -129
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +18 -48
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +15 -46
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +9 -63
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +9 -14
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/CircularBuffer.js +17 -27
- package/lib/module/web/tools/CircularBuffer.js.map +1 -1
- package/lib/module/web/tools/EventManager.js +7 -39
- package/lib/module/web/tools/EventManager.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +50 -111
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +36 -47
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +21 -35
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/KeyboardEventManager.js +3 -19
- package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/module/web/tools/LeastSquareSolver.js +30 -65
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js +9 -14
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +9 -35
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +23 -54
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/Vector.js +3 -14
- package/lib/module/web/tools/Vector.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +9 -26
- package/lib/module/web/tools/VelocityTracker.js.map +1 -1
- package/lib/module/web/tools/WheelEventManager.js +3 -10
- package/lib/module/web/tools/WheelEventManager.js.map +1 -1
- package/lib/module/web/utils.js +21 -40
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web_hammer/DiscreteGestureHandler.js +4 -13
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/DraggingGestureHandler.js +0 -5
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/Errors.js +0 -1
- package/lib/module/web_hammer/Errors.js.map +1 -1
- package/lib/module/web_hammer/FlingGestureHandler.js +10 -35
- package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js +53 -130
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +1 -6
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/LongPressGestureHandler.js +2 -11
- package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/NativeViewGestureHandler.js +12 -12
- package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/NodeManager.js +6 -8
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/web_hammer/PanGestureHandler.js +6 -40
- package/lib/module/web_hammer/PanGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PinchGestureHandler.js +0 -5
- package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PressGestureHandler.js +13 -34
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/RotationGestureHandler.js +0 -6
- package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/TapGestureHandler.js +31 -45
- package/lib/module/web_hammer/TapGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/constants.js +2 -1
- package/lib/module/web_hammer/constants.js.map +1 -1
- package/lib/module/web_hammer/utils.js +2 -2
- package/lib/module/web_hammer/utils.js.map +1 -1
- package/lib/typescript/components/DrawerLayout.d.ts +27 -0
- package/lib/typescript/components/GestureButtonsProps.d.ts +18 -2
- package/lib/typescript/components/Pressable/PressableProps.d.ts +3 -10
- package/lib/typescript/components/Pressable/index.d.ts +1 -1
- package/lib/typescript/components/ReanimatedSwipeable.d.ts +6 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +5 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +2 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +5 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +3 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +5 -0
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +6 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/utils.d.ts +1 -1
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +7 -7
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +8 -8
- package/lib/typescript/web/handlers/GestureHandler.d.ts +33 -28
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +12 -13
- package/lib/typescript/web/tools/CircularBuffer.d.ts +3 -3
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -1
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +2 -2
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -2
- package/lib/typescript/web/tools/InteractionManager.d.ts +2 -2
- package/lib/typescript/web/tools/NodeManager.d.ts +1 -1
- package/lib/typescript/web/tools/PointerTracker.d.ts +4 -4
- package/lib/typescript/web/tools/VelocityTracker.d.ts +1 -1
- package/package.json +2 -2
- package/src/RNGestureHandlerModule.web.ts +2 -2
- package/src/components/DrawerLayout.tsx +29 -0
- package/src/components/GestureButtons.tsx +13 -2
- package/src/components/GestureButtonsProps.ts +31 -2
- package/src/components/Pressable/Pressable.tsx +22 -5
- package/src/components/Pressable/PressableProps.tsx +4 -11
- package/src/components/Pressable/index.ts +4 -1
- package/src/components/ReanimatedSwipeable.tsx +194 -113
- package/src/components/Text.tsx +13 -4
- package/src/components/touchables/TouchableHighlight.tsx +5 -0
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -0
- package/src/components/touchables/TouchableNativeFeedback.tsx +6 -1
- package/src/components/touchables/TouchableNativeFeedbackProps.tsx +3 -0
- package/src/components/touchables/TouchableOpacity.tsx +5 -0
- package/src/components/touchables/TouchableWithoutFeedback.tsx +6 -0
- package/src/findNodeHandle.web.ts +6 -0
- package/src/handlers/FlingGestureHandler.ts +10 -0
- package/src/handlers/ForceTouchGestureHandler.ts +9 -0
- package/src/handlers/LongPressGestureHandler.ts +10 -0
- package/src/handlers/NativeViewGestureHandler.ts +10 -0
- package/src/handlers/PanGestureHandler.ts +10 -0
- package/src/handlers/PinchGestureHandler.ts +10 -0
- package/src/handlers/RotationGestureHandler.ts +10 -0
- package/src/handlers/TapGestureHandler.ts +10 -0
- package/src/handlers/createHandler.tsx +11 -4
- package/src/handlers/createNativeWrapper.tsx +10 -4
- package/src/handlers/gestures/GestureDetector/index.tsx +2 -2
- package/src/handlers/gestures/GestureDetector/useViewRefHandler.ts +3 -3
- package/src/handlers/gestures/GestureDetector/utils.ts +2 -2
- package/src/handlers/handlersRegistry.ts +7 -3
- package/src/index.ts +4 -1
- package/src/utils.ts +2 -2
- package/src/web/detectors/RotationGestureDetector.ts +22 -22
- package/src/web/detectors/ScaleGestureDetector.ts +24 -24
- package/src/web/handlers/FlingGestureHandler.ts +6 -7
- package/src/web/handlers/GestureHandler.ts +115 -105
- package/src/web/handlers/HoverGestureHandler.ts +2 -2
- package/src/web/handlers/IGestureHandler.ts +12 -13
- package/src/web/handlers/LongPressGestureHandler.ts +7 -7
- package/src/web/handlers/NativeViewGestureHandler.ts +14 -19
- package/src/web/handlers/PanGestureHandler.ts +17 -17
- package/src/web/handlers/PinchGestureHandler.ts +17 -21
- package/src/web/handlers/RotationGestureHandler.ts +12 -12
- package/src/web/handlers/TapGestureHandler.ts +4 -6
- package/src/web/tools/CircularBuffer.ts +15 -15
- package/src/web/tools/GestureHandlerDelegate.ts +1 -1
- package/src/web/tools/GestureHandlerOrchestrator.ts +42 -42
- package/src/web/tools/GestureHandlerWebDelegate.ts +32 -13
- package/src/web/tools/InteractionManager.ts +16 -16
- package/src/web/tools/NodeManager.ts +2 -2
- package/src/web/tools/PointerTracker.ts +20 -20
- package/src/web/tools/Vector.ts +1 -1
- package/src/web/tools/VelocityTracker.ts +1 -1
@@ -1,8 +1,8 @@
|
|
1
|
-
function _extends() { _extends = Object.assign
|
2
|
-
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
3
2
|
import * as React from 'react';
|
4
3
|
import { useImperativeHandle, useRef } from 'react';
|
5
4
|
import { NativeViewGestureHandler, nativeViewProps } from './NativeViewGestureHandler';
|
5
|
+
|
6
6
|
/*
|
7
7
|
* This array should consist of:
|
8
8
|
* - All keys in propTypes from NativeGestureHandler
|
@@ -10,53 +10,59 @@ import { NativeViewGestureHandler, nativeViewProps } from './NativeViewGestureHa
|
|
10
10
|
* - 'onGestureHandlerEvent'
|
11
11
|
* - 'onGestureHandlerStateChange'
|
12
12
|
*/
|
13
|
-
|
14
13
|
const NATIVE_WRAPPER_PROPS_FILTER = [...nativeViewProps, 'onGestureHandlerEvent', 'onGestureHandlerStateChange'];
|
15
14
|
export default function createNativeWrapper(Component, config = {}) {
|
16
15
|
var _Component$render;
|
17
|
-
|
18
16
|
const ComponentWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
|
19
17
|
// Filter out props that should be passed to gesture handler wrapper
|
20
|
-
const
|
18
|
+
const {
|
19
|
+
gestureHandlerProps,
|
20
|
+
childProps
|
21
|
+
} = Object.keys(props).reduce((res, key) => {
|
21
22
|
// TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
|
22
23
|
const allowedKeys = NATIVE_WRAPPER_PROPS_FILTER;
|
23
|
-
|
24
24
|
if (allowedKeys.includes(key)) {
|
25
25
|
// @ts-ignore FIXME(TS)
|
26
|
-
res[key] = props[key];
|
26
|
+
res.gestureHandlerProps[key] = props[key];
|
27
|
+
} else {
|
28
|
+
// @ts-ignore FIXME(TS)
|
29
|
+
res.childProps[key] = props[key];
|
27
30
|
}
|
28
|
-
|
29
31
|
return res;
|
30
|
-
}, {
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
}, {
|
33
|
+
gestureHandlerProps: {
|
34
|
+
...config
|
35
|
+
},
|
36
|
+
// Watch out not to modify config
|
37
|
+
childProps: {
|
38
|
+
enabled: props.enabled
|
39
|
+
}
|
40
|
+
});
|
34
41
|
const _ref = useRef();
|
35
|
-
|
36
42
|
const _gestureHandlerRef = useRef();
|
37
|
-
|
38
|
-
|
43
|
+
useImperativeHandle(ref,
|
44
|
+
// @ts-ignore TODO(TS) decide how nulls work in this context
|
39
45
|
() => {
|
40
|
-
const node = _gestureHandlerRef.current;
|
41
|
-
|
46
|
+
const node = _gestureHandlerRef.current;
|
47
|
+
// Add handlerTag for relations config
|
42
48
|
if (_ref.current && node) {
|
43
49
|
// @ts-ignore FIXME(TS) think about createHandler return type
|
44
50
|
_ref.current.handlerTag = node.handlerTag;
|
45
51
|
return _ref.current;
|
46
52
|
}
|
47
|
-
|
48
53
|
return null;
|
49
54
|
}, [_ref, _gestureHandlerRef]);
|
50
55
|
return /*#__PURE__*/React.createElement(NativeViewGestureHandler, _extends({}, gestureHandlerProps, {
|
51
56
|
// @ts-ignore TODO(TS)
|
52
57
|
ref: _gestureHandlerRef
|
53
|
-
}), /*#__PURE__*/React.createElement(Component, _extends({},
|
58
|
+
}), /*#__PURE__*/React.createElement(Component, _extends({}, childProps, {
|
54
59
|
ref: _ref
|
55
60
|
})));
|
56
|
-
});
|
61
|
+
});
|
57
62
|
|
58
|
-
|
59
|
-
Component === null || Component === void 0 ? void 0 :
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
64
|
+
ComponentWrapper.displayName = (Component === null || Component === void 0 ? void 0 : Component.displayName) || (// @ts-ignore if render doesn't exist it will return undefined and go further
|
65
|
+
Component === null || Component === void 0 || (_Component$render = Component.render) === null || _Component$render === void 0 ? void 0 : _Component$render.name) || typeof Component === 'string' && Component || 'ComponentWrapper';
|
60
66
|
return ComponentWrapper;
|
61
67
|
}
|
62
68
|
//# sourceMappingURL=createNativeWrapper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React","useImperativeHandle","useRef","NativeViewGestureHandler","nativeViewProps","NATIVE_WRAPPER_PROPS_FILTER","createNativeWrapper","Component","config","_Component$render","ComponentWrapper","forwardRef","props","ref","gestureHandlerProps","childProps","Object","keys","reduce","res","key","allowedKeys","includes","enabled","_ref","_gestureHandlerRef","node","current","handlerTag","createElement","_extends","displayName","render","name"],"sources":["createNativeWrapper.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useImperativeHandle, useRef } from 'react';\n\nimport {\n NativeViewGestureHandler,\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from './NativeViewGestureHandler';\n\n/*\n * This array should consist of:\n * - All keys in propTypes from NativeGestureHandler\n * (and all keys in GestureHandlerPropTypes)\n * - 'onGestureHandlerEvent'\n * - 'onGestureHandlerStateChange'\n */\nconst NATIVE_WRAPPER_PROPS_FILTER = [\n ...nativeViewProps,\n 'onGestureHandlerEvent',\n 'onGestureHandlerStateChange',\n] as const;\n\nexport default function createNativeWrapper<P>(\n Component: React.ComponentType<P>,\n config: Readonly<NativeViewGestureHandlerProps> = {}\n) {\n const ComponentWrapper = React.forwardRef<\n React.ComponentType<any>,\n P & NativeViewGestureHandlerProps\n >((props, ref) => {\n // Filter out props that should be passed to gesture handler wrapper\n const { gestureHandlerProps, childProps } = Object.keys(props).reduce(\n (res, key) => {\n // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info\n const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;\n if (allowedKeys.includes(key)) {\n // @ts-ignore FIXME(TS)\n res.gestureHandlerProps[key] = props[key];\n } else {\n // @ts-ignore FIXME(TS)\n res.childProps[key] = props[key];\n }\n return res;\n },\n {\n gestureHandlerProps: { ...config }, // Watch out not to modify config\n childProps: { enabled: props.enabled } as P,\n }\n );\n const _ref = useRef<React.ComponentType<P>>();\n const _gestureHandlerRef = useRef<React.ComponentType<P>>();\n useImperativeHandle(\n ref,\n // @ts-ignore TODO(TS) decide how nulls work in this context\n () => {\n const node = _gestureHandlerRef.current;\n // Add handlerTag for relations config\n if (_ref.current && node) {\n // @ts-ignore FIXME(TS) think about createHandler return type\n _ref.current.handlerTag = node.handlerTag;\n return _ref.current;\n }\n return null;\n },\n [_ref, _gestureHandlerRef]\n );\n return (\n <NativeViewGestureHandler\n {...gestureHandlerProps}\n // @ts-ignore TODO(TS)\n ref={_gestureHandlerRef}>\n <Component {...childProps} ref={_ref} />\n </NativeViewGestureHandler>\n );\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ComponentWrapper.displayName =\n Component?.displayName ||\n // @ts-ignore if render doesn't exist it will return undefined and go further\n Component?.render?.name ||\n (typeof Component === 'string' && Component) ||\n 'ComponentWrapper';\n\n return ComponentWrapper;\n}\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,mBAAmB,EAAEC,MAAM,QAAQ,OAAO;AAEnD,SACEC,wBAAwB,EAExBC,eAAe,QACV,4BAA4B;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,CAClC,GAAGD,eAAe,EAClB,uBAAuB,EACvB,6BAA6B,CACrB;AAEV,eAAe,SAASE,mBAAmBA,CACzCC,SAAiC,EACjCC,MAA+C,GAAG,CAAC,CAAC,EACpD;EAAA,IAAAC,iBAAA;EACA,MAAMC,gBAAgB,gBAAGV,KAAK,CAACW,UAAU,CAGvC,CAACC,KAAK,EAAEC,GAAG,KAAK;IAChB;IACA,MAAM;MAAEC,mBAAmB;MAAEC;IAAW,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACL,KAAK,CAAC,CAACM,MAAM,CACnE,CAACC,GAAG,EAAEC,GAAG,KAAK;MACZ;MACA,MAAMC,WAA8B,GAAGhB,2BAA2B;MAClE,IAAIgB,WAAW,CAACC,QAAQ,CAACF,GAAG,CAAC,EAAE;QAC7B;QACAD,GAAG,CAACL,mBAAmB,CAACM,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC;MAC3C,CAAC,MAAM;QACL;QACAD,GAAG,CAACJ,UAAU,CAACK,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC;MAClC;MACA,OAAOD,GAAG;IACZ,CAAC,EACD;MACEL,mBAAmB,EAAE;QAAE,GAAGN;MAAO,CAAC;MAAE;MACpCO,UAAU,EAAE;QAAEQ,OAAO,EAAEX,KAAK,CAACW;MAAQ;IACvC,CACF,CAAC;IACD,MAAMC,IAAI,GAAGtB,MAAM,CAAyB,CAAC;IAC7C,MAAMuB,kBAAkB,GAAGvB,MAAM,CAAyB,CAAC;IAC3DD,mBAAmB,CACjBY,GAAG;IACH;IACA,MAAM;MACJ,MAAMa,IAAI,GAAGD,kBAAkB,CAACE,OAAO;MACvC;MACA,IAAIH,IAAI,CAACG,OAAO,IAAID,IAAI,EAAE;QACxB;QACAF,IAAI,CAACG,OAAO,CAACC,UAAU,GAAGF,IAAI,CAACE,UAAU;QACzC,OAAOJ,IAAI,CAACG,OAAO;MACrB;MACA,OAAO,IAAI;IACb,CAAC,EACD,CAACH,IAAI,EAAEC,kBAAkB,CAC3B,CAAC;IACD,oBACEzB,KAAA,CAAA6B,aAAA,CAAC1B,wBAAwB,EAAA2B,QAAA,KACnBhB,mBAAmB;MACvB;MACAD,GAAG,EAAEY;IAAmB,iBACxBzB,KAAA,CAAA6B,aAAA,CAACtB,SAAS,EAAAuB,QAAA,KAAKf,UAAU;MAAEF,GAAG,EAAEW;IAAK,EAAE,CACf,CAAC;EAE/B,CAAC,CAAC;;EAEF;EACAd,gBAAgB,CAACqB,WAAW,GAC1B,CAAAxB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEwB,WAAW,MACtB;EACAxB,SAAS,aAATA,SAAS,gBAAAE,iBAAA,GAATF,SAAS,CAAEyB,MAAM,cAAAvB,iBAAA,uBAAjBA,iBAAA,CAAmBwB,IAAI,KACtB,OAAO1B,SAAS,KAAK,QAAQ,IAAIA,SAAU,IAC5C,kBAAkB;EAEpB,OAAOG,gBAAgB;AACzB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["customDirectEventTypes"],"sources":["customDirectEventTypes.ts"],"sourcesContent":["// @ts-ignore - its taken straight from RN\nexport { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';\n"],"mappings":"AAAA;AACA,SAASA,sBAAsB,QAAQ,qEAAqE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["customDirectEventTypes"],"sources":["customDirectEventTypes.web.ts"],"sourcesContent":["// customDirectEventTypes doesn't exist in react-native-web, therefore importing it\n// directly in createHandler.tsx would end in crash.\nconst customDirectEventTypes = {};\n\nexport { customDirectEventTypes };\n"],"mappings":"AAAA;AACA;AACA,MAAMA,sBAAsB,GAAG,CAAC,CAAC;AAEjC,SAASA,sBAAsB","ignoreList":[]}
|
@@ -2,18 +2,23 @@
|
|
2
2
|
// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof
|
3
3
|
// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.
|
4
4
|
// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.
|
5
|
+
|
5
6
|
const commonProps = ['id', 'enabled', 'shouldCancelWhenOutside', 'hitSlop', 'cancelsTouchesInView', 'userSelect', 'activeCursor', 'mouseButton', 'enableContextMenu', 'touchAction'];
|
6
7
|
const componentInteractionProps = ['waitFor', 'simultaneousHandlers', 'blocksHandlers'];
|
7
8
|
export const baseGestureHandlerProps = [...commonProps, ...componentInteractionProps, 'onBegan', 'onFailed', 'onCancelled', 'onActivated', 'onEnded', 'onGestureEvent', 'onHandlerStateChange'];
|
8
9
|
export const baseGestureHandlerWithDetectorProps = [...commonProps, 'needsPointerData', 'manualActivation'];
|
9
|
-
export let MouseButton
|
10
|
-
|
11
|
-
(function (MouseButton) {
|
10
|
+
export let MouseButton = /*#__PURE__*/function (MouseButton) {
|
12
11
|
MouseButton[MouseButton["LEFT"] = 1] = "LEFT";
|
13
12
|
MouseButton[MouseButton["RIGHT"] = 2] = "RIGHT";
|
14
13
|
MouseButton[MouseButton["MIDDLE"] = 4] = "MIDDLE";
|
15
14
|
MouseButton[MouseButton["BUTTON_4"] = 8] = "BUTTON_4";
|
16
15
|
MouseButton[MouseButton["BUTTON_5"] = 16] = "BUTTON_5";
|
17
16
|
MouseButton[MouseButton["ALL"] = 31] = "ALL";
|
18
|
-
|
17
|
+
return MouseButton;
|
18
|
+
}({});
|
19
|
+
|
20
|
+
// TODO(TS) events in handlers
|
21
|
+
|
22
|
+
// Events payloads are types instead of interfaces due to TS limitation.
|
23
|
+
// See https://github.com/microsoft/TypeScript/issues/15300 for more info.
|
19
24
|
//# sourceMappingURL=gestureHandlerCommon.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["commonProps","componentInteractionProps","baseGestureHandlerProps","baseGestureHandlerWithDetectorProps","MouseButton"],"sources":["gestureHandlerCommon.ts"],"sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\n\nimport { State } from '../State';\nimport { TouchEventType } from '../TouchEventType';\nimport { ValueOf } from '../typeUtils';\nimport { PointerType } from '../PointerType';\n\nconst commonProps = [\n 'id',\n 'enabled',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n 'cancelsTouchesInView',\n 'userSelect',\n 'activeCursor',\n 'mouseButton',\n 'enableContextMenu',\n 'touchAction',\n] as const;\n\nconst componentInteractionProps = [\n 'waitFor',\n 'simultaneousHandlers',\n 'blocksHandlers',\n] as const;\n\nexport const baseGestureHandlerProps = [\n ...commonProps,\n ...componentInteractionProps,\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport const baseGestureHandlerWithDetectorProps = [\n ...commonProps,\n 'needsPointerData',\n 'manualActivation',\n];\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n pointerType: PointerType;\n}\nexport interface HandlerStateChangeEventPayload extends GestureEventPayload {\n oldState: ValueOf<typeof State>;\n}\n\nexport type HitSlop =\n | number\n | null\n | undefined\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n\nexport type UserSelect = 'none' | 'auto' | 'text';\nexport type ActiveCursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'col-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out';\n\nexport enum MouseButton {\n LEFT = 1,\n RIGHT = 2,\n MIDDLE = 4,\n BUTTON_4 = 8,\n BUTTON_5 = 16,\n ALL = 31,\n}\n\nexport type TouchAction =\n | 'auto'\n | 'none'\n | 'pan-x'\n | 'pan-left'\n | 'pan-right'\n | 'pan-y'\n | 'pan-up'\n | 'pan-down'\n | 'pinch-zoom'\n | 'manipulation'\n | 'inherit'\n | 'initial'\n | 'revert'\n | 'revert-layer'\n | 'unset';\n\n// TODO(TS) events in handlers\n\nexport interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {\n nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record<string, unknown>,\n> {\n nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;\n}\n\nexport type TouchData = {\n id: number;\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type GestureTouchEvent = {\n handlerTag: number;\n numberOfTouches: number;\n state: ValueOf<typeof State>;\n eventType: TouchEventType;\n allTouches: TouchData[];\n changedTouches: TouchData[];\n pointerType: PointerType;\n};\n\nexport type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =\n GestureEventPayload & GestureEventPayloadT;\n\nexport type GestureStateChangeEvent<\n GestureStateChangeEventPayloadT = Record<string, unknown>,\n> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;\n\nexport type CommonGestureConfig = {\n enabled?: boolean;\n shouldCancelWhenOutside?: boolean;\n hitSlop?: HitSlop;\n userSelect?: UserSelect;\n activeCursor?: ActiveCursor;\n mouseButton?: MouseButton;\n enableContextMenu?: boolean;\n touchAction?: TouchAction;\n};\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>,\n> = CommonGestureConfig & {\n id?: string;\n waitFor?: React.Ref<unknown> | React.Ref<unknown>[];\n simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n testID?: string;\n cancelsTouchesInView?: boolean;\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n // TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent<ExtraEventPayloadT>\n ) => void;\n // Implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAQA,MAAMA,WAAW,GAAG,CAClB,IAAI,EACJ,SAAS,EACT,yBAAyB,EACzB,SAAS,EACT,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,aAAa,CACL;AAEV,MAAMC,yBAAyB,GAAG,CAChC,SAAS,EACT,sBAAsB,EACtB,gBAAgB,CACR;AAEV,OAAO,MAAMC,uBAAuB,GAAG,CACrC,GAAGF,WAAW,EACd,GAAGC,yBAAyB,EAC5B,SAAS,EACT,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,sBAAsB,CACd;AAEV,OAAO,MAAME,mCAAmC,GAAG,CACjD,GAAGH,WAAW,EACd,kBAAkB,EAClB,kBAAkB,CACnB;AAkED,WAAYI,WAAW,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;;AA0BvB;;AA+CA;AACA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"
|
1
|
+
{"version":3,"names":[],"sources":["gestureHandlerTypesCompat.ts"],"sourcesContent":["import type {\n BaseButtonProps,\n BorderlessButtonProps,\n RawButtonProps,\n RectButtonProps,\n} from '../components/GestureButtonsProps';\nimport {\n GestureEvent,\n GestureEventPayload,\n HandlerStateChangeEvent,\n HandlerStateChangeEventPayload,\n} from './gestureHandlerCommon';\nimport type { FlingGestureHandlerProps } from './FlingGestureHandler';\nimport type {\n FlingGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n TapGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n} from './GestureHandlerEventPayload';\nimport type { ForceTouchGestureHandlerProps } from './ForceTouchGestureHandler';\nimport type { LongPressGestureHandlerProps } from './LongPressGestureHandler';\nimport type { PanGestureHandlerProps } from './PanGestureHandler';\nimport type { PinchGestureHandlerProps } from './PinchGestureHandler';\nimport type { RotationGestureHandlerProps } from './RotationGestureHandler';\nimport type { TapGestureHandlerProps } from './TapGestureHandler';\nimport type { NativeViewGestureHandlerProps } from './NativeViewGestureHandler';\n\n// Events\nexport type GestureHandlerGestureEventNativeEvent = GestureEventPayload;\nexport type GestureHandlerStateChangeNativeEvent =\n HandlerStateChangeEventPayload;\nexport type GestureHandlerGestureEvent = GestureEvent;\nexport type GestureHandlerStateChangeEvent = HandlerStateChangeEvent;\n// Gesture handlers events\nexport type NativeViewGestureHandlerGestureEvent =\n GestureEvent<NativeViewGestureHandlerPayload>;\nexport type NativeViewGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<NativeViewGestureHandlerPayload>;\n\nexport type TapGestureHandlerGestureEvent =\n GestureEvent<TapGestureHandlerEventPayload>;\nexport type TapGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<TapGestureHandlerEventPayload>;\n\nexport type ForceTouchGestureHandlerGestureEvent =\n GestureEvent<ForceTouchGestureHandlerEventPayload>;\nexport type ForceTouchGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<ForceTouchGestureHandlerEventPayload>;\n\nexport type LongPressGestureHandlerGestureEvent =\n GestureEvent<LongPressGestureHandlerEventPayload>;\nexport type LongPressGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<LongPressGestureHandlerEventPayload>;\n\nexport type PanGestureHandlerGestureEvent =\n GestureEvent<PanGestureHandlerEventPayload>;\nexport type PanGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<PanGestureHandlerEventPayload>;\n\nexport type PinchGestureHandlerGestureEvent =\n GestureEvent<PinchGestureHandlerEventPayload>;\nexport type PinchGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<PinchGestureHandlerEventPayload>;\n\nexport type RotationGestureHandlerGestureEvent =\n GestureEvent<RotationGestureHandlerEventPayload>;\nexport type RotationGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<RotationGestureHandlerEventPayload>;\n\nexport type FlingGestureHandlerGestureEvent =\n GestureEvent<FlingGestureHandlerEventPayload>;\nexport type FlingGestureHandlerStateChangeEvent =\n HandlerStateChangeEvent<FlingGestureHandlerEventPayload>;\n\n// Handlers properties\nexport type NativeViewGestureHandlerProperties = NativeViewGestureHandlerProps;\nexport type TapGestureHandlerProperties = TapGestureHandlerProps;\nexport type LongPressGestureHandlerProperties = LongPressGestureHandlerProps;\nexport type PanGestureHandlerProperties = PanGestureHandlerProps;\nexport type PinchGestureHandlerProperties = PinchGestureHandlerProps;\nexport type RotationGestureHandlerProperties = RotationGestureHandlerProps;\nexport type FlingGestureHandlerProperties = FlingGestureHandlerProps;\nexport type ForceTouchGestureHandlerProperties = ForceTouchGestureHandlerProps;\n// Button props\nexport type RawButtonProperties = RawButtonProps;\nexport type BaseButtonProperties = BaseButtonProps;\nexport type RectButtonProperties = RectButtonProps;\nexport type BorderlessButtonProperties = BorderlessButtonProps;\n"],"mappings":"","ignoreList":[]}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
var _Reanimated$default$c, _Reanimated$default;
|
2
|
-
|
3
2
|
import React from 'react';
|
4
3
|
import { Reanimated } from '../reanimatedWrapper';
|
5
4
|
import { tagMessage } from '../../../utils';
|
@@ -14,13 +13,13 @@ export class Wrap extends React.Component {
|
|
14
13
|
const child = React.Children.only(this.props.children);
|
15
14
|
return /*#__PURE__*/React.cloneElement(child, {
|
16
15
|
collapsable: false
|
17
|
-
},
|
16
|
+
},
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
18
18
|
child.props.children);
|
19
19
|
} catch (e) {
|
20
20
|
throw new Error(tagMessage(`GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`));
|
21
21
|
}
|
22
22
|
}
|
23
|
-
|
24
23
|
}
|
25
|
-
export const AnimatedWrap = (_Reanimated$default$c = Reanimated === null || Reanimated === void 0
|
24
|
+
export const AnimatedWrap = (_Reanimated$default$c = Reanimated === null || Reanimated === void 0 || (_Reanimated$default = Reanimated.default) === null || _Reanimated$default === void 0 ? void 0 : _Reanimated$default.createAnimatedComponent(Wrap)) !== null && _Reanimated$default$c !== void 0 ? _Reanimated$default$c : Wrap;
|
26
25
|
//# sourceMappingURL=Wrap.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React","Reanimated","tagMessage","Wrap","Component","render","child","Children","only","props","children","cloneElement","collapsable","e","Error","AnimatedWrap","_Reanimated$default$c","_Reanimated$default","default","createAnimatedComponent"],"sources":["Wrap.tsx"],"sourcesContent":["import React from 'react';\nimport { Reanimated } from '../reanimatedWrapper';\nimport { tagMessage } from '../../../utils';\n\nexport class Wrap extends React.Component<{\n onGestureHandlerEvent?: unknown;\n // Implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n}> {\n render() {\n try {\n // I don't think that fighting with types over such a simple function is worth it\n // The only thing it does is add 'collapsable: false' to the child component\n // to make sure it is in the native view hierarchy so the detector can find\n // correct viewTag to attach to.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const child: any = React.Children.only(this.props.children);\n return React.cloneElement(\n child,\n { collapsable: false },\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n child.props.children\n );\n } catch (e) {\n throw new Error(\n tagMessage(\n `GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\n )\n );\n }\n }\n}\n\nexport const AnimatedWrap =\n Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAE3C,OAAO,MAAMC,IAAI,SAASH,KAAK,CAACI,SAAS,CAItC;EACDC,MAAMA,CAAA,EAAG;IACP,IAAI;MACF;MACA;MACA;MACA;MACA;MACA,MAAMC,KAAU,GAAGN,KAAK,CAACO,QAAQ,CAACC,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,QAAQ,CAAC;MAC3D,oBAAOV,KAAK,CAACW,YAAY,CACvBL,KAAK,EACL;QAAEM,WAAW,EAAE;MAAM,CAAC;MACtB;MACAN,KAAK,CAACG,KAAK,CAACC,QACd,CAAC;IACH,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,MAAM,IAAIC,KAAK,CACbZ,UAAU,CACR,2KACF,CACF,CAAC;IACH;EACF;AACF;AAEA,OAAO,MAAMa,YAAY,IAAAC,qBAAA,GACvBf,UAAU,aAAVA,UAAU,gBAAAgB,mBAAA,GAAVhB,UAAU,CAAEiB,OAAO,cAAAD,mBAAA,uBAAnBA,mBAAA,CAAqBE,uBAAuB,CAAChB,IAAI,CAAC,cAAAa,qBAAA,cAAAA,qBAAA,GAAIb,IAAI","ignoreList":[]}
|
@@ -5,19 +5,17 @@ export const Wrap = /*#__PURE__*/forwardRef(({
|
|
5
5
|
}, ref) => {
|
6
6
|
try {
|
7
7
|
var _Object$getPrototypeO;
|
8
|
-
|
9
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
9
|
const child = React.Children.only(children);
|
11
10
|
const isRNSVGNode = ((_Object$getPrototypeO = Object.getPrototypeOf(child === null || child === void 0 ? void 0 : child.type)) === null || _Object$getPrototypeO === void 0 ? void 0 : _Object$getPrototypeO.name) === 'WebShape';
|
12
|
-
|
13
11
|
if (isRNSVGNode) {
|
14
12
|
const clone = /*#__PURE__*/React.cloneElement(child, {
|
15
13
|
ref
|
16
|
-
},
|
14
|
+
},
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
17
16
|
child.props.children);
|
18
17
|
return clone;
|
19
18
|
}
|
20
|
-
|
21
19
|
return /*#__PURE__*/React.createElement("div", {
|
22
20
|
ref: ref,
|
23
21
|
style: {
|
@@ -27,8 +25,9 @@ export const Wrap = /*#__PURE__*/forwardRef(({
|
|
27
25
|
} catch (e) {
|
28
26
|
throw new Error(tagMessage(`GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`));
|
29
27
|
}
|
30
|
-
});
|
31
|
-
// therefore we can simply export Wrap
|
28
|
+
});
|
32
29
|
|
30
|
+
// On web we never take a path with Reanimated,
|
31
|
+
// therefore we can simply export Wrap
|
33
32
|
export const AnimatedWrap = Wrap;
|
34
33
|
//# sourceMappingURL=Wrap.web.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React","forwardRef","tagMessage","Wrap","children","ref","_Object$getPrototypeO","child","Children","only","isRNSVGNode","Object","getPrototypeOf","type","name","clone","cloneElement","props","createElement","style","display","e","Error","AnimatedWrap"],"sources":["Wrap.web.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport type { LegacyRef, PropsWithChildren } from 'react';\nimport { tagMessage } from '../../../utils';\n\nexport const Wrap = forwardRef<HTMLDivElement, PropsWithChildren<{}>>(\n ({ children }, ref) => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const child: any = React.Children.only(children);\n\n const isRNSVGNode =\n Object.getPrototypeOf(child?.type)?.name === 'WebShape';\n\n if (isRNSVGNode) {\n const clone = React.cloneElement(\n child,\n { ref },\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n child.props.children\n );\n\n return clone;\n }\n\n return (\n <div\n ref={ref as LegacyRef<HTMLDivElement>}\n style={{ display: 'contents' }}>\n {child}\n </div>\n );\n } catch (e) {\n throw new Error(\n tagMessage(\n `GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\n )\n );\n }\n }\n);\n\n// On web we never take a path with Reanimated,\n// therefore we can simply export Wrap\nexport const AnimatedWrap = Wrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,UAAU,QAAQ,gBAAgB;AAE3C,OAAO,MAAMC,IAAI,gBAAGF,UAAU,CAC5B,CAAC;EAAEG;AAAS,CAAC,EAAEC,GAAG,KAAK;EACrB,IAAI;IAAA,IAAAC,qBAAA;IACF;IACA,MAAMC,KAAU,GAAGP,KAAK,CAACQ,QAAQ,CAACC,IAAI,CAACL,QAAQ,CAAC;IAEhD,MAAMM,WAAW,GACf,EAAAJ,qBAAA,GAAAK,MAAM,CAACC,cAAc,CAACL,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEM,IAAI,CAAC,cAAAP,qBAAA,uBAAlCA,qBAAA,CAAoCQ,IAAI,MAAK,UAAU;IAEzD,IAAIJ,WAAW,EAAE;MACf,MAAMK,KAAK,gBAAGf,KAAK,CAACgB,YAAY,CAC9BT,KAAK,EACL;QAAEF;MAAI,CAAC;MACP;MACAE,KAAK,CAACU,KAAK,CAACb,QACd,CAAC;MAED,OAAOW,KAAK;IACd;IAEA,oBACEf,KAAA,CAAAkB,aAAA;MACEb,GAAG,EAAEA,GAAiC;MACtCc,KAAK,EAAE;QAAEC,OAAO,EAAE;MAAW;IAAE,GAC9Bb,KACE,CAAC;EAEV,CAAC,CAAC,OAAOc,CAAC,EAAE;IACV,MAAM,IAAIC,KAAK,CACbpB,UAAU,CACR,2KACF,CACF,CAAC;EACH;AACF,CACF,CAAC;;AAED;AACA;AACA,OAAO,MAAMqB,YAAY,GAAGpB,IAAI","ignoreList":[]}
|
@@ -13,55 +13,47 @@ export function attachHandlers({
|
|
13
13
|
viewTag,
|
14
14
|
webEventHandlersRef
|
15
15
|
}) {
|
16
|
-
gestureConfig.initialize();
|
17
|
-
// when it's ran
|
16
|
+
gestureConfig.initialize();
|
18
17
|
|
18
|
+
// Use queueMicrotask to extract handlerTags, because all refs should be initialized
|
19
|
+
// when it's ran
|
19
20
|
ghQueueMicrotask(() => {
|
20
21
|
if (!preparedGesture.isMounted) {
|
21
22
|
return;
|
22
23
|
}
|
23
|
-
|
24
24
|
gestureConfig.prepare();
|
25
25
|
});
|
26
|
-
|
27
26
|
for (const handler of gesturesToAttach) {
|
28
27
|
checkGestureCallbacksForWorklets(handler);
|
29
28
|
RNGestureHandlerModule.createGestureHandler(handler.handlerName, handler.handlerTag, filterConfig(handler.config, ALLOWED_PROPS));
|
30
29
|
registerHandler(handler.handlerTag, handler, handler.config.testId);
|
31
|
-
}
|
32
|
-
// when it's ran
|
33
|
-
|
30
|
+
}
|
34
31
|
|
32
|
+
// Use queueMicrotask to extract handlerTags, because all refs should be initialized
|
33
|
+
// when it's ran
|
35
34
|
ghQueueMicrotask(() => {
|
36
35
|
if (!preparedGesture.isMounted) {
|
37
36
|
return;
|
38
37
|
}
|
39
|
-
|
40
38
|
for (const handler of gesturesToAttach) {
|
41
39
|
RNGestureHandlerModule.updateGestureHandler(handler.handlerTag, filterConfig(handler.config, ALLOWED_PROPS, extractGestureRelations(handler)));
|
42
40
|
}
|
43
|
-
|
44
41
|
scheduleFlushOperations();
|
45
42
|
});
|
46
|
-
|
47
43
|
for (const gesture of gesturesToAttach) {
|
48
44
|
const actionType = gesture.shouldUseReanimated ? ActionType.REANIMATED_WORKLET : ActionType.JS_FUNCTION_NEW_API;
|
49
|
-
|
50
45
|
if (Platform.OS === 'web') {
|
51
|
-
RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, ActionType.JS_FUNCTION_OLD_API,
|
46
|
+
RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, ActionType.JS_FUNCTION_OLD_API,
|
47
|
+
// Ignored on web
|
52
48
|
webEventHandlersRef);
|
53
49
|
} else {
|
54
50
|
RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, actionType);
|
55
51
|
}
|
56
|
-
|
57
52
|
MountRegistry.gestureWillMount(gesture);
|
58
53
|
}
|
59
|
-
|
60
54
|
preparedGesture.attachedGestures = gesturesToAttach;
|
61
|
-
|
62
55
|
if (preparedGesture.animatedHandlers) {
|
63
56
|
const isAnimatedGesture = g => g.shouldUseReanimated;
|
64
|
-
|
65
57
|
preparedGesture.animatedHandlers.value = gesturesToAttach.filter(isAnimatedGesture).map(g => g.handlers);
|
66
58
|
}
|
67
59
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["registerHandler","RNGestureHandlerModule","filterConfig","scheduleFlushOperations","ActionType","Platform","ghQueueMicrotask","extractGestureRelations","checkGestureCallbacksForWorklets","ALLOWED_PROPS","MountRegistry","attachHandlers","preparedGesture","gestureConfig","gesturesToAttach","viewTag","webEventHandlersRef","initialize","isMounted","prepare","handler","createGestureHandler","handlerName","handlerTag","config","testId","updateGestureHandler","gesture","actionType","shouldUseReanimated","REANIMATED_WORKLET","JS_FUNCTION_NEW_API","OS","attachGestureHandler","JS_FUNCTION_OLD_API","gestureWillMount","attachedGestures","animatedHandlers","isAnimatedGesture","g","value","filter","map","handlers"],"sources":["attachHandlers.ts"],"sourcesContent":["import React from 'react';\nimport { GestureType, HandlerCallbacks } from '../gesture';\nimport { registerHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { filterConfig, scheduleFlushOperations } from '../../utils';\nimport { ComposedGesture } from '../gestureComposition';\nimport { ActionType } from '../../../ActionType';\nimport { Platform } from 'react-native';\nimport type RNGestureHandlerModuleWeb from '../../../RNGestureHandlerModule.web';\nimport { ghQueueMicrotask } from '../../../ghQueueMicrotask';\nimport { AttachedGestureState, WebEventHandler } from './types';\nimport {\n extractGestureRelations,\n checkGestureCallbacksForWorklets,\n ALLOWED_PROPS,\n} from './utils';\nimport { MountRegistry } from '../../../mountRegistry';\n\ninterface AttachHandlersConfig {\n preparedGesture: AttachedGestureState;\n gestureConfig: ComposedGesture | GestureType;\n gesturesToAttach: GestureType[];\n viewTag: number;\n webEventHandlersRef: React.RefObject<WebEventHandler>;\n}\n\nexport function attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n viewTag,\n webEventHandlersRef,\n}: AttachHandlersConfig) {\n gestureConfig.initialize();\n\n // Use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n gestureConfig.prepare();\n });\n\n for (const handler of gesturesToAttach) {\n checkGestureCallbacksForWorklets(handler);\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n // Use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n for (const handler of gesturesToAttach) {\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(\n handler.config,\n ALLOWED_PROPS,\n extractGestureRelations(handler)\n )\n );\n }\n\n scheduleFlushOperations();\n });\n\n for (const gesture of gesturesToAttach) {\n const actionType = gesture.shouldUseReanimated\n ? ActionType.REANIMATED_WORKLET\n : ActionType.JS_FUNCTION_NEW_API;\n\n if (Platform.OS === 'web') {\n (\n RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler\n )(\n gesture.handlerTag,\n viewTag,\n ActionType.JS_FUNCTION_OLD_API, // Ignored on web\n webEventHandlersRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n actionType\n );\n }\n\n MountRegistry.gestureWillMount(gesture);\n }\n\n preparedGesture.attachedGestures = gesturesToAttach;\n\n if (preparedGesture.animatedHandlers) {\n const isAnimatedGesture = (g: GestureType) => g.shouldUseReanimated;\n\n preparedGesture.animatedHandlers.value = gesturesToAttach\n .filter(isAnimatedGesture)\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n }\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,sBAAsB,MAAM,iCAAiC;AACpE,SAASC,YAAY,EAAEC,uBAAuB,QAAQ,aAAa;AAEnE,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,gBAAgB,QAAQ,2BAA2B;AAE5D,SACEC,uBAAuB,EACvBC,gCAAgC,EAChCC,aAAa,QACR,SAAS;AAChB,SAASC,aAAa,QAAQ,wBAAwB;AAUtD,OAAO,SAASC,cAAcA,CAAC;EAC7BC,eAAe;EACfC,aAAa;EACbC,gBAAgB;EAChBC,OAAO;EACPC;AACoB,CAAC,EAAE;EACvBH,aAAa,CAACI,UAAU,CAAC,CAAC;;EAE1B;EACA;EACAX,gBAAgB,CAAC,MAAM;IACrB,IAAI,CAACM,eAAe,CAACM,SAAS,EAAE;MAC9B;IACF;IACAL,aAAa,CAACM,OAAO,CAAC,CAAC;EACzB,CAAC,CAAC;EAEF,KAAK,MAAMC,OAAO,IAAIN,gBAAgB,EAAE;IACtCN,gCAAgC,CAACY,OAAO,CAAC;IACzCnB,sBAAsB,CAACoB,oBAAoB,CACzCD,OAAO,CAACE,WAAW,EACnBF,OAAO,CAACG,UAAU,EAClBrB,YAAY,CAACkB,OAAO,CAACI,MAAM,EAAEf,aAAa,CAC5C,CAAC;IAEDT,eAAe,CAACoB,OAAO,CAACG,UAAU,EAAEH,OAAO,EAAEA,OAAO,CAACI,MAAM,CAACC,MAAM,CAAC;EACrE;;EAEA;EACA;EACAnB,gBAAgB,CAAC,MAAM;IACrB,IAAI,CAACM,eAAe,CAACM,SAAS,EAAE;MAC9B;IACF;IACA,KAAK,MAAME,OAAO,IAAIN,gBAAgB,EAAE;MACtCb,sBAAsB,CAACyB,oBAAoB,CACzCN,OAAO,CAACG,UAAU,EAClBrB,YAAY,CACVkB,OAAO,CAACI,MAAM,EACdf,aAAa,EACbF,uBAAuB,CAACa,OAAO,CACjC,CACF,CAAC;IACH;IAEAjB,uBAAuB,CAAC,CAAC;EAC3B,CAAC,CAAC;EAEF,KAAK,MAAMwB,OAAO,IAAIb,gBAAgB,EAAE;IACtC,MAAMc,UAAU,GAAGD,OAAO,CAACE,mBAAmB,GAC1CzB,UAAU,CAAC0B,kBAAkB,GAC7B1B,UAAU,CAAC2B,mBAAmB;IAElC,IAAI1B,QAAQ,CAAC2B,EAAE,KAAK,KAAK,EAAE;MAEvB/B,sBAAsB,CAACgC,oBAAoB,CAE3CN,OAAO,CAACJ,UAAU,EAClBR,OAAO,EACPX,UAAU,CAAC8B,mBAAmB;MAAE;MAChClB,mBACF,CAAC;IACH,CAAC,MAAM;MACLf,sBAAsB,CAACgC,oBAAoB,CACzCN,OAAO,CAACJ,UAAU,EAClBR,OAAO,EACPa,UACF,CAAC;IACH;IAEAlB,aAAa,CAACyB,gBAAgB,CAACR,OAAO,CAAC;EACzC;EAEAf,eAAe,CAACwB,gBAAgB,GAAGtB,gBAAgB;EAEnD,IAAIF,eAAe,CAACyB,gBAAgB,EAAE;IACpC,MAAMC,iBAAiB,GAAIC,CAAc,IAAKA,CAAC,CAACV,mBAAmB;IAEnEjB,eAAe,CAACyB,gBAAgB,CAACG,KAAK,GAAG1B,gBAAgB,CACtD2B,MAAM,CAACH,iBAAiB,CAAC,CACzBI,GAAG,CAAEH,CAAC,IAAKA,CAAC,CAACI,QAAQ,CAErB;EACL;AACF","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["unregisterHandler","RNGestureHandlerModule","scheduleFlushOperations","MountRegistry","dropHandlers","preparedGesture","handler","attachedGestures","dropGestureHandler","handlerTag","config","testId","gestureWillUnmount"],"sources":["dropHandlers.ts"],"sourcesContent":["import { unregisterHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { scheduleFlushOperations } from '../../utils';\nimport { AttachedGestureState } from './types';\nimport { MountRegistry } from '../../../mountRegistry';\n\nexport function dropHandlers(preparedGesture: AttachedGestureState) {\n for (const handler of preparedGesture.attachedGestures) {\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\n\n unregisterHandler(handler.handlerTag, handler.config.testId);\n\n MountRegistry.gestureWillUnmount(handler);\n }\n\n scheduleFlushOperations();\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,wBAAwB;AAC1D,OAAOC,sBAAsB,MAAM,iCAAiC;AACpE,SAASC,uBAAuB,QAAQ,aAAa;AAErD,SAASC,aAAa,QAAQ,wBAAwB;AAEtD,OAAO,SAASC,YAAYA,CAACC,eAAqC,EAAE;EAClE,KAAK,MAAMC,OAAO,IAAID,eAAe,CAACE,gBAAgB,EAAE;IACtDN,sBAAsB,CAACO,kBAAkB,CAACF,OAAO,CAACG,UAAU,CAAC;IAE7DT,iBAAiB,CAACM,OAAO,CAACG,UAAU,EAAEH,OAAO,CAACI,MAAM,CAACC,MAAM,CAAC;IAE5DR,aAAa,CAACS,kBAAkB,CAACN,OAAO,CAAC;EAC3C;EAEAJ,uBAAuB,CAAC,CAAC;AAC3B","ignoreList":[]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
3
3
|
import { Platform } from 'react-native';
|
4
4
|
import findNodeHandle from '../../../findNodeHandle';
|
5
|
-
import {
|
5
|
+
import { isTestEnv } from '../../../utils';
|
6
6
|
import GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext';
|
7
7
|
import { useAnimatedGesture } from './useAnimatedGesture';
|
8
8
|
import { attachHandlers } from './attachHandlers';
|
@@ -13,24 +13,19 @@ import { Wrap, AnimatedWrap } from './Wrap';
|
|
13
13
|
import { useDetectorUpdater } from './useDetectorUpdater';
|
14
14
|
import { useViewRefHandler } from './useViewRefHandler';
|
15
15
|
import { useMountReactions } from './useMountReactions';
|
16
|
-
|
17
16
|
function propagateDetectorConfig(props, gesture) {
|
18
17
|
const keysToPropagate = ['userSelect', 'enableContextMenu', 'touchAction'];
|
19
|
-
|
20
18
|
for (const key of keysToPropagate) {
|
21
19
|
const value = props[key];
|
22
|
-
|
23
20
|
if (value === undefined) {
|
24
21
|
continue;
|
25
22
|
}
|
26
|
-
|
27
23
|
for (const g of gesture.toGestureArray()) {
|
28
24
|
const config = g.config;
|
29
25
|
config[key] = value;
|
30
26
|
}
|
31
27
|
}
|
32
28
|
}
|
33
|
-
|
34
29
|
/**
|
35
30
|
* `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.
|
36
31
|
*
|
@@ -48,18 +43,17 @@ function propagateDetectorConfig(props, gesture) {
|
|
48
43
|
*/
|
49
44
|
export const GestureDetector = props => {
|
50
45
|
const rootViewContext = useContext(GestureHandlerRootViewContext);
|
51
|
-
|
52
|
-
if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {
|
46
|
+
if (__DEV__ && !rootViewContext && !isTestEnv() && Platform.OS !== 'web') {
|
53
47
|
throw new Error('GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.');
|
54
|
-
}
|
55
|
-
|
48
|
+
}
|
56
49
|
|
50
|
+
// Gesture config should be wrapped with useMemo to prevent unnecessary re-renders
|
57
51
|
const gestureConfig = props.gesture;
|
58
52
|
propagateDetectorConfig(props, gestureConfig);
|
59
53
|
const gesturesToAttach = useMemo(() => gestureConfig.toGestureArray(), [gestureConfig]);
|
60
54
|
const shouldUseReanimated = gesturesToAttach.some(g => g.shouldUseReanimated);
|
61
|
-
const webEventHandlersRef = useWebEventHandlers();
|
62
|
-
|
55
|
+
const webEventHandlersRef = useWebEventHandlers();
|
56
|
+
// Store state in ref to prevent unnecessary renders
|
63
57
|
const state = useRef({
|
64
58
|
firstRender: true,
|
65
59
|
viewRef: null,
|
@@ -74,9 +68,10 @@ export const GestureDetector = props => {
|
|
74
68
|
isMounted: false
|
75
69
|
}).current;
|
76
70
|
const updateAttachedGestures = useDetectorUpdater(state, preparedGesture, gesturesToAttach, gestureConfig, webEventHandlersRef);
|
77
|
-
const refHandler = useViewRefHandler(state, updateAttachedGestures);
|
78
|
-
// config update will be enough as all necessary items are stored in shared values anyway
|
71
|
+
const refHandler = useViewRefHandler(state, updateAttachedGestures);
|
79
72
|
|
73
|
+
// Reanimated event should be rebuilt only when gestures are reattached, otherwise
|
74
|
+
// config update will be enough as all necessary items are stored in shared values anyway
|
80
75
|
const needsToRebuildReanimatedEvent = state.firstRender || state.forceRebuildReanimatedEvent || needsToReattach(preparedGesture, gesturesToAttach);
|
81
76
|
state.forceRebuildReanimatedEvent = false;
|
82
77
|
useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);
|
@@ -103,7 +98,6 @@ export const GestureDetector = props => {
|
|
103
98
|
}
|
104
99
|
}, [props]);
|
105
100
|
useMountReactions(updateAttachedGestures, preparedGesture);
|
106
|
-
|
107
101
|
if (shouldUseReanimated) {
|
108
102
|
return /*#__PURE__*/React.createElement(AnimatedWrap, {
|
109
103
|
ref: refHandler,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","Platform","findNodeHandle","isJestEnv","GestureHandlerRootViewContext","useAnimatedGesture","attachHandlers","needsToReattach","dropHandlers","useWebEventHandlers","Wrap","AnimatedWrap","useDetectorUpdater","useViewRefHandler","useMountReactions","propagateDetectorConfig","props","gesture","keysToPropagate","key","value","undefined","g","toGestureArray","config","GestureDetector","rootViewContext","__DEV__","OS","Error","gestureConfig","gesturesToAttach","shouldUseReanimated","some","webEventHandlersRef","state","firstRender","viewRef","previousViewTag","forceRebuildReanimatedEvent","current","preparedGesture","attachedGestures","animatedEventHandler","animatedHandlers","isMounted","updateAttachedGestures","refHandler","needsToRebuildReanimatedEvent","viewTag","children"],"mappings":"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","sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, {\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { Platform } from 'react-native';\nimport findNodeHandle from '../../../findNodeHandle';\nimport { GestureType } from '../gesture';\nimport { UserSelect, TouchAction } from '../../gestureHandlerCommon';\nimport { ComposedGesture } from '../gestureComposition';\nimport { isJestEnv } from '../../../utils';\n\nimport GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext';\nimport { AttachedGestureState, GestureDetectorState } from './types';\nimport { useAnimatedGesture } from './useAnimatedGesture';\nimport { attachHandlers } from './attachHandlers';\nimport { needsToReattach } from './needsToReattach';\nimport { dropHandlers } from './dropHandlers';\nimport { useWebEventHandlers } from './utils';\nimport { Wrap, AnimatedWrap } from './Wrap';\nimport { useDetectorUpdater } from './useDetectorUpdater';\nimport { useViewRefHandler } from './useViewRefHandler';\nimport { useMountReactions } from './useMountReactions';\n\nfunction propagateDetectorConfig(\n props: GestureDetectorProps,\n gesture: ComposedGesture | GestureType\n) {\n const keysToPropagate: (keyof GestureDetectorProps)[] = [\n 'userSelect',\n 'enableContextMenu',\n 'touchAction',\n ];\n\n for (const key of keysToPropagate) {\n const value = props[key];\n if (value === undefined) {\n continue;\n }\n\n for (const g of gesture.toGestureArray()) {\n const config = g.config as { [key: string]: unknown };\n config[key] = value;\n }\n }\n}\n\ninterface GestureDetectorProps {\n children?: React.ReactNode;\n /**\n * A gesture object containing the configuration and callbacks.\n * Can be any of:\n * - base gestures (`Tap`, `Pan`, ...)\n * - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)\n */\n gesture: ComposedGesture | GestureType;\n /**\n * #### Web only\n * This parameter allows to specify which `userSelect` property should be applied to underlying view.\n * Possible values are `\"none\" | \"auto\" | \"text\"`. Default value is set to `\"none\"`.\n */\n userSelect?: UserSelect;\n /**\n * #### Web only\n * Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.\n * Default value is set to `false`.\n */\n enableContextMenu?: boolean;\n /**\n * #### Web only\n * This parameter allows to specify which `touchAction` property should be applied to underlying view.\n * Supports all CSS touch-action values (e.g. `\"none\"`, `\"pan-y\"`). Default value is set to `\"none\"`.\n */\n touchAction?: TouchAction;\n}\n\n/**\n * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.\n *\n * ### Props\n * - `gesture`\n * - `userSelect` (**Web only**)\n * - `enableContextMenu` (**Web only**)\n * - `touchAction` (**Web only**)\n *\n * ### Remarks\n * - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.\n * - Using the same instance of a gesture across multiple Gesture Detectors is not possible.\n *\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector\n */\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders\n const gestureConfig = props.gesture;\n propagateDetectorConfig(props, gestureConfig);\n\n const gesturesToAttach = useMemo(\n () => gestureConfig.toGestureArray(),\n [gestureConfig]\n );\n const shouldUseReanimated = gesturesToAttach.some(\n (g) => g.shouldUseReanimated\n );\n\n const webEventHandlersRef = useWebEventHandlers();\n // Store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceRebuildReanimatedEvent: false,\n }).current;\n\n const preparedGesture = React.useRef<AttachedGestureState>({\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: shouldUseReanimated,\n isMounted: false,\n }).current;\n\n const updateAttachedGestures = useDetectorUpdater(\n state,\n preparedGesture,\n gesturesToAttach,\n gestureConfig,\n webEventHandlersRef\n );\n\n const refHandler = useViewRefHandler(state, updateAttachedGestures);\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n state.firstRender ||\n state.forceRebuildReanimatedEvent ||\n needsToReattach(preparedGesture, gesturesToAttach);\n state.forceRebuildReanimatedEvent = false;\n\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n\n useLayoutEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n preparedGesture.isMounted = true;\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n webEventHandlersRef,\n viewTag,\n });\n\n return () => {\n preparedGesture.isMounted = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (state.firstRender) {\n state.firstRender = false;\n } else {\n updateAttachedGestures();\n }\n }, [props]);\n\n useMountReactions(updateAttachedGestures, preparedGesture);\n\n if (shouldUseReanimated) {\n return (\n <AnimatedWrap\n ref={refHandler}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refHandler}>{props.children}</Wrap>;\n }\n};\n"]}
|
1
|
+
{"version":3,"names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","Platform","findNodeHandle","isTestEnv","GestureHandlerRootViewContext","useAnimatedGesture","attachHandlers","needsToReattach","dropHandlers","useWebEventHandlers","Wrap","AnimatedWrap","useDetectorUpdater","useViewRefHandler","useMountReactions","propagateDetectorConfig","props","gesture","keysToPropagate","key","value","undefined","g","toGestureArray","config","GestureDetector","rootViewContext","__DEV__","OS","Error","gestureConfig","gesturesToAttach","shouldUseReanimated","some","webEventHandlersRef","state","firstRender","viewRef","previousViewTag","forceRebuildReanimatedEvent","current","preparedGesture","attachedGestures","animatedEventHandler","animatedHandlers","isMounted","updateAttachedGestures","refHandler","needsToRebuildReanimatedEvent","viewTag","createElement","ref","onGestureHandlerEvent","children"],"sources":["index.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, {\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { Platform } from 'react-native';\nimport findNodeHandle from '../../../findNodeHandle';\nimport { GestureType } from '../gesture';\nimport { UserSelect, TouchAction } from '../../gestureHandlerCommon';\nimport { ComposedGesture } from '../gestureComposition';\nimport { isTestEnv } from '../../../utils';\n\nimport GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext';\nimport { AttachedGestureState, GestureDetectorState } from './types';\nimport { useAnimatedGesture } from './useAnimatedGesture';\nimport { attachHandlers } from './attachHandlers';\nimport { needsToReattach } from './needsToReattach';\nimport { dropHandlers } from './dropHandlers';\nimport { useWebEventHandlers } from './utils';\nimport { Wrap, AnimatedWrap } from './Wrap';\nimport { useDetectorUpdater } from './useDetectorUpdater';\nimport { useViewRefHandler } from './useViewRefHandler';\nimport { useMountReactions } from './useMountReactions';\n\nfunction propagateDetectorConfig(\n props: GestureDetectorProps,\n gesture: ComposedGesture | GestureType\n) {\n const keysToPropagate: (keyof GestureDetectorProps)[] = [\n 'userSelect',\n 'enableContextMenu',\n 'touchAction',\n ];\n\n for (const key of keysToPropagate) {\n const value = props[key];\n if (value === undefined) {\n continue;\n }\n\n for (const g of gesture.toGestureArray()) {\n const config = g.config as { [key: string]: unknown };\n config[key] = value;\n }\n }\n}\n\ninterface GestureDetectorProps {\n children?: React.ReactNode;\n /**\n * A gesture object containing the configuration and callbacks.\n * Can be any of:\n * - base gestures (`Tap`, `Pan`, ...)\n * - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)\n */\n gesture: ComposedGesture | GestureType;\n /**\n * #### Web only\n * This parameter allows to specify which `userSelect` property should be applied to underlying view.\n * Possible values are `\"none\" | \"auto\" | \"text\"`. Default value is set to `\"none\"`.\n */\n userSelect?: UserSelect;\n /**\n * #### Web only\n * Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.\n * Default value is set to `false`.\n */\n enableContextMenu?: boolean;\n /**\n * #### Web only\n * This parameter allows to specify which `touchAction` property should be applied to underlying view.\n * Supports all CSS touch-action values (e.g. `\"none\"`, `\"pan-y\"`). Default value is set to `\"none\"`.\n */\n touchAction?: TouchAction;\n}\n\n/**\n * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.\n *\n * ### Props\n * - `gesture`\n * - `userSelect` (**Web only**)\n * - `enableContextMenu` (**Web only**)\n * - `touchAction` (**Web only**)\n *\n * ### Remarks\n * - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.\n * - Using the same instance of a gesture across multiple Gesture Detectors is not possible.\n *\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector\n */\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isTestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders\n const gestureConfig = props.gesture;\n propagateDetectorConfig(props, gestureConfig);\n\n const gesturesToAttach = useMemo(\n () => gestureConfig.toGestureArray(),\n [gestureConfig]\n );\n const shouldUseReanimated = gesturesToAttach.some(\n (g) => g.shouldUseReanimated\n );\n\n const webEventHandlersRef = useWebEventHandlers();\n // Store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceRebuildReanimatedEvent: false,\n }).current;\n\n const preparedGesture = React.useRef<AttachedGestureState>({\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: shouldUseReanimated,\n isMounted: false,\n }).current;\n\n const updateAttachedGestures = useDetectorUpdater(\n state,\n preparedGesture,\n gesturesToAttach,\n gestureConfig,\n webEventHandlersRef\n );\n\n const refHandler = useViewRefHandler(state, updateAttachedGestures);\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n state.firstRender ||\n state.forceRebuildReanimatedEvent ||\n needsToReattach(preparedGesture, gesturesToAttach);\n state.forceRebuildReanimatedEvent = false;\n\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n\n useLayoutEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n preparedGesture.isMounted = true;\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n webEventHandlersRef,\n viewTag,\n });\n\n return () => {\n preparedGesture.isMounted = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (state.firstRender) {\n state.firstRender = false;\n } else {\n updateAttachedGestures();\n }\n }, [props]);\n\n useMountReactions(updateAttachedGestures, preparedGesture);\n\n if (shouldUseReanimated) {\n return (\n <AnimatedWrap\n ref={refHandler}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refHandler}>{props.children}</Wrap>;\n }\n};\n"],"mappings":"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","ignoreList":[]}
|
@@ -6,13 +6,11 @@ export function needsToReattach(preparedGesture, newGestures) {
|
|
6
6
|
if (newGestures.length !== preparedGesture.attachedGestures.length) {
|
7
7
|
return true;
|
8
8
|
}
|
9
|
-
|
10
9
|
for (let i = 0; i < newGestures.length; i++) {
|
11
10
|
if (newGestures[i].handlerName !== preparedGesture.attachedGestures[i].handlerName || newGestures[i].shouldUseReanimated !== preparedGesture.attachedGestures[i].shouldUseReanimated) {
|
12
11
|
return true;
|
13
12
|
}
|
14
13
|
}
|
15
|
-
|
16
14
|
return false;
|
17
15
|
}
|
18
16
|
//# sourceMappingURL=needsToReattach.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["needsToReattach","preparedGesture","newGestures","length","attachedGestures","i","handlerName","shouldUseReanimated"],"sources":["needsToReattach.ts"],"sourcesContent":["import { GestureType } from '../gesture';\nimport { AttachedGestureState } from './types';\n\n// Checks whether the gesture should be reattached to the view, this will happen when:\n// - The number of gestures in the preparedGesture is different than the number of gestures in the gesture\n// - The handlerName is different in any of the gestures\n// - At least one of the gestures changed the thread it runs on\nexport function needsToReattach(\n preparedGesture: AttachedGestureState,\n newGestures: GestureType[]\n) {\n if (newGestures.length !== preparedGesture.attachedGestures.length) {\n return true;\n }\n for (let i = 0; i < newGestures.length; i++) {\n if (\n newGestures[i].handlerName !==\n preparedGesture.attachedGestures[i].handlerName ||\n newGestures[i].shouldUseReanimated !==\n preparedGesture.attachedGestures[i].shouldUseReanimated\n ) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":"AAGA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAC7BC,eAAqC,EACrCC,WAA0B,EAC1B;EACA,IAAIA,WAAW,CAACC,MAAM,KAAKF,eAAe,CAACG,gBAAgB,CAACD,MAAM,EAAE;IAClE,OAAO,IAAI;EACb;EACA,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,WAAW,CAACC,MAAM,EAAEE,CAAC,EAAE,EAAE;IAC3C,IACEH,WAAW,CAACG,CAAC,CAAC,CAACC,WAAW,KACxBL,eAAe,CAACG,gBAAgB,CAACC,CAAC,CAAC,CAACC,WAAW,IACjDJ,WAAW,CAACG,CAAC,CAAC,CAACE,mBAAmB,KAChCN,eAAe,CAACG,gBAAgB,CAACC,CAAC,CAAC,CAACE,mBAAmB,EACzD;MACA,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { GestureType, HandlerCallbacks } from '../gesture';\nimport { SharedValue } from '../reanimatedWrapper';\nimport { HandlerStateChangeEvent } from '../../gestureHandlerCommon';\n\nexport interface AttachedGestureState {\n // Array of gestures that should be attached to the view under that gesture detector\n attachedGestures: GestureType[];\n // Event handler for the gesture, returned by `useEvent` from Reanimated\n animatedEventHandler: unknown;\n // Shared value that's responsible for transferring the callbacks to the UI thread handler\n animatedHandlers: SharedValue<\n HandlerCallbacks<Record<string, unknown>>[] | null\n > | null;\n // Whether `useAnimatedGesture` should be called inside detector\n shouldUseReanimated: boolean;\n // Whether the GestureDetector is mounted\n isMounted: boolean;\n}\n\nexport interface GestureDetectorState {\n firstRender: boolean;\n viewRef: React.Component | null;\n previousViewTag: number;\n forceRebuildReanimatedEvent: boolean;\n}\n\nexport interface WebEventHandler {\n onGestureHandlerEvent: (event: HandlerStateChangeEvent<unknown>) => void;\n onGestureHandlerStateChange?: (\n event: HandlerStateChangeEvent<unknown>\n ) => void;\n}\n"],"mappings":"","ignoreList":[]}
|