react-native-gesture-handler 2.27.1 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNGestureHandler.podspec +3 -2
- package/ReanimatedSwipeable/package.json +4 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +14 -8
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +10 -5
- package/android/src/main/jni/CMakeLists.txt +5 -0
- package/android/src/main/jni/cpp-adapter.cpp +6 -0
- package/apple/RNGestureHandler.h +4 -0
- package/apple/RNGestureHandler.mm +41 -6
- package/apple/RNGestureHandlerModule.mm +5 -0
- package/jestSetup.js +22 -3
- package/lib/commonjs/components/Pressable/Pressable.js +12 -21
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/Pressable/StateMachine.js +8 -2
- package/lib/commonjs/components/Pressable/StateMachine.js.map +1 -1
- package/lib/commonjs/components/Pressable/stateDefinitions.js +22 -23
- package/lib/commonjs/components/Pressable/stateDefinitions.js.map +1 -1
- package/lib/commonjs/components/{ReanimatedSwipeable.js → ReanimatedSwipeable/ReanimatedSwipeable.js} +30 -39
- package/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js.map +1 -0
- package/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js +12 -0
- package/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js.map +1 -0
- package/lib/commonjs/components/ReanimatedSwipeable/index.js +21 -0
- package/lib/commonjs/components/ReanimatedSwipeable/index.js.map +1 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js +4 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +1 -1
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/mocks/Pressable.js +13 -0
- package/lib/commonjs/mocks/Pressable.js.map +1 -0
- package/lib/commonjs/{mocks.js → mocks/mocks.js} +8 -11
- package/lib/commonjs/mocks/mocks.js.map +1 -0
- package/lib/commonjs/web/handlers/GestureHandler.js +5 -2
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +0 -5
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/KeyboardEventManager.js +34 -8
- package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +14 -23
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/Pressable/StateMachine.js +8 -2
- package/lib/module/components/Pressable/StateMachine.js.map +1 -1
- package/lib/module/components/Pressable/stateDefinitions.js +21 -22
- package/lib/module/components/Pressable/stateDefinitions.js.map +1 -1
- package/lib/module/components/{ReanimatedSwipeable.js → ReanimatedSwipeable/ReanimatedSwipeable.js} +24 -33
- package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js.map +1 -0
- package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js +8 -0
- package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js.map +1 -0
- package/lib/module/components/ReanimatedSwipeable/index.js +5 -0
- package/lib/module/components/ReanimatedSwipeable/index.js.map +1 -0
- package/lib/module/components/gestureHandlerRootHOC.js +5 -0
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/module/handlers/createHandler.js +1 -1
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/mocks/Pressable.js +4 -0
- package/lib/module/mocks/Pressable.js.map +1 -0
- package/lib/module/{mocks.js → mocks/mocks.js} +7 -11
- package/lib/module/mocks/mocks.js.map +1 -0
- package/lib/module/web/handlers/GestureHandler.js +5 -2
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +0 -5
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/KeyboardEventManager.js +34 -8
- package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/typescript/ActionType.d.ts +1 -0
- package/lib/typescript/Directions.d.ts +1 -0
- package/lib/typescript/EnableNewWebImplementation.d.ts +1 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +1 -0
- package/lib/typescript/PlatformConstants.d.ts +1 -0
- package/lib/typescript/PlatformConstants.web.d.ts +1 -0
- package/lib/typescript/PointerType.d.ts +1 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +1 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -0
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +1 -0
- package/lib/typescript/RNRenderer.d.ts +1 -0
- package/lib/typescript/RNRenderer.web.d.ts +1 -0
- package/lib/typescript/State.d.ts +1 -0
- package/lib/typescript/TouchEventType.d.ts +1 -0
- package/lib/typescript/components/DrawerLayout.d.ts +1 -0
- package/lib/typescript/components/GestureButtons.d.ts +1 -0
- package/lib/typescript/components/GestureButtonsProps.d.ts +10 -1
- package/lib/typescript/components/GestureButtonsProps.d.ts.map +1 -1
- package/lib/typescript/components/GestureComponents.d.ts +1 -0
- package/lib/typescript/components/GestureComponents.web.d.ts +1 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +1 -0
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +1 -0
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +1 -0
- package/lib/typescript/components/GestureHandlerRootView.d.ts +1 -0
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +1 -0
- package/lib/typescript/components/Pressable/Pressable.d.ts +1 -0
- package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/PressableProps.d.ts +3 -4
- package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/StateMachine.d.ts +4 -2
- package/lib/typescript/components/Pressable/StateMachine.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/index.d.ts +1 -0
- package/lib/typescript/components/Pressable/stateDefinitions.d.ts +3 -2
- package/lib/typescript/components/Pressable/stateDefinitions.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/utils.d.ts +1 -0
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +1 -0
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts +6 -0
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts.map +1 -0
- package/lib/typescript/components/{ReanimatedSwipeable.d.ts → ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts} +10 -7
- package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts.map +1 -0
- package/lib/typescript/components/ReanimatedSwipeable/index.d.ts +3 -0
- package/lib/typescript/components/ReanimatedSwipeable/index.d.ts.map +1 -0
- package/lib/typescript/components/Swipeable.d.ts +1 -0
- package/lib/typescript/components/Text.d.ts +1 -0
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +5 -0
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts.map +1 -1
- package/lib/typescript/components/touchables/ExtraButtonProps.d.ts +1 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -0
- package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +1 -0
- package/lib/typescript/components/touchables/index.d.ts +1 -0
- package/lib/typescript/components/utils.d.ts +1 -0
- package/lib/typescript/findNodeHandle.d.ts +1 -0
- package/lib/typescript/findNodeHandle.web.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
- package/lib/typescript/ghQueueMicrotask.d.ts +1 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +1 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +1 -0
- package/lib/typescript/handlers/createHandler.d.ts +1 -0
- package/lib/typescript/handlers/createNativeWrapper.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +1 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +1 -0
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +1 -0
- package/lib/typescript/handlers/gestures/eventReceiver.d.ts +1 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +1 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +1 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +1 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +1 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +1 -0
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +1 -0
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +1 -0
- package/lib/typescript/handlers/getNextHandlerTag.d.ts +1 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +1 -0
- package/lib/typescript/handlers/utils.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/init.d.ts +1 -0
- package/lib/typescript/jestUtils/index.d.ts +1 -0
- package/lib/typescript/jestUtils/jestUtils.d.ts +1 -0
- package/lib/typescript/mocks/Pressable.d.ts +2 -0
- package/lib/typescript/mocks/Pressable.d.ts.map +1 -0
- package/lib/typescript/{mocks.d.ts → mocks/mocks.d.ts} +5 -4
- package/lib/typescript/mocks/mocks.d.ts.map +1 -0
- package/lib/typescript/mountRegistry.d.ts +1 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +1 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +1 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +1 -0
- package/lib/typescript/typeUtils.d.ts +1 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/lib/typescript/web/Gestures.d.ts +1 -0
- package/lib/typescript/web/constants.d.ts +1 -0
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +1 -0
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +1 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -0
- package/lib/typescript/web/interfaces.d.ts +1 -0
- package/lib/typescript/web/tools/CircularBuffer.d.ts +1 -0
- package/lib/typescript/web/tools/EventManager.d.ts +1 -0
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -0
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +1 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +1 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts.map +1 -1
- package/lib/typescript/web/tools/InteractionManager.d.ts +1 -0
- package/lib/typescript/web/tools/KeyboardEventManager.d.ts +7 -3
- package/lib/typescript/web/tools/KeyboardEventManager.d.ts.map +1 -1
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +1 -0
- package/lib/typescript/web/tools/NodeManager.d.ts +1 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +1 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
- package/lib/typescript/web/tools/Vector.d.ts +1 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +1 -0
- package/lib/typescript/web/tools/WheelEventManager.d.ts +1 -0
- package/lib/typescript/web/utils.d.ts +1 -0
- package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/Errors.d.ts +1 -0
- package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/GestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/NodeManager.d.ts +1 -0
- package/lib/typescript/web_hammer/PanGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/PressGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/TapGestureHandler.d.ts +1 -0
- package/lib/typescript/web_hammer/constants.d.ts +1 -0
- package/lib/typescript/web_hammer/utils.d.ts +1 -0
- package/package.json +4 -3
- package/scripts/gesture_handler_utils.rb +25 -0
- package/src/components/GestureButtonsProps.ts +10 -0
- package/src/components/Pressable/Pressable.tsx +20 -31
- package/src/components/Pressable/PressableProps.tsx +2 -4
- package/src/components/Pressable/StateMachine.tsx +12 -4
- package/src/components/Pressable/stateDefinitions.ts +23 -23
- package/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx +603 -0
- package/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts +199 -0
- package/src/components/ReanimatedSwipeable/index.ts +6 -0
- package/src/components/gestureHandlerRootHOC.tsx +4 -0
- package/src/handlers/createHandler.tsx +1 -1
- package/src/handlers/gestures/GestureDetector/index.tsx +1 -1
- package/src/mocks/Pressable.tsx +1 -0
- package/src/{mocks.tsx → mocks/mocks.tsx} +7 -11
- package/src/web/handlers/GestureHandler.ts +8 -3
- package/src/web/tools/GestureHandlerWebDelegate.ts +0 -5
- package/src/web/tools/KeyboardEventManager.ts +50 -8
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +0 -1
- package/lib/commonjs/mocks.js.map +0 -1
- package/lib/module/components/ReanimatedSwipeable.js.map +0 -1
- package/lib/module/mocks.js.map +0 -1
- package/lib/typescript/ActionType.js +0 -6
- package/lib/typescript/Directions.js +0 -18
- package/lib/typescript/EnableNewWebImplementation.js +0 -30
- package/lib/typescript/GestureHandlerRootViewContext.js +0 -2
- package/lib/typescript/PlatformConstants.js +0 -3
- package/lib/typescript/PlatformConstants.web.js +0 -5
- package/lib/typescript/PointerType.js +0 -8
- package/lib/typescript/RNGestureHandlerModule.js +0 -4
- package/lib/typescript/RNGestureHandlerModule.web.js +0 -92
- package/lib/typescript/RNGestureHandlerModule.windows.js +0 -47
- package/lib/typescript/RNRenderer.js +0 -3
- package/lib/typescript/RNRenderer.web.js +0 -3
- package/lib/typescript/State.js +0 -9
- package/lib/typescript/TouchEventType.js +0 -7
- package/lib/typescript/components/DrawerLayout.js +0 -417
- package/lib/typescript/components/GestureButtons.js +0 -165
- package/lib/typescript/components/GestureButtonsProps.js +0 -1
- package/lib/typescript/components/GestureComponents.js +0 -67
- package/lib/typescript/components/GestureComponents.web.js +0 -21
- package/lib/typescript/components/GestureHandlerButton.js +0 -2
- package/lib/typescript/components/GestureHandlerButton.web.js +0 -3
- package/lib/typescript/components/GestureHandlerRootView.android.js +0 -17
- package/lib/typescript/components/GestureHandlerRootView.js +0 -16
- package/lib/typescript/components/GestureHandlerRootView.web.js +0 -11
- package/lib/typescript/components/Pressable/Pressable.js +0 -231
- package/lib/typescript/components/Pressable/PressableProps.js +0 -1
- package/lib/typescript/components/Pressable/StateMachine.js +0 -34
- package/lib/typescript/components/Pressable/index.js +0 -1
- package/lib/typescript/components/Pressable/stateDefinitions.js +0 -104
- package/lib/typescript/components/Pressable/utils.js +0 -80
- package/lib/typescript/components/ReanimatedDrawerLayout.js +0 -364
- package/lib/typescript/components/ReanimatedSwipeable.d.ts.map +0 -1
- package/lib/typescript/components/ReanimatedSwipeable.js +0 -400
- package/lib/typescript/components/Swipeable.js +0 -287
- package/lib/typescript/components/Text.js +0 -38
- package/lib/typescript/components/gestureHandlerRootHOC.js +0 -18
- package/lib/typescript/components/touchables/ExtraButtonProps.js +0 -1
- package/lib/typescript/components/touchables/GenericTouchable.js +0 -221
- package/lib/typescript/components/touchables/GenericTouchableProps.js +0 -1
- package/lib/typescript/components/touchables/TouchableHighlight.js +0 -75
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.js +0 -65
- package/lib/typescript/components/touchables/TouchableNativeFeedback.js +0 -6
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.js +0 -1
- package/lib/typescript/components/touchables/TouchableOpacity.js +0 -51
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.js +0 -10
- package/lib/typescript/components/touchables/index.js +0 -4
- package/lib/typescript/components/utils.js +0 -11
- package/lib/typescript/findNodeHandle.js +0 -2
- package/lib/typescript/findNodeHandle.web.js +0 -31
- package/lib/typescript/getShadowNodeFromRef.js +0 -45
- package/lib/typescript/getShadowNodeFromRef.web.js +0 -7
- package/lib/typescript/ghQueueMicrotask.js +0 -7
- package/lib/typescript/handlers/FlingGestureHandler.js +0 -19
- package/lib/typescript/handlers/ForceTouchGestureHandler.js +0 -37
- package/lib/typescript/handlers/GestureHandlerEventPayload.js +0 -1
- package/lib/typescript/handlers/LongPressGestureHandler.js +0 -22
- package/lib/typescript/handlers/NativeViewGestureHandler.js +0 -20
- package/lib/typescript/handlers/PanGestureHandler.js +0 -128
- package/lib/typescript/handlers/PinchGestureHandler.js +0 -12
- package/lib/typescript/handlers/PressabilityDebugView.js +0 -2
- package/lib/typescript/handlers/PressabilityDebugView.web.js +0 -4
- package/lib/typescript/handlers/RotationGestureHandler.js +0 -12
- package/lib/typescript/handlers/TapGestureHandler.js +0 -26
- package/lib/typescript/handlers/createHandler.js +0 -375
- package/lib/typescript/handlers/createNativeWrapper.js +0 -67
- package/lib/typescript/handlers/customDirectEventTypes.js +0 -2
- package/lib/typescript/handlers/customDirectEventTypes.web.js +0 -4
- package/lib/typescript/handlers/gestureHandlerCommon.js +0 -42
- package/lib/typescript/handlers/gestureHandlerTypesCompat.js +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.js +0 -22
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.js +0 -24
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.js +0 -55
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.js +0 -12
- package/lib/typescript/handlers/gestures/GestureDetector/index.js +0 -114
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.js +0 -18
- package/lib/typescript/handlers/gestures/GestureDetector/types.js +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.js +0 -54
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.js +0 -137
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.js +0 -48
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.js +0 -35
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.js +0 -32
- package/lib/typescript/handlers/gestures/GestureDetector/utils.js +0 -140
- package/lib/typescript/handlers/gestures/eventReceiver.js +0 -105
- package/lib/typescript/handlers/gestures/flingGesture.js +0 -27
- package/lib/typescript/handlers/gestures/forceTouchGesture.js +0 -57
- package/lib/typescript/handlers/gestures/gesture.js +0 -303
- package/lib/typescript/handlers/gestures/gestureComposition.js +0 -78
- package/lib/typescript/handlers/gestures/gestureObjects.js +0 -125
- package/lib/typescript/handlers/gestures/gestureStateManager.js +0 -60
- package/lib/typescript/handlers/gestures/gestureStateManager.web.js +0 -19
- package/lib/typescript/handlers/gestures/hoverGesture.js +0 -45
- package/lib/typescript/handlers/gestures/longPressGesture.js +0 -35
- package/lib/typescript/handlers/gestures/manualGesture.js +0 -16
- package/lib/typescript/handlers/gestures/nativeGesture.js +0 -24
- package/lib/typescript/handlers/gestures/panGesture.js +0 -181
- package/lib/typescript/handlers/gestures/pinchGesture.js +0 -27
- package/lib/typescript/handlers/gestures/reanimatedWrapper.js +0 -23
- package/lib/typescript/handlers/gestures/rotationGesture.js +0 -27
- package/lib/typescript/handlers/gestures/tapGesture.js +0 -72
- package/lib/typescript/handlers/getNextHandlerTag.js +0 -4
- package/lib/typescript/handlers/handlersRegistry.js +0 -36
- package/lib/typescript/handlers/utils.js +0 -58
- package/lib/typescript/index.js +0 -28
- package/lib/typescript/init.js +0 -15
- package/lib/typescript/jestUtils/index.js +0 -1
- package/lib/typescript/jestUtils/jestUtils.js +0 -290
- package/lib/typescript/mocks.d.ts.map +0 -1
- package/lib/typescript/mocks.js +0 -59
- package/lib/typescript/mountRegistry.js +0 -29
- package/lib/typescript/specs/NativeRNGestureHandlerModule.js +0 -2
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.js +0 -2
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.js +0 -2
- package/lib/typescript/typeUtils.js +0 -1
- package/lib/typescript/utils.js +0 -80
- package/lib/typescript/web/Gestures.js +0 -38
- package/lib/typescript/web/constants.js +0 -2
- package/lib/typescript/web/detectors/RotationGestureDetector.js +0 -122
- package/lib/typescript/web/detectors/ScaleGestureDetector.js +0 -117
- package/lib/typescript/web/handlers/FlingGestureHandler.js +0 -133
- package/lib/typescript/web/handlers/GestureHandler.js +0 -656
- package/lib/typescript/web/handlers/HoverGestureHandler.js +0 -37
- package/lib/typescript/web/handlers/IGestureHandler.js +0 -1
- package/lib/typescript/web/handlers/LongPressGestureHandler.js +0 -136
- package/lib/typescript/web/handlers/ManualGestureHandler.js +0 -29
- package/lib/typescript/web/handlers/NativeViewGestureHandler.js +0 -133
- package/lib/typescript/web/handlers/PanGestureHandler.js +0 -420
- package/lib/typescript/web/handlers/PinchGestureHandler.js +0 -117
- package/lib/typescript/web/handlers/RotationGestureHandler.js +0 -122
- package/lib/typescript/web/handlers/TapGestureHandler.js +0 -202
- package/lib/typescript/web/interfaces.js +0 -25
- package/lib/typescript/web/tools/CircularBuffer.js +0 -37
- package/lib/typescript/web/tools/EventManager.js +0 -85
- package/lib/typescript/web/tools/GestureHandlerDelegate.js +0 -1
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.js +0 -273
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.js +0 -169
- package/lib/typescript/web/tools/InteractionManager.js +0 -91
- package/lib/typescript/web/tools/KeyboardEventManager.js +0 -73
- package/lib/typescript/web/tools/LeastSquareSolver.js +0 -147
- package/lib/typescript/web/tools/NodeManager.js +0 -28
- package/lib/typescript/web/tools/PointerEventManager.js +0 -179
- package/lib/typescript/web/tools/PointerTracker.js +0 -161
- package/lib/typescript/web/tools/Vector.js +0 -43
- package/lib/typescript/web/tools/VelocityTracker.js +0 -76
- package/lib/typescript/web/tools/WheelEventManager.js +0 -40
- package/lib/typescript/web/utils.js +0 -233
- package/lib/typescript/web_hammer/DiscreteGestureHandler.js +0 -48
- package/lib/typescript/web_hammer/DraggingGestureHandler.js +0 -25
- package/lib/typescript/web_hammer/Errors.js +0 -5
- package/lib/typescript/web_hammer/FlingGestureHandler.js +0 -119
- package/lib/typescript/web_hammer/GestureHandler.js +0 -469
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.js +0 -26
- package/lib/typescript/web_hammer/LongPressGestureHandler.js +0 -46
- package/lib/typescript/web_hammer/NativeViewGestureHandler.js +0 -40
- package/lib/typescript/web_hammer/NodeManager.js +0 -28
- package/lib/typescript/web_hammer/PanGestureHandler.js +0 -151
- package/lib/typescript/web_hammer/PinchGestureHandler.js +0 -19
- package/lib/typescript/web_hammer/PressGestureHandler.js +0 -133
- package/lib/typescript/web_hammer/RotationGestureHandler.js +0 -20
- package/lib/typescript/web_hammer/TapGestureHandler.js +0 -142
- package/lib/typescript/web_hammer/constants.js +0 -42
- package/lib/typescript/web_hammer/utils.js +0 -15
- package/src/components/ReanimatedSwipeable.tsx +0 -811
@@ -1,38 +0,0 @@
|
|
1
|
-
import React, { forwardRef, useEffect, useRef, } from 'react';
|
2
|
-
import { Platform, Text as RNText, } from 'react-native';
|
3
|
-
import { GestureObjects as Gesture } from '../handlers/gestures/gestureObjects';
|
4
|
-
import { GestureDetector } from '../handlers/gestures/GestureDetector';
|
5
|
-
export const Text = forwardRef((props, ref) => {
|
6
|
-
const { onPress, onLongPress, ...rest } = props;
|
7
|
-
const textRef = useRef(null);
|
8
|
-
const native = Gesture.Native().runOnJS(true);
|
9
|
-
const refHandler = (node) => {
|
10
|
-
textRef.current = node;
|
11
|
-
if (ref === null) {
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
if (typeof ref === 'function') {
|
15
|
-
ref(node);
|
16
|
-
}
|
17
|
-
else {
|
18
|
-
ref.current = node;
|
19
|
-
}
|
20
|
-
};
|
21
|
-
// This is a special case for `Text` component. After https://github.com/software-mansion/react-native-gesture-handler/pull/3379 we check for
|
22
|
-
// `displayName` field. However, `Text` from RN has this field set to `Text`, but is also present in `RNSVGElements` set.
|
23
|
-
// We don't want to treat our `Text` as the one from `SVG`, therefore we add special field to ref.
|
24
|
-
refHandler.rngh = true;
|
25
|
-
useEffect(() => {
|
26
|
-
if (Platform.OS !== 'web') {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
const textElement = ref
|
30
|
-
? ref.current
|
31
|
-
: textRef.current;
|
32
|
-
// At this point we are sure that textElement is div in HTML tree
|
33
|
-
textElement?.setAttribute('rnghtext', 'true');
|
34
|
-
}, []);
|
35
|
-
return onPress || onLongPress ? (<GestureDetector gesture={native}>
|
36
|
-
<RNText onPress={onPress} onLongPress={onLongPress} ref={refHandler} {...rest}/>
|
37
|
-
</GestureDetector>) : (<RNText ref={ref} {...rest}/>);
|
38
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { StyleSheet } from 'react-native';
|
3
|
-
import hoistNonReactStatics from 'hoist-non-react-statics';
|
4
|
-
import GestureHandlerRootView from './GestureHandlerRootView';
|
5
|
-
export default function gestureHandlerRootHOC(Component, containerStyles) {
|
6
|
-
function Wrapper(props) {
|
7
|
-
return (<GestureHandlerRootView style={[styles.container, containerStyles]}>
|
8
|
-
<Component {...props}/>
|
9
|
-
</GestureHandlerRootView>);
|
10
|
-
}
|
11
|
-
Wrapper.displayName = `gestureHandlerRootHOC(${Component.displayName || Component.name})`;
|
12
|
-
// @ts-ignore - hoistNonReactStatics uses old version of @types/react
|
13
|
-
hoistNonReactStatics(Wrapper, Component);
|
14
|
-
return Wrapper;
|
15
|
-
}
|
16
|
-
const styles = StyleSheet.create({
|
17
|
-
container: { flex: 1 },
|
18
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,221 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Component } from 'react';
|
3
|
-
import { Animated, Platform } from 'react-native';
|
4
|
-
import { State } from '../../State';
|
5
|
-
import { BaseButton } from '../GestureButtons';
|
6
|
-
/**
|
7
|
-
* Each touchable is a states' machine which preforms transitions.
|
8
|
-
* On very beginning (and on the very end or recognition) touchable is
|
9
|
-
* UNDETERMINED. Then it moves to BEGAN. If touchable recognizes that finger
|
10
|
-
* travel outside it transits to special MOVED_OUTSIDE state. Gesture recognition
|
11
|
-
* finishes in UNDETERMINED state.
|
12
|
-
*/
|
13
|
-
export const TOUCHABLE_STATE = {
|
14
|
-
UNDETERMINED: 0,
|
15
|
-
BEGAN: 1,
|
16
|
-
MOVED_OUTSIDE: 2,
|
17
|
-
};
|
18
|
-
/**
|
19
|
-
* GenericTouchable is not intented to be used as it is.
|
20
|
-
* Should be treated as a source for the rest of touchables
|
21
|
-
*/
|
22
|
-
export default class GenericTouchable extends Component {
|
23
|
-
static defaultProps = {
|
24
|
-
delayLongPress: 600,
|
25
|
-
extraButtonProps: {
|
26
|
-
rippleColor: 'transparent',
|
27
|
-
exclusive: true,
|
28
|
-
},
|
29
|
-
};
|
30
|
-
// Timeout handlers
|
31
|
-
pressInTimeout;
|
32
|
-
pressOutTimeout;
|
33
|
-
longPressTimeout;
|
34
|
-
// This flag is required since recognition of longPress implies not-invoking onPress
|
35
|
-
longPressDetected = false;
|
36
|
-
pointerInside = true;
|
37
|
-
// State of touchable
|
38
|
-
STATE = TOUCHABLE_STATE.UNDETERMINED;
|
39
|
-
// handlePressIn in called on first touch on traveling inside component.
|
40
|
-
// Handles state transition with delay.
|
41
|
-
handlePressIn() {
|
42
|
-
if (this.props.delayPressIn) {
|
43
|
-
this.pressInTimeout = setTimeout(() => {
|
44
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
45
|
-
this.pressInTimeout = null;
|
46
|
-
}, this.props.delayPressIn);
|
47
|
-
}
|
48
|
-
else {
|
49
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
50
|
-
}
|
51
|
-
if (this.props.onLongPress) {
|
52
|
-
const time = (this.props.delayPressIn || 0) + (this.props.delayLongPress || 0);
|
53
|
-
this.longPressTimeout = setTimeout(this.onLongPressDetected, time);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
// handleMoveOutside in called on traveling outside component.
|
57
|
-
// Handles state transition with delay.
|
58
|
-
handleMoveOutside() {
|
59
|
-
if (this.props.delayPressOut) {
|
60
|
-
this.pressOutTimeout =
|
61
|
-
this.pressOutTimeout ||
|
62
|
-
setTimeout(() => {
|
63
|
-
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
|
64
|
-
this.pressOutTimeout = null;
|
65
|
-
}, this.props.delayPressOut);
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
|
69
|
-
}
|
70
|
-
}
|
71
|
-
// handleGoToUndetermined transits to UNDETERMINED state with proper delay
|
72
|
-
handleGoToUndetermined() {
|
73
|
-
clearTimeout(this.pressOutTimeout); // TODO: maybe it can be undefined
|
74
|
-
if (this.props.delayPressOut) {
|
75
|
-
this.pressOutTimeout = setTimeout(() => {
|
76
|
-
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
77
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
78
|
-
}
|
79
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
80
|
-
this.pressOutTimeout = null;
|
81
|
-
}, this.props.delayPressOut);
|
82
|
-
}
|
83
|
-
else {
|
84
|
-
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
85
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
86
|
-
}
|
87
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
componentDidMount() {
|
91
|
-
this.reset();
|
92
|
-
}
|
93
|
-
// Reset timeout to prevent memory leaks.
|
94
|
-
reset() {
|
95
|
-
this.longPressDetected = false;
|
96
|
-
this.pointerInside = true;
|
97
|
-
clearTimeout(this.pressInTimeout);
|
98
|
-
clearTimeout(this.pressOutTimeout);
|
99
|
-
clearTimeout(this.longPressTimeout);
|
100
|
-
this.pressOutTimeout = null;
|
101
|
-
this.longPressTimeout = null;
|
102
|
-
this.pressInTimeout = null;
|
103
|
-
}
|
104
|
-
// All states' transitions are defined here.
|
105
|
-
moveToState(newState) {
|
106
|
-
if (newState === this.STATE) {
|
107
|
-
// Ignore dummy transitions
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
if (newState === TOUCHABLE_STATE.BEGAN) {
|
111
|
-
// First touch and moving inside
|
112
|
-
this.props.onPressIn?.();
|
113
|
-
}
|
114
|
-
else if (newState === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
115
|
-
// Moving outside
|
116
|
-
this.props.onPressOut?.();
|
117
|
-
}
|
118
|
-
else if (newState === TOUCHABLE_STATE.UNDETERMINED) {
|
119
|
-
// Need to reset each time on transition to UNDETERMINED
|
120
|
-
this.reset();
|
121
|
-
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
|
122
|
-
// ... and if it happens inside button.
|
123
|
-
this.props.onPressOut?.();
|
124
|
-
}
|
125
|
-
}
|
126
|
-
// Finally call lister (used by subclasses)
|
127
|
-
this.props.onStateChange?.(this.STATE, newState);
|
128
|
-
// ... and make transition.
|
129
|
-
this.STATE = newState;
|
130
|
-
}
|
131
|
-
onGestureEvent = ({ nativeEvent: { pointerInside }, }) => {
|
132
|
-
if (this.pointerInside !== pointerInside) {
|
133
|
-
if (pointerInside) {
|
134
|
-
this.onMoveIn();
|
135
|
-
}
|
136
|
-
else {
|
137
|
-
this.onMoveOut();
|
138
|
-
}
|
139
|
-
}
|
140
|
-
this.pointerInside = pointerInside;
|
141
|
-
};
|
142
|
-
onHandlerStateChange = ({ nativeEvent, }) => {
|
143
|
-
const { state } = nativeEvent;
|
144
|
-
if (state === State.CANCELLED || state === State.FAILED) {
|
145
|
-
// Need to handle case with external cancellation (e.g. by ScrollView)
|
146
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
147
|
-
}
|
148
|
-
else if (
|
149
|
-
// This platform check is an implication of slightly different behavior of handlers on different platform.
|
150
|
-
// And Android "Active" state is achieving on first move of a finger, not on press in.
|
151
|
-
// On iOS event on "Began" is not delivered.
|
152
|
-
state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) &&
|
153
|
-
this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
154
|
-
// Moving inside requires
|
155
|
-
this.handlePressIn();
|
156
|
-
}
|
157
|
-
else if (state === State.END) {
|
158
|
-
const shouldCallOnPress = !this.longPressDetected &&
|
159
|
-
this.STATE !== TOUCHABLE_STATE.MOVED_OUTSIDE &&
|
160
|
-
this.pressOutTimeout === null;
|
161
|
-
this.handleGoToUndetermined();
|
162
|
-
if (shouldCallOnPress) {
|
163
|
-
// Calls only inside component whether no long press was called previously
|
164
|
-
this.props.onPress?.();
|
165
|
-
}
|
166
|
-
}
|
167
|
-
};
|
168
|
-
onLongPressDetected = () => {
|
169
|
-
this.longPressDetected = true;
|
170
|
-
// Checked for in the caller of `onLongPressDetected`, but better to check twice
|
171
|
-
this.props.onLongPress?.();
|
172
|
-
};
|
173
|
-
componentWillUnmount() {
|
174
|
-
// To prevent memory leaks
|
175
|
-
this.reset();
|
176
|
-
}
|
177
|
-
onMoveIn() {
|
178
|
-
if (this.STATE === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
179
|
-
// This call is not throttled with delays (like in RN's implementation).
|
180
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
181
|
-
}
|
182
|
-
}
|
183
|
-
onMoveOut() {
|
184
|
-
// Long press should no longer be detected
|
185
|
-
clearTimeout(this.longPressTimeout);
|
186
|
-
this.longPressTimeout = null;
|
187
|
-
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
|
188
|
-
this.handleMoveOutside();
|
189
|
-
}
|
190
|
-
}
|
191
|
-
render() {
|
192
|
-
const hitSlop = (typeof this.props.hitSlop === 'number'
|
193
|
-
? {
|
194
|
-
top: this.props.hitSlop,
|
195
|
-
left: this.props.hitSlop,
|
196
|
-
bottom: this.props.hitSlop,
|
197
|
-
right: this.props.hitSlop,
|
198
|
-
}
|
199
|
-
: this.props.hitSlop) ?? undefined;
|
200
|
-
const coreProps = {
|
201
|
-
accessible: this.props.accessible !== false,
|
202
|
-
accessibilityLabel: this.props.accessibilityLabel,
|
203
|
-
accessibilityHint: this.props.accessibilityHint,
|
204
|
-
accessibilityRole: this.props.accessibilityRole,
|
205
|
-
// TODO: check if changed to no 's' correctly, also removed 2 props that are no longer available: `accessibilityComponentType` and `accessibilityTraits`,
|
206
|
-
// would be good to check if it is ok for sure, see: https://github.com/facebook/react-native/issues/24016
|
207
|
-
accessibilityState: this.props.accessibilityState,
|
208
|
-
accessibilityActions: this.props.accessibilityActions,
|
209
|
-
onAccessibilityAction: this.props.onAccessibilityAction,
|
210
|
-
nativeID: this.props.nativeID,
|
211
|
-
onLayout: this.props.onLayout,
|
212
|
-
};
|
213
|
-
return (<BaseButton style={this.props.containerStyle} onHandlerStateChange={
|
214
|
-
// TODO: not sure if it can be undefined instead of null
|
215
|
-
this.props.disabled ? undefined : this.onHandlerStateChange} onGestureEvent={this.onGestureEvent} hitSlop={hitSlop} userSelect={this.props.userSelect} shouldActivateOnStart={this.props.shouldActivateOnStart} disallowInterruption={this.props.disallowInterruption} testID={this.props.testID} touchSoundDisabled={this.props.touchSoundDisabled ?? false} enabled={!this.props.disabled} {...this.props.extraButtonProps}>
|
216
|
-
<Animated.View {...coreProps} style={this.props.style}>
|
217
|
-
{this.props.children}
|
218
|
-
</Animated.View>
|
219
|
-
</BaseButton>);
|
220
|
-
}
|
221
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,75 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Component } from 'react';
|
3
|
-
import GenericTouchable, { TOUCHABLE_STATE } from './GenericTouchable';
|
4
|
-
import { StyleSheet, View, } from 'react-native';
|
5
|
-
/**
|
6
|
-
* @deprecated TouchableHighlight will be removed in the future version of Gesture Handler. Use Pressable instead.
|
7
|
-
*
|
8
|
-
* TouchableHighlight follows RN's implementation
|
9
|
-
*/
|
10
|
-
export default class TouchableHighlight extends Component {
|
11
|
-
static defaultProps = {
|
12
|
-
...GenericTouchable.defaultProps,
|
13
|
-
activeOpacity: 0.85,
|
14
|
-
delayPressOut: 100,
|
15
|
-
underlayColor: 'black',
|
16
|
-
};
|
17
|
-
constructor(props) {
|
18
|
-
super(props);
|
19
|
-
this.state = {
|
20
|
-
extraChildStyle: null,
|
21
|
-
extraUnderlayStyle: null,
|
22
|
-
};
|
23
|
-
}
|
24
|
-
// Copied from RN
|
25
|
-
showUnderlay = () => {
|
26
|
-
if (!this.hasPressHandler()) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
this.setState({
|
30
|
-
extraChildStyle: {
|
31
|
-
opacity: this.props.activeOpacity,
|
32
|
-
},
|
33
|
-
extraUnderlayStyle: {
|
34
|
-
backgroundColor: this.props.underlayColor,
|
35
|
-
},
|
36
|
-
});
|
37
|
-
this.props.onShowUnderlay?.();
|
38
|
-
};
|
39
|
-
hasPressHandler = () => this.props.onPress ||
|
40
|
-
this.props.onPressIn ||
|
41
|
-
this.props.onPressOut ||
|
42
|
-
this.props.onLongPress;
|
43
|
-
hideUnderlay = () => {
|
44
|
-
this.setState({
|
45
|
-
extraChildStyle: null,
|
46
|
-
extraUnderlayStyle: null,
|
47
|
-
});
|
48
|
-
this.props.onHideUnderlay?.();
|
49
|
-
};
|
50
|
-
renderChildren() {
|
51
|
-
if (!this.props.children) {
|
52
|
-
return <View />;
|
53
|
-
}
|
54
|
-
const child = React.Children.only(this.props.children); // TODO: not sure if OK but fixes error
|
55
|
-
return React.cloneElement(child, {
|
56
|
-
style: StyleSheet.compose(child.props.style, this.state.extraChildStyle),
|
57
|
-
});
|
58
|
-
}
|
59
|
-
onStateChange = (_from, to) => {
|
60
|
-
if (to === TOUCHABLE_STATE.BEGAN) {
|
61
|
-
this.showUnderlay();
|
62
|
-
}
|
63
|
-
else if (to === TOUCHABLE_STATE.UNDETERMINED ||
|
64
|
-
to === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
65
|
-
this.hideUnderlay();
|
66
|
-
}
|
67
|
-
};
|
68
|
-
render() {
|
69
|
-
const { style = {}, ...rest } = this.props;
|
70
|
-
const { extraUnderlayStyle } = this.state;
|
71
|
-
return (<GenericTouchable {...rest} style={[style, extraUnderlayStyle]} onStateChange={this.onStateChange}>
|
72
|
-
{this.renderChildren()}
|
73
|
-
</GenericTouchable>);
|
74
|
-
}
|
75
|
-
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import { Platform } from 'react-native';
|
2
|
-
import * as React from 'react';
|
3
|
-
import { Component } from 'react';
|
4
|
-
import GenericTouchable from './GenericTouchable';
|
5
|
-
/**
|
6
|
-
* @deprecated TouchableNativeFeedback will be removed in the future version of Gesture Handler. Use Pressable instead.
|
7
|
-
*
|
8
|
-
* TouchableNativeFeedback behaves slightly different than RN's TouchableNativeFeedback.
|
9
|
-
* There's small difference with handling long press ripple since RN's implementation calls
|
10
|
-
* ripple animation via bridge. This solution leaves all animations' handling for native components so
|
11
|
-
* it follows native behaviours.
|
12
|
-
*/
|
13
|
-
export default class TouchableNativeFeedback extends Component {
|
14
|
-
static defaultProps = {
|
15
|
-
...GenericTouchable.defaultProps,
|
16
|
-
useForeground: true,
|
17
|
-
extraButtonProps: {
|
18
|
-
// Disable hiding ripple on Android
|
19
|
-
rippleColor: null,
|
20
|
-
},
|
21
|
-
};
|
22
|
-
// Could be taken as RNTouchableNativeFeedback.SelectableBackground etc. but the API may change
|
23
|
-
static SelectableBackground = (rippleRadius) => ({
|
24
|
-
type: 'ThemeAttrAndroid',
|
25
|
-
// I added `attribute` prop to clone the implementation of RN and be able to use only 2 types
|
26
|
-
attribute: 'selectableItemBackground',
|
27
|
-
rippleRadius,
|
28
|
-
});
|
29
|
-
static SelectableBackgroundBorderless = (rippleRadius) => ({
|
30
|
-
type: 'ThemeAttrAndroid',
|
31
|
-
attribute: 'selectableItemBackgroundBorderless',
|
32
|
-
rippleRadius,
|
33
|
-
});
|
34
|
-
static Ripple = (color, borderless, rippleRadius) => ({
|
35
|
-
type: 'RippleAndroid',
|
36
|
-
color,
|
37
|
-
borderless,
|
38
|
-
rippleRadius,
|
39
|
-
});
|
40
|
-
static canUseNativeForeground = () => Platform.OS === 'android' && Platform.Version >= 23;
|
41
|
-
getExtraButtonProps() {
|
42
|
-
const extraProps = {};
|
43
|
-
const { background } = this.props;
|
44
|
-
if (background) {
|
45
|
-
// I changed type values to match those used in RN
|
46
|
-
// TODO(TS): check if it works the same as previous implementation - looks like it works the same as RN component, so it should be ok
|
47
|
-
if (background.type === 'RippleAndroid') {
|
48
|
-
extraProps['borderless'] = background.borderless;
|
49
|
-
extraProps['rippleColor'] = background.color;
|
50
|
-
}
|
51
|
-
else if (background.type === 'ThemeAttrAndroid') {
|
52
|
-
extraProps['borderless'] =
|
53
|
-
background.attribute === 'selectableItemBackgroundBorderless';
|
54
|
-
}
|
55
|
-
// I moved it from above since it should be available in all options
|
56
|
-
extraProps['rippleRadius'] = background.rippleRadius;
|
57
|
-
}
|
58
|
-
extraProps['foreground'] = this.props.useForeground;
|
59
|
-
return extraProps;
|
60
|
-
}
|
61
|
-
render() {
|
62
|
-
const { style = {}, ...rest } = this.props;
|
63
|
-
return (<GenericTouchable {...rest} style={style} extraButtonProps={this.getExtraButtonProps()}/>);
|
64
|
-
}
|
65
|
-
}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { TouchableNativeFeedback as RNTouchableNativeFeedback } from 'react-native';
|
2
|
-
/**
|
3
|
-
* @deprecated TouchableNativeFeedback will be removed in the future version of Gesture Handler. Use Pressable instead.
|
4
|
-
*/
|
5
|
-
const TouchableNativeFeedback = RNTouchableNativeFeedback;
|
6
|
-
export default TouchableNativeFeedback;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,51 +0,0 @@
|
|
1
|
-
import { Animated, Easing, StyleSheet, View, } from 'react-native';
|
2
|
-
import GenericTouchable, { TOUCHABLE_STATE } from './GenericTouchable';
|
3
|
-
import * as React from 'react';
|
4
|
-
import { Component } from 'react';
|
5
|
-
/**
|
6
|
-
* @deprecated TouchableOpacity will be removed in the future version of Gesture Handler. Use Pressable instead.
|
7
|
-
*
|
8
|
-
* TouchableOpacity bases on timing animation which has been used in RN's core
|
9
|
-
*/
|
10
|
-
export default class TouchableOpacity extends Component {
|
11
|
-
static defaultProps = {
|
12
|
-
...GenericTouchable.defaultProps,
|
13
|
-
activeOpacity: 0.2,
|
14
|
-
};
|
15
|
-
// Opacity is 1 one by default but could be overwritten
|
16
|
-
getChildStyleOpacityWithDefault = () => {
|
17
|
-
const childStyle = StyleSheet.flatten(this.props.style) || {};
|
18
|
-
return childStyle.opacity == null
|
19
|
-
? 1
|
20
|
-
: childStyle.opacity.valueOf();
|
21
|
-
};
|
22
|
-
opacity = new Animated.Value(this.getChildStyleOpacityWithDefault());
|
23
|
-
setOpacityTo = (value, duration) => {
|
24
|
-
Animated.timing(this.opacity, {
|
25
|
-
toValue: value,
|
26
|
-
duration: duration,
|
27
|
-
easing: Easing.inOut(Easing.quad),
|
28
|
-
useNativeDriver: this.props.useNativeAnimations ?? true,
|
29
|
-
}).start();
|
30
|
-
};
|
31
|
-
onStateChange = (_from, to) => {
|
32
|
-
if (to === TOUCHABLE_STATE.BEGAN) {
|
33
|
-
this.setOpacityTo(this.props.activeOpacity, 0);
|
34
|
-
}
|
35
|
-
else if (to === TOUCHABLE_STATE.UNDETERMINED ||
|
36
|
-
to === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
37
|
-
this.setOpacityTo(this.getChildStyleOpacityWithDefault(), 150);
|
38
|
-
}
|
39
|
-
};
|
40
|
-
render() {
|
41
|
-
const { style = {}, ...rest } = this.props;
|
42
|
-
return (<GenericTouchable {...rest} style={[
|
43
|
-
style,
|
44
|
-
{
|
45
|
-
opacity: this.opacity, // TODO: fix this
|
46
|
-
},
|
47
|
-
]} onStateChange={this.onStateChange}>
|
48
|
-
{this.props.children ? this.props.children : <View />}
|
49
|
-
</GenericTouchable>);
|
50
|
-
}
|
51
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import GenericTouchable from './GenericTouchable';
|
3
|
-
/**
|
4
|
-
* @deprecated TouchableWithoutFeedback will be removed in the future version of Gesture Handler. Use Pressable instead.
|
5
|
-
*/
|
6
|
-
const TouchableWithoutFeedback = React.forwardRef(({ delayLongPress = 600, extraButtonProps = {
|
7
|
-
rippleColor: 'transparent',
|
8
|
-
exclusive: true,
|
9
|
-
}, ...rest }, ref) => (<GenericTouchable ref={ref} delayLongPress={delayLongPress} extraButtonProps={extraButtonProps} {...rest}/>));
|
10
|
-
export default TouchableWithoutFeedback;
|
@@ -1,4 +0,0 @@
|
|
1
|
-
export { default as TouchableNativeFeedback } from './TouchableNativeFeedback';
|
2
|
-
export { default as TouchableWithoutFeedback } from './TouchableWithoutFeedback';
|
3
|
-
export { default as TouchableOpacity } from './TouchableOpacity';
|
4
|
-
export { default as TouchableHighlight } from './TouchableHighlight';
|
@@ -1,11 +0,0 @@
|
|
1
|
-
export function applyRelationProp(gesture, relationPropName, relationProp) {
|
2
|
-
if (!relationProp) {
|
3
|
-
return;
|
4
|
-
}
|
5
|
-
if (Array.isArray(relationProp)) {
|
6
|
-
gesture[relationPropName](...relationProp);
|
7
|
-
}
|
8
|
-
else {
|
9
|
-
gesture[relationPropName](relationProp);
|
10
|
-
}
|
11
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { FlatList } from 'react-native';
|
2
|
-
import { isRNSVGElement } from './web/utils';
|
3
|
-
export default function findNodeHandle(viewRef) {
|
4
|
-
// TODO: Remove this once we remove old API.
|
5
|
-
if (viewRef instanceof FlatList) {
|
6
|
-
// @ts-ignore This is the only way to get the scroll ref from FlatList.
|
7
|
-
return viewRef._listRef._scrollRef.firstChild;
|
8
|
-
}
|
9
|
-
// Old API assumes that child handler is HTMLElement.
|
10
|
-
// However, if we nest handlers, we will get ref to another handler.
|
11
|
-
// In that case, we want to recursively call findNodeHandle with new handler viewTag (which can also be ref to another handler).
|
12
|
-
if (viewRef?.viewTag !== undefined) {
|
13
|
-
return findNodeHandle(viewRef.viewTag);
|
14
|
-
}
|
15
|
-
if (viewRef instanceof Element) {
|
16
|
-
if (viewRef.style.display === 'contents') {
|
17
|
-
return findNodeHandle(viewRef.firstChild);
|
18
|
-
}
|
19
|
-
return viewRef;
|
20
|
-
}
|
21
|
-
if (isRNSVGElement(viewRef)) {
|
22
|
-
return viewRef.elementRef.current;
|
23
|
-
}
|
24
|
-
// In new API, we receive ref object which `current` field points to wrapper `div` with `display: contents;`.
|
25
|
-
// We want to return the first descendant (in DFS order) that doesn't have this property.
|
26
|
-
let element = viewRef?.current;
|
27
|
-
while (element && element.style.display === 'contents') {
|
28
|
-
element = element.firstChild;
|
29
|
-
}
|
30
|
-
return element;
|
31
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
// Used by GestureDetector (unsupported on web at the moment) to check whether the
|
2
|
-
// attached view may get flattened on Fabric. This implementation causes errors
|
3
|
-
// on web due to the static resolution of `require` statements by webpack breaking
|
4
|
-
// the conditional importing. Solved by making .web file.
|
5
|
-
let findHostInstance_DEPRECATED;
|
6
|
-
let getInternalInstanceHandleFromPublicInstance;
|
7
|
-
export function getShadowNodeFromRef(ref) {
|
8
|
-
// Load findHostInstance_DEPRECATED lazily because it may not be available before render
|
9
|
-
if (findHostInstance_DEPRECATED === undefined) {
|
10
|
-
try {
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
12
|
-
const ReactFabric = require('react-native/Libraries/Renderer/shims/ReactFabric');
|
13
|
-
// Since RN 0.77 ReactFabric exports findHostInstance_DEPRECATED in default object so we're trying to
|
14
|
-
// access it first, then fallback on named export
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
16
|
-
findHostInstance_DEPRECATED =
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
18
|
-
ReactFabric?.default?.findHostInstance_DEPRECATED ||
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
20
|
-
ReactFabric?.findHostInstance_DEPRECATED;
|
21
|
-
}
|
22
|
-
catch (e) {
|
23
|
-
findHostInstance_DEPRECATED = (_ref) => null;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
// Load findHostInstance_DEPRECATED lazily because it may not be available before render
|
27
|
-
if (getInternalInstanceHandleFromPublicInstance === undefined) {
|
28
|
-
try {
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
30
|
-
getInternalInstanceHandleFromPublicInstance =
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
32
|
-
require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
|
33
|
-
.getInternalInstanceHandleFromPublicInstance ??
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
35
|
-
((ref) => ref._internalInstanceHandle);
|
36
|
-
}
|
37
|
-
catch (e) {
|
38
|
-
getInternalInstanceHandleFromPublicInstance = (ref) =>
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
40
|
-
ref._internalInstanceHandle;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
// @ts-ignore Fabric
|
44
|
-
return getInternalInstanceHandleFromPublicInstance(findHostInstance_DEPRECATED(ref)).stateNode.node;
|
45
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
// Used by GestureDetector (unsupported on web at the moment) to check whether the
|
2
|
-
// attached view may get flattened on Fabric. Original implementation causes errors
|
3
|
-
// on web due to the static resolution of `require` statements by webpack breaking
|
4
|
-
// the conditional importing.
|
5
|
-
export function getShadowNodeFromRef(_ref) {
|
6
|
-
return null;
|
7
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
// We check for typeof requestAnimationFrame because of SSR
|
2
|
-
// Functions are bound to null to avoid issues with scope when using Metro inline requires.
|
3
|
-
export const ghQueueMicrotask = typeof setImmediate === 'function'
|
4
|
-
? setImmediate.bind(null)
|
5
|
-
: typeof requestAnimationFrame === 'function'
|
6
|
-
? requestAnimationFrame.bind(null)
|
7
|
-
: queueMicrotask.bind(null);
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import createHandler from './createHandler';
|
2
|
-
import { baseGestureHandlerProps, } from './gestureHandlerCommon';
|
3
|
-
export const flingGestureHandlerProps = [
|
4
|
-
'numberOfPointers',
|
5
|
-
'direction',
|
6
|
-
];
|
7
|
-
export const flingHandlerName = 'FlingGestureHandler';
|
8
|
-
/**
|
9
|
-
* @deprecated FlingGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Fling()` instead.
|
10
|
-
*/
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
12
|
-
export const FlingGestureHandler = createHandler({
|
13
|
-
name: flingHandlerName,
|
14
|
-
allowedProps: [
|
15
|
-
...baseGestureHandlerProps,
|
16
|
-
...flingGestureHandlerProps,
|
17
|
-
],
|
18
|
-
config: {},
|
19
|
-
});
|