react-native-gesture-handler 1.10.0 → 2.0.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/DrawerLayout/package.json +3 -3
- package/README.md +7 -6
- package/Swipeable/package.json +3 -3
- package/android/build.gradle +23 -1
- package/android/gradle.properties +19 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.kt +18 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/Extensions.kt +11 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +96 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +710 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.kt +8 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +562 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.kt +8 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.kt +21 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.kt +49 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +97 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/ManualGestureHandler.kt +11 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +129 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.kt +9 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +289 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +88 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/{PointerEventsConfig.java → PointerEventsConfig.kt} +3 -5
- package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.kt +125 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +79 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +167 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.kt +10 -0
- package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +348 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +57 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +59 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +61 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +686 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.kt +17 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +95 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +132 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +68 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +34 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +66 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +69 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +51 -0
- package/ios/Handlers/RNFlingHandler.m +78 -5
- package/ios/Handlers/RNForceTouchHandler.m +29 -4
- package/ios/Handlers/RNLongPressHandler.m +105 -3
- package/ios/Handlers/RNManualHandler.h +4 -0
- package/ios/Handlers/RNManualHandler.m +73 -0
- package/ios/Handlers/RNNativeViewHandler.m +30 -2
- package/ios/Handlers/RNPanHandler.m +64 -4
- package/ios/Handlers/RNPinchHandler.m +61 -2
- package/ios/Handlers/RNRotationHandler.m +60 -1
- package/ios/Handlers/RNTapHandler.m +55 -8
- package/ios/RNGestureHandler.h +18 -4
- package/ios/RNGestureHandler.m +123 -13
- package/ios/RNGestureHandler.xcodeproj/xcuserdata/mdk.xcuserdatad/xcschemes/RNGestureHandler.xcscheme +80 -0
- package/ios/RNGestureHandler.xcodeproj/xcuserdata/mdk.xcuserdatad/xcschemes/xcschememanagement.plist +27 -0
- package/ios/RNGestureHandlerEvents.h +9 -0
- package/ios/RNGestureHandlerEvents.m +34 -0
- package/ios/RNGestureHandlerManager.h +7 -0
- package/ios/RNGestureHandlerManager.m +62 -34
- package/ios/RNGestureHandlerModule.m +39 -3
- package/ios/RNGestureHandlerPointerTracker.h +25 -0
- package/ios/RNGestureHandlerPointerTracker.m +237 -0
- package/ios/RNGestureHandlerRegistry.h +1 -0
- package/ios/RNGestureHandlerRegistry.m +10 -0
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/RNManualActivationRecognizer.h +10 -0
- package/ios/RNManualActivationRecognizer.m +80 -0
- package/ios/RNRootViewGestureRecognizer.m +1 -1
- package/ios/RNTouchEventType.h +9 -0
- package/jestSetup.js +7 -0
- package/lib/commonjs/Directions.js +15 -0
- package/lib/commonjs/Directions.js.map +1 -0
- package/lib/commonjs/EventType.js +16 -0
- package/lib/commonjs/EventType.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootView.android.js +24 -0
- package/lib/commonjs/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootView.js +20 -0
- package/lib/commonjs/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/PlatformConstants.js +15 -0
- package/lib/commonjs/PlatformConstants.js.map +1 -0
- package/lib/commonjs/PlatformConstants.web.js +14 -0
- package/lib/commonjs/PlatformConstants.web.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.js +22 -0
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +80 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/commonjs/State.js +18 -0
- package/lib/commonjs/State.js.map +1 -0
- package/lib/commonjs/components/DrawerLayout.js +535 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -0
- package/lib/commonjs/components/GestureButtons.js +207 -0
- package/lib/commonjs/components/GestureButtons.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +76 -0
- package/lib/commonjs/components/GestureComponents.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.web.js +46 -0
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +13 -0
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +365 -0
- package/lib/commonjs/components/Swipeable.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js +278 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js +109 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +100 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +12 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js +75 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +26 -0
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -0
- package/lib/commonjs/components/touchables/index.js +40 -0
- package/lib/commonjs/components/touchables/index.js.map +1 -0
- package/lib/commonjs/gestureHandlerRootHOC.js +39 -0
- package/lib/commonjs/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js +23 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +44 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +23 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +25 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js +121 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js +21 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js +21 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/TapGestureHandler.js +23 -0
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +373 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -0
- package/lib/commonjs/handlers/createNativeWrapper.js +70 -0
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +80 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +2 -0
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js +415 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js +112 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js +34 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +39 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js +177 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js +94 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js +85 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +58 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js +34 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js +19 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js +34 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/panGesture.js +116 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js +19 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +24 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestures/rotationGesture.js +19 -0
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js +59 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/commonjs/handlers/handlersRegistry.js +31 -0
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
- package/lib/commonjs/index.js +338 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/init.js +13 -0
- package/lib/commonjs/init.js.map +1 -0
- package/lib/commonjs/mocks.js +64 -0
- package/lib/commonjs/mocks.js.map +1 -0
- package/lib/commonjs/typeUtils.js +2 -0
- package/lib/commonjs/typeUtils.js.map +1 -0
- package/lib/commonjs/utils.js +15 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/DiscreteGestureHandler.js +105 -0
- package/lib/commonjs/web/DiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web/DraggingGestureHandler.js +53 -0
- package/lib/commonjs/web/DraggingGestureHandler.js.map +1 -0
- package/lib/commonjs/web/Errors.js +16 -0
- package/lib/commonjs/web/Errors.js.map +1 -0
- package/lib/commonjs/web/FlingGestureHandler.js +170 -0
- package/lib/commonjs/web/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web/GestureHandler.js +533 -0
- package/lib/commonjs/web/GestureHandler.js.map +1 -0
- package/lib/commonjs/web/IndiscreteGestureHandler.js +54 -0
- package/lib/commonjs/web/IndiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web/LongPressGestureHandler.js +71 -0
- package/lib/commonjs/web/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web/NativeViewGestureHandler.js +62 -0
- package/lib/commonjs/web/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web/NodeManager.js +43 -0
- package/lib/commonjs/web/NodeManager.js.map +1 -0
- package/lib/commonjs/web/PanGestureHandler.js +189 -0
- package/lib/commonjs/web/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web/PinchGestureHandler.js +40 -0
- package/lib/commonjs/web/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web/PressGestureHandler.js +188 -0
- package/lib/commonjs/web/PressGestureHandler.js.map +1 -0
- package/lib/commonjs/web/RotationGestureHandler.js +44 -0
- package/lib/commonjs/web/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web/TapGestureHandler.js +192 -0
- package/lib/commonjs/web/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web/constants.js +64 -0
- package/lib/commonjs/web/constants.js.map +1 -0
- package/lib/commonjs/web/utils.js +42 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/module/Directions.js +7 -0
- package/lib/module/Directions.js.map +1 -0
- package/lib/module/EventType.js +8 -0
- package/lib/module/EventType.js.map +1 -0
- package/lib/module/GestureHandlerRootView.android.js +10 -0
- package/lib/module/GestureHandlerRootView.android.js.map +1 -0
- package/lib/module/GestureHandlerRootView.js +7 -0
- package/lib/module/GestureHandlerRootView.js.map +1 -0
- package/lib/module/PlatformConstants.js +5 -0
- package/lib/module/PlatformConstants.js.map +1 -0
- package/lib/module/PlatformConstants.web.js +7 -0
- package/lib/module/PlatformConstants.web.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.js +13 -0
- package/lib/module/RNGestureHandlerModule.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.web.js +56 -0
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/module/State.js +10 -0
- package/lib/module/State.js.map +1 -0
- package/lib/module/components/DrawerLayout.js +520 -0
- package/lib/module/components/DrawerLayout.js.map +1 -0
- package/lib/module/components/GestureButtons.js +172 -0
- package/lib/module/components/GestureButtons.js.map +1 -0
- package/lib/module/components/GestureComponents.js +53 -0
- package/lib/module/components/GestureComponents.js.map +1 -0
- package/lib/module/components/GestureComponents.web.js +25 -0
- package/lib/module/components/GestureComponents.web.js.map +1 -0
- package/{dist/src → lib/module}/components/GestureHandlerButton.js +1 -0
- package/lib/module/components/GestureHandlerButton.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.web.js +9 -0
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/module/components/Swipeable.js +347 -0
- package/lib/module/components/Swipeable.js.map +1 -0
- package/lib/module/components/touchables/GenericTouchable.js +262 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -0
- package/lib/module/components/touchables/TouchableHighlight.js +95 -0
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +84 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
- package/{dist/src → lib/module}/components/touchables/TouchableNativeFeedback.js +1 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -0
- package/lib/module/components/touchables/TouchableOpacity.js +61 -0
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -0
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +10 -0
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -0
- package/{dist/src → lib/module}/components/touchables/index.js +1 -0
- package/lib/module/components/touchables/index.js.map +1 -0
- package/lib/module/gestureHandlerRootHOC.js +21 -0
- package/lib/module/gestureHandlerRootHOC.js.map +1 -0
- package/lib/module/handlers/FlingGestureHandler.js +10 -0
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/handlers/ForceTouchGestureHandler.js +29 -0
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js +10 -0
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/handlers/NativeViewGestureHandler.js +11 -0
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/handlers/PanGestureHandler.js +106 -0
- package/lib/module/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/handlers/PinchGestureHandler.js +9 -0
- package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/handlers/RotationGestureHandler.js +9 -0
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/handlers/TapGestureHandler.js +10 -0
- package/lib/module/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/handlers/createHandler.js +348 -0
- package/lib/module/handlers/createHandler.js.map +1 -0
- package/lib/module/handlers/createNativeWrapper.js +58 -0
- package/lib/module/handlers/createNativeWrapper.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +66 -0
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/module/handlers/gestureHandlerTypesCompat.js +2 -0
- package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector.js +378 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/module/handlers/gestures/eventReceiver.js +97 -0
- package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
- package/lib/module/handlers/gestures/flingGesture.js +24 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js +29 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js +159 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -0
- package/lib/module/handlers/gestures/gestureComposition.js +79 -0
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/module/handlers/gestures/gestureObjects.js +67 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/module/handlers/gestures/gestureStateManager.js +48 -0
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js +24 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
- package/lib/module/handlers/gestures/manualGesture.js +9 -0
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
- package/lib/module/handlers/gestures/nativeGesture.js +24 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
- package/lib/module/handlers/gestures/panGesture.js +106 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -0
- package/lib/module/handlers/gestures/pinchGesture.js +9 -0
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
- package/lib/module/handlers/gestures/rotationGesture.js +9 -0
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
- package/lib/module/handlers/gestures/tapGesture.js +49 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/module/handlers/handlersRegistry.js +16 -0
- package/lib/module/handlers/handlersRegistry.js.map +1 -0
- package/lib/module/index.js +34 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/init.js +5 -0
- package/lib/module/init.js.map +1 -0
- package/lib/module/mocks.js +54 -0
- package/lib/module/mocks.js.map +1 -0
- package/lib/module/typeUtils.js +2 -0
- package/lib/module/typeUtils.js.map +1 -0
- package/lib/module/utils.js +8 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/web/DiscreteGestureHandler.js +94 -0
- package/lib/module/web/DiscreteGestureHandler.js.map +1 -0
- package/lib/module/web/DraggingGestureHandler.js +40 -0
- package/lib/module/web/DraggingGestureHandler.js.map +1 -0
- package/lib/module/web/Errors.js +7 -0
- package/lib/module/web/Errors.js.map +1 -0
- package/lib/module/web/FlingGestureHandler.js +156 -0
- package/lib/module/web/FlingGestureHandler.js.map +1 -0
- package/lib/module/web/GestureHandler.js +518 -0
- package/lib/module/web/GestureHandler.js.map +1 -0
- package/lib/module/web/IndiscreteGestureHandler.js +44 -0
- package/lib/module/web/IndiscreteGestureHandler.js.map +1 -0
- package/lib/module/web/LongPressGestureHandler.js +58 -0
- package/lib/module/web/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web/NativeViewGestureHandler.js +45 -0
- package/lib/module/web/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web/NodeManager.js +30 -0
- package/lib/module/web/NodeManager.js.map +1 -0
- package/lib/module/web/PanGestureHandler.js +175 -0
- package/lib/module/web/PanGestureHandler.js.map +1 -0
- package/lib/module/web/PinchGestureHandler.js +29 -0
- package/lib/module/web/PinchGestureHandler.js.map +1 -0
- package/lib/module/web/PressGestureHandler.js +174 -0
- package/lib/module/web/PressGestureHandler.js.map +1 -0
- package/lib/module/web/RotationGestureHandler.js +32 -0
- package/lib/module/web/RotationGestureHandler.js.map +1 -0
- package/lib/module/web/TapGestureHandler.js +180 -0
- package/lib/module/web/TapGestureHandler.js.map +1 -0
- package/lib/module/web/constants.js +43 -0
- package/lib/module/web/constants.js.map +1 -0
- package/lib/module/web/utils.js +19 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/typescript/Directions.d.ts +7 -0
- package/lib/typescript/EventType.d.ts +8 -0
- package/lib/typescript/GestureHandlerRootView.android.d.ts +2 -0
- package/lib/typescript/GestureHandlerRootView.d.ts +5 -0
- package/{dist/src → lib/typescript}/PlatformConstants.d.ts +0 -0
- package/{dist/src → lib/typescript}/PlatformConstants.web.d.ts +0 -0
- package/{dist/src → lib/typescript}/RNGestureHandlerModule.d.ts +1 -8
- package/{dist/src → lib/typescript}/RNGestureHandlerModule.web.d.ts +1 -1
- package/{dist/src → lib/typescript}/State.d.ts +0 -0
- package/{dist/src → lib/typescript}/components/DrawerLayout.d.ts +52 -2
- package/{dist/src → lib/typescript}/components/GestureButtons.d.ts +37 -1
- package/lib/typescript/components/GestureComponents.d.ts +18 -0
- package/lib/typescript/components/GestureComponents.web.d.ts +7 -0
- package/{dist/src → lib/typescript}/components/GestureHandlerButton.d.ts +0 -0
- package/{dist/src → lib/typescript}/components/GestureHandlerButton.web.d.ts +1 -1
- package/lib/typescript/components/Swipeable.d.ts +150 -0
- package/{dist/src → lib/typescript}/components/touchables/GenericTouchable.d.ts +3 -3
- package/{dist/src → lib/typescript}/components/touchables/TouchableHighlight.d.ts +1 -0
- package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.android.d.ts +0 -0
- package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.d.ts +0 -0
- package/{dist/src → lib/typescript}/components/touchables/TouchableOpacity.d.ts +1 -0
- package/{dist/src → lib/typescript}/components/touchables/TouchableWithoutFeedback.d.ts +4 -2
- package/{dist/src → lib/typescript}/components/touchables/index.d.ts +0 -0
- package/lib/typescript/gestureHandlerRootHOC.d.ts +3 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +33 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +43 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +55 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +27 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +137 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +28 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +28 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +56 -0
- package/{dist/src → lib/typescript}/handlers/createHandler.d.ts +2 -2
- package/{dist/src → lib/typescript}/handlers/createNativeWrapper.d.ts +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
- package/{dist/src → lib/typescript}/handlers/gestureHandlerTypesCompat.d.ts +17 -2
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +16 -0
- package/lib/typescript/handlers/gestures/eventReceiver.d.ts +2 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +10 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +90 -0
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +39 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +5 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +19 -0
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +6 -0
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +14 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +6 -0
- package/lib/typescript/index.d.ts +44 -0
- package/lib/typescript/init.d.ts +1 -0
- package/lib/typescript/mocks.d.ts +43 -0
- package/{dist/src → lib/typescript}/typeUtils.d.ts +0 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/{dist/src → lib/typescript}/web/DiscreteGestureHandler.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/DraggingGestureHandler.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/Errors.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/FlingGestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/GestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/IndiscreteGestureHandler.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/LongPressGestureHandler.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/NativeViewGestureHandler.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/NodeManager.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/PanGestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/PinchGestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/PressGestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/RotationGestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/TapGestureHandler.d.ts +0 -1
- package/{dist/src → lib/typescript}/web/constants.d.ts +0 -0
- package/{dist/src → lib/typescript}/web/utils.d.ts +0 -0
- package/package.json +38 -16
- package/src/Directions.ts +8 -2
- package/src/EventType.ts +10 -0
- package/src/GestureHandlerRootView.android.tsx +10 -25
- package/src/GestureHandlerRootView.tsx +12 -0
- package/src/PlatformConstants.ts +3 -2
- package/src/RNGestureHandlerModule.ts +15 -9
- package/src/RNGestureHandlerModule.web.ts +1 -0
- package/src/components/DrawerLayout.tsx +117 -43
- package/src/components/GestureButtons.tsx +46 -6
- package/src/components/GestureComponents.tsx +48 -41
- package/src/components/GestureComponents.web.tsx +1 -1
- package/src/components/{GestureHandlerButton.ts → GestureHandlerButton.tsx} +0 -0
- package/src/components/GestureHandlerButton.web.tsx +1 -1
- package/src/components/Swipeable.tsx +110 -22
- package/src/components/touchables/GenericTouchable.tsx +5 -3
- package/src/components/touchables/TouchableHighlight.tsx +2 -1
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -1
- package/src/components/touchables/{TouchableNativeFeedback.ts → TouchableNativeFeedback.tsx} +0 -0
- package/src/components/touchables/TouchableOpacity.tsx +3 -2
- package/src/components/touchables/TouchableWithoutFeedback.tsx +3 -2
- package/src/gestureHandlerRootHOC.tsx +5 -5
- package/src/handlers/FlingGestureHandler.ts +57 -0
- package/src/handlers/ForceTouchGestureHandler.ts +83 -0
- package/src/handlers/LongPressGestureHandler.ts +84 -0
- package/src/handlers/NativeViewGestureHandler.ts +31 -7
- package/src/handlers/PanGestureHandler.ts +321 -0
- package/src/handlers/PinchGestureHandler.ts +46 -0
- package/src/handlers/RotationGestureHandler.ts +46 -0
- package/src/handlers/TapGestureHandler.ts +90 -0
- package/src/handlers/createHandler.ts +61 -83
- package/src/handlers/createNativeWrapper.tsx +3 -2
- package/src/handlers/gestureHandlerCommon.ts +185 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +37 -4
- package/src/handlers/gestures/GestureDetector.tsx +490 -0
- package/src/handlers/gestures/eventReceiver.ts +129 -0
- package/src/handlers/gestures/flingGesture.ts +27 -0
- package/src/handlers/gestures/forceTouchGesture.ts +32 -0
- package/src/handlers/gestures/gesture.ts +262 -0
- package/src/handlers/gestures/gestureComposition.ts +109 -0
- package/src/handlers/gestures/gestureObjects.ts +79 -0
- package/src/handlers/gestures/gestureStateManager.ts +60 -0
- package/src/handlers/gestures/longPressGesture.ts +27 -0
- package/src/handlers/gestures/manualGesture.ts +11 -0
- package/src/handlers/gestures/nativeGesture.ts +27 -0
- package/src/handlers/gestures/panGesture.ts +105 -0
- package/src/handlers/gestures/pinchGesture.ts +12 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
- package/src/handlers/gestures/rotationGesture.ts +12 -0
- package/src/handlers/gestures/tapGesture.ts +52 -0
- package/src/handlers/handlersRegistry.ts +22 -0
- package/src/index.ts +156 -0
- package/src/init.ts +5 -0
- package/src/mocks.ts +65 -0
- package/src/utils.ts +7 -0
- package/src/web/GestureHandler.ts +3 -4
- package/src/web/NativeViewGestureHandler.ts +0 -2
- package/src/web/NodeManager.ts +5 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.java +0 -23
- package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.java +0 -110
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.java +0 -531
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.java +0 -8
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.java +0 -543
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.java +0 -10
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.java +0 -29
- package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.java +0 -53
- package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.java +0 -81
- package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java +0 -110
- package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.java +0 -8
- package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.java +0 -312
- package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.java +0 -109
- package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.java +0 -169
- package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.java +0 -96
- package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.java +0 -172
- package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.java +0 -10
- package/android/src/main/java/com/facebook/react/views/modal/RNGHModalUtils.java +0 -21
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java +0 -296
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.java +0 -72
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java +0 -77
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.java +0 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.java +0 -86
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java +0 -731
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java +0 -31
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.java +0 -101
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java +0 -151
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.java +0 -7
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.java +0 -76
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java +0 -49
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java +0 -82
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java +0 -61
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -16
- package/dist/src/Directions.d.ts +0 -7
- package/dist/src/Directions.js +0 -2
- package/dist/src/GestureHandlerRootView.android.d.ts +0 -4
- package/dist/src/GestureHandlerRootView.android.expo.d.ts +0 -2
- package/dist/src/GestureHandlerRootView.android.expo.js +0 -2
- package/dist/src/GestureHandlerRootView.android.js +0 -21
- package/dist/src/GestureHandlerRootView.d.ts +0 -2
- package/dist/src/GestureHandlerRootView.js +0 -2
- package/dist/src/PlatformConstants.js +0 -2
- package/dist/src/PlatformConstants.web.js +0 -5
- package/dist/src/RNGestureHandlerModule.js +0 -3
- package/dist/src/RNGestureHandlerModule.web.js +0 -47
- package/dist/src/State.js +0 -9
- package/dist/src/__mocks__/RNGestureHandlerModule.d.ts +0 -23
- package/dist/src/__mocks__/RNGestureHandlerModule.js +0 -25
- package/dist/src/components/DrawerLayout.js +0 -390
- package/dist/src/components/GestureButtons.js +0 -113
- package/dist/src/components/GestureComponents.d.ts +0 -45
- package/dist/src/components/GestureComponents.js +0 -18
- package/dist/src/components/GestureComponents.web.d.ts +0 -7
- package/dist/src/components/GestureComponents.web.js +0 -18
- package/dist/src/components/GestureHandlerButton.web.js +0 -3
- package/dist/src/components/Swipeable.d.ts +0 -82
- package/dist/src/components/Swipeable.js +0 -248
- package/dist/src/components/touchables/GenericTouchable.js +0 -209
- package/dist/src/components/touchables/TouchableHighlight.js +0 -72
- package/dist/src/components/touchables/TouchableNativeFeedback.android.js +0 -62
- package/dist/src/components/touchables/TouchableOpacity.js +0 -49
- package/dist/src/components/touchables/TouchableWithoutFeedback.js +0 -5
- package/dist/src/gestureHandlerRootHOC.d.ts +0 -3
- package/dist/src/gestureHandlerRootHOC.js +0 -17
- package/dist/src/handlers/NativeViewGestureHandler.d.ts +0 -12
- package/dist/src/handlers/NativeViewGestureHandler.js +0 -13
- package/dist/src/handlers/createHandler.js +0 -292
- package/dist/src/handlers/createNativeWrapper.js +0 -50
- package/dist/src/handlers/gestureHandlerTypesCompat.js +0 -1
- package/dist/src/handlers/gestureHandlers.d.ts +0 -158
- package/dist/src/handlers/gestureHandlers.js +0 -247
- package/dist/src/typeUtils.js +0 -1
- package/dist/src/web/DiscreteGestureHandler.js +0 -48
- package/dist/src/web/DraggingGestureHandler.js +0 -25
- package/dist/src/web/Errors.js +0 -5
- package/dist/src/web/FlingGestureHandler.js +0 -119
- package/dist/src/web/GestureHandler.js +0 -413
- package/dist/src/web/IndiscreteGestureHandler.js +0 -26
- package/dist/src/web/LongPressGestureHandler.js +0 -46
- package/dist/src/web/NativeViewGestureHandler.js +0 -39
- package/dist/src/web/NodeManager.js +0 -22
- package/dist/src/web/PanGestureHandler.js +0 -145
- package/dist/src/web/PinchGestureHandler.js +0 -19
- package/dist/src/web/PressGestureHandler.js +0 -135
- package/dist/src/web/RotationGestureHandler.js +0 -20
- package/dist/src/web/TapGestureHandler.js +0 -143
- package/dist/src/web/constants.js +0 -42
- package/dist/src/web/utils.js +0 -15
- package/index.ts +0 -103
- package/src/GestureHandlerRootView.android.expo.ts +0 -3
- package/src/GestureHandlerRootView.ts +0 -3
- package/src/__mocks__/RNGestureHandlerModule.ts +0 -27
- package/src/handlers/gestureHandlers.ts +0 -511
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Platform, } from 'react-native';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import GenericTouchable from './GenericTouchable';
|
|
4
|
-
/**
|
|
5
|
-
* TouchableNativeFeedback behaves slightly different than RN's TouchableNativeFeedback.
|
|
6
|
-
* There's small difference with handling long press ripple since RN's implementation calls
|
|
7
|
-
* ripple animation via bridge. This solution leaves all animations' handling for native components so
|
|
8
|
-
* it follows native behaviours.
|
|
9
|
-
*/
|
|
10
|
-
export default class TouchableNativeFeedback extends Component {
|
|
11
|
-
getExtraButtonProps() {
|
|
12
|
-
const extraProps = {};
|
|
13
|
-
const { background } = this.props;
|
|
14
|
-
if (background) {
|
|
15
|
-
// I changed type values to match those used in RN
|
|
16
|
-
// 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
|
|
17
|
-
if (background.type === 'RippleAndroid') {
|
|
18
|
-
extraProps['borderless'] = background.borderless;
|
|
19
|
-
extraProps['rippleColor'] = background.color;
|
|
20
|
-
}
|
|
21
|
-
else if (background.type === 'ThemeAttrAndroid') {
|
|
22
|
-
extraProps['borderless'] =
|
|
23
|
-
background.attribute === 'selectableItemBackgroundBorderless';
|
|
24
|
-
}
|
|
25
|
-
// I moved it from above since it should be available in all options
|
|
26
|
-
extraProps['rippleRadius'] = background.rippleRadius;
|
|
27
|
-
}
|
|
28
|
-
extraProps['foreground'] = this.props.useForeground;
|
|
29
|
-
return extraProps;
|
|
30
|
-
}
|
|
31
|
-
render() {
|
|
32
|
-
const { style = {}, ...rest } = this.props;
|
|
33
|
-
return (<GenericTouchable {...rest} style={style} extraButtonProps={this.getExtraButtonProps()}/>);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
TouchableNativeFeedback.defaultProps = {
|
|
37
|
-
...GenericTouchable.defaultProps,
|
|
38
|
-
useForeground: true,
|
|
39
|
-
extraButtonProps: {
|
|
40
|
-
// Disable hiding ripple on Android
|
|
41
|
-
rippleColor: null,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
// could be taken as RNTouchableNativeFeedback.SelectableBackground etc. but the API may change
|
|
45
|
-
TouchableNativeFeedback.SelectableBackground = (rippleRadius) => ({
|
|
46
|
-
type: 'ThemeAttrAndroid',
|
|
47
|
-
// I added `attribute` prop to clone the implementation of RN and be able to use only 2 types
|
|
48
|
-
attribute: 'selectableItemBackground',
|
|
49
|
-
rippleRadius,
|
|
50
|
-
});
|
|
51
|
-
TouchableNativeFeedback.SelectableBackgroundBorderless = (rippleRadius) => ({
|
|
52
|
-
type: 'ThemeAttrAndroid',
|
|
53
|
-
attribute: 'selectableItemBackgroundBorderless',
|
|
54
|
-
rippleRadius,
|
|
55
|
-
});
|
|
56
|
-
TouchableNativeFeedback.Ripple = (color, borderless, rippleRadius) => ({
|
|
57
|
-
type: 'RippleAndroid',
|
|
58
|
-
color,
|
|
59
|
-
borderless,
|
|
60
|
-
rippleRadius,
|
|
61
|
-
});
|
|
62
|
-
TouchableNativeFeedback.canUseNativeForeground = () => Platform.Version >= 23;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Animated, Easing, StyleSheet, View, } from 'react-native';
|
|
2
|
-
import GenericTouchable, { TOUCHABLE_STATE, } from './GenericTouchable';
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* TouchableOpacity bases on timing animation which has been used in RN's core
|
|
6
|
-
*/
|
|
7
|
-
export default class TouchableOpacity extends Component {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
// opacity is 1 one by default but could be overwritten
|
|
11
|
-
this.getChildStyleOpacityWithDefault = () => {
|
|
12
|
-
const childStyle = StyleSheet.flatten(this.props.style) || {};
|
|
13
|
-
return childStyle.opacity == null ? 1 : childStyle.opacity;
|
|
14
|
-
};
|
|
15
|
-
this.opacity = new Animated.Value(this.getChildStyleOpacityWithDefault());
|
|
16
|
-
this.setOpacityTo = (value, duration) => {
|
|
17
|
-
Animated.timing(this.opacity, {
|
|
18
|
-
toValue: value,
|
|
19
|
-
duration: duration,
|
|
20
|
-
easing: Easing.inOut(Easing.quad),
|
|
21
|
-
useNativeDriver: true,
|
|
22
|
-
}).start();
|
|
23
|
-
};
|
|
24
|
-
this.onStateChange = (_from, to) => {
|
|
25
|
-
if (to === TOUCHABLE_STATE.BEGAN) {
|
|
26
|
-
this.setOpacityTo(this.props.activeOpacity, 0);
|
|
27
|
-
}
|
|
28
|
-
else if (to === TOUCHABLE_STATE.UNDETERMINED ||
|
|
29
|
-
to === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
|
30
|
-
this.setOpacityTo(this.getChildStyleOpacityWithDefault(), 150);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
const { style = {}, ...rest } = this.props;
|
|
36
|
-
return (<GenericTouchable {...rest} style={[
|
|
37
|
-
style,
|
|
38
|
-
{
|
|
39
|
-
opacity: this.opacity,
|
|
40
|
-
},
|
|
41
|
-
]} onStateChange={this.onStateChange}>
|
|
42
|
-
{this.props.children ? this.props.children : <View />}
|
|
43
|
-
</GenericTouchable>);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
TouchableOpacity.defaultProps = {
|
|
47
|
-
...GenericTouchable.defaultProps,
|
|
48
|
-
activeOpacity: 0.2,
|
|
49
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import GenericTouchable from './GenericTouchable';
|
|
3
|
-
const TouchableWithoutFeedback = React.forwardRef((props, ref) => <GenericTouchable ref={ref} {...props}/>);
|
|
4
|
-
TouchableWithoutFeedback.defaultProps = GenericTouchable.defaultProps;
|
|
5
|
-
export default TouchableWithoutFeedback;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import 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
|
-
hoistNonReactStatics(Wrapper, Component);
|
|
13
|
-
return Wrapper;
|
|
14
|
-
}
|
|
15
|
-
const styles = StyleSheet.create({
|
|
16
|
-
container: { flex: 1 },
|
|
17
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { BaseGestureHandlerProps } from './gestureHandlers';
|
|
3
|
-
export interface NativeViewGestureHandlerProps extends BaseGestureHandlerProps<NativeViewGestureHandlerPayload> {
|
|
4
|
-
shouldActivateOnStart?: boolean;
|
|
5
|
-
disallowInterruption?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare type NativeViewGestureHandlerPayload = {
|
|
8
|
-
pointerInside: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const nativeViewProps: readonly ["id", "enabled", "minPointers", "waitFor", "simultaneousHandlers", "shouldCancelWhenOutside", "hitSlop", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange", "shouldActivateOnStart", "disallowInterruption"];
|
|
11
|
-
export declare type NativeViewGestureHandler = typeof NativeViewGestureHandler;
|
|
12
|
-
export declare const NativeViewGestureHandler: import("react").ComponentType<NativeViewGestureHandlerProps & import("react").RefAttributes<any>>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import createHandler from './createHandler';
|
|
2
|
-
import { baseProps } from './gestureHandlers';
|
|
3
|
-
export const nativeViewProps = [
|
|
4
|
-
...baseProps,
|
|
5
|
-
'shouldActivateOnStart',
|
|
6
|
-
'disallowInterruption',
|
|
7
|
-
];
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlers.ts file
|
|
9
|
-
export const NativeViewGestureHandler = createHandler({
|
|
10
|
-
name: 'NativeViewGestureHandler',
|
|
11
|
-
allowedProps: nativeViewProps,
|
|
12
|
-
config: {},
|
|
13
|
-
});
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { findNodeHandle as findNodeHandleRN, NativeModules, Platform, Touchable, } from 'react-native';
|
|
3
|
-
// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types
|
|
4
|
-
import deepEqual from 'fbjs/lib/areEqual';
|
|
5
|
-
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
6
|
-
import { State } from '../State';
|
|
7
|
-
function findNodeHandle(node) {
|
|
8
|
-
if (Platform.OS === 'web')
|
|
9
|
-
return node;
|
|
10
|
-
return findNodeHandleRN(node);
|
|
11
|
-
}
|
|
12
|
-
const { UIManager = {} } = NativeModules;
|
|
13
|
-
const customGHEventsConfig = {
|
|
14
|
-
onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },
|
|
15
|
-
onGestureHandlerStateChange: {
|
|
16
|
-
registrationName: 'onGestureHandlerStateChange',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
// Add gesture specific events to genericDirectEventTypes object exported from UIManager
|
|
20
|
-
// native module.
|
|
21
|
-
// Once new event types are registered with react it is possible to dispatch these
|
|
22
|
-
// events to all kind of native views.
|
|
23
|
-
UIManager.genericDirectEventTypes = {
|
|
24
|
-
...UIManager.genericDirectEventTypes,
|
|
25
|
-
...customGHEventsConfig,
|
|
26
|
-
};
|
|
27
|
-
// In newer versions of RN the `genericDirectEventTypes` is located in the object
|
|
28
|
-
// returned by UIManager.getConstants(), we need to add it there as well to make
|
|
29
|
-
// it compatible with RN 61+
|
|
30
|
-
if (UIManager.getConstants) {
|
|
31
|
-
UIManager.getConstants().genericDirectEventTypes = {
|
|
32
|
-
...UIManager.getConstants().genericDirectEventTypes,
|
|
33
|
-
...customGHEventsConfig,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
// Wrap JS responder calls and notify gesture handler manager
|
|
37
|
-
const { setJSResponder: oldSetJSResponder = () => {
|
|
38
|
-
//no operation
|
|
39
|
-
}, clearJSResponder: oldClearJSResponder = () => {
|
|
40
|
-
//no operation
|
|
41
|
-
}, } = UIManager;
|
|
42
|
-
UIManager.setJSResponder = (tag, blockNativeResponder) => {
|
|
43
|
-
RNGestureHandlerModule.handleSetJSResponder(tag, blockNativeResponder);
|
|
44
|
-
oldSetJSResponder(tag, blockNativeResponder);
|
|
45
|
-
};
|
|
46
|
-
UIManager.clearJSResponder = () => {
|
|
47
|
-
RNGestureHandlerModule.handleClearJSResponder();
|
|
48
|
-
oldClearJSResponder();
|
|
49
|
-
};
|
|
50
|
-
let handlerTag = 1;
|
|
51
|
-
const handlerIDToTag = {};
|
|
52
|
-
function isConfigParam(param, name) {
|
|
53
|
-
// param !== Object(param) returns false if `param` is a function
|
|
54
|
-
// or an object and returns true if `param` is null
|
|
55
|
-
return (param !== undefined &&
|
|
56
|
-
(param !== Object(param) ||
|
|
57
|
-
!('__isNative' in param)) &&
|
|
58
|
-
name !== 'onHandlerStateChange' &&
|
|
59
|
-
name !== 'onGestureEvent');
|
|
60
|
-
}
|
|
61
|
-
function filterConfig(props, validProps, defaults = {}) {
|
|
62
|
-
const res = { ...defaults };
|
|
63
|
-
validProps.forEach((key) => {
|
|
64
|
-
const value = props[key];
|
|
65
|
-
if (isConfigParam(value, key)) {
|
|
66
|
-
let value = props[key];
|
|
67
|
-
if (key === 'simultaneousHandlers' || key === 'waitFor') {
|
|
68
|
-
value = transformIntoHandlerTags(props[key]);
|
|
69
|
-
}
|
|
70
|
-
else if (key === 'hitSlop') {
|
|
71
|
-
if (typeof value !== 'object') {
|
|
72
|
-
value = { top: value, left: value, bottom: value, right: value };
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
res[key] = value;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return res;
|
|
79
|
-
}
|
|
80
|
-
function transformIntoHandlerTags(handlerIDs) {
|
|
81
|
-
if (!Array.isArray(handlerIDs)) {
|
|
82
|
-
handlerIDs = [handlerIDs];
|
|
83
|
-
}
|
|
84
|
-
if (Platform.OS === 'web') {
|
|
85
|
-
return handlerIDs
|
|
86
|
-
.map(({ current }) => current)
|
|
87
|
-
.filter((handle) => handle);
|
|
88
|
-
}
|
|
89
|
-
// converts handler string IDs into their numeric tags
|
|
90
|
-
return handlerIDs
|
|
91
|
-
.map((handlerID) => handlerIDToTag[handlerID] || handlerID.current?._handlerTag || -1)
|
|
92
|
-
.filter((handlerTag) => handlerTag > 0);
|
|
93
|
-
}
|
|
94
|
-
function hasUnresolvedRefs(props) {
|
|
95
|
-
// TODO(TS) - add type for extract arg
|
|
96
|
-
const extract = (refs) => {
|
|
97
|
-
if (!Array.isArray(refs)) {
|
|
98
|
-
return refs && refs.current === null;
|
|
99
|
-
}
|
|
100
|
-
return refs.some((r) => r && r.current === null);
|
|
101
|
-
};
|
|
102
|
-
return extract(props['simultaneousHandlers']) || extract(props['waitFor']);
|
|
103
|
-
}
|
|
104
|
-
const stateToPropMappings = {
|
|
105
|
-
[State.UNDETERMINED]: undefined,
|
|
106
|
-
[State.BEGAN]: 'onBegan',
|
|
107
|
-
[State.FAILED]: 'onFailed',
|
|
108
|
-
[State.CANCELLED]: 'onCancelled',
|
|
109
|
-
[State.ACTIVE]: 'onActivated',
|
|
110
|
-
[State.END]: 'onEnded',
|
|
111
|
-
};
|
|
112
|
-
// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
|
113
|
-
export default function createHandler({ name, allowedProps = [], config = {}, transformProps, customNativeProps = [], }) {
|
|
114
|
-
class Handler extends React.Component {
|
|
115
|
-
constructor(props) {
|
|
116
|
-
super(props);
|
|
117
|
-
this.updateEnqueued = null;
|
|
118
|
-
this.onGestureHandlerEvent = (event) => {
|
|
119
|
-
if (event.nativeEvent.handlerTag === this.handlerTag) {
|
|
120
|
-
this.props.onGestureEvent?.(event);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.props.onGestureHandlerEvent?.(event);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
// TODO(TS) - make sure this is right type for event
|
|
127
|
-
this.onGestureHandlerStateChange = (event) => {
|
|
128
|
-
if (event.nativeEvent.handlerTag === this.handlerTag) {
|
|
129
|
-
this.props.onHandlerStateChange?.(event);
|
|
130
|
-
const state = event.nativeEvent.state;
|
|
131
|
-
const stateEventName = stateToPropMappings[state];
|
|
132
|
-
const eventHandler = stateEventName && this.props[stateEventName];
|
|
133
|
-
if (eventHandler && typeof eventHandler === 'function') {
|
|
134
|
-
eventHandler(event);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
this.props.onGestureHandlerStateChange?.(event);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
this.refHandler = (node) => {
|
|
142
|
-
this.viewNode = node;
|
|
143
|
-
const child = React.Children.only(this.props.children);
|
|
144
|
-
// TODO(TS) fix ref type
|
|
145
|
-
const { ref } = child;
|
|
146
|
-
if (ref !== null) {
|
|
147
|
-
if (typeof ref === 'function') {
|
|
148
|
-
ref(node);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
ref.current = node;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
this.createGestureHandler = (newConfig) => {
|
|
156
|
-
this.config = newConfig;
|
|
157
|
-
RNGestureHandlerModule.createGestureHandler(name, this.handlerTag, newConfig);
|
|
158
|
-
};
|
|
159
|
-
this.attachGestureHandler = (newViewTag) => {
|
|
160
|
-
this.viewTag = newViewTag;
|
|
161
|
-
if (Platform.OS === 'web') {
|
|
162
|
-
// typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
|
|
163
|
-
RNGestureHandlerModule.attachGestureHandler(this.handlerTag, newViewTag, this.propsRef);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
RNGestureHandlerModule.attachGestureHandler(this.handlerTag, newViewTag);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
this.updateGestureHandler = (newConfig) => {
|
|
170
|
-
this.config = newConfig;
|
|
171
|
-
RNGestureHandlerModule.updateGestureHandler(this.handlerTag, newConfig);
|
|
172
|
-
};
|
|
173
|
-
this.handlerTag = handlerTag++;
|
|
174
|
-
this.config = {};
|
|
175
|
-
this.propsRef = React.createRef();
|
|
176
|
-
if (props.id) {
|
|
177
|
-
if (handlerIDToTag[props.id] !== undefined) {
|
|
178
|
-
throw new Error(`Handler with ID "${props.id}" already registered`);
|
|
179
|
-
}
|
|
180
|
-
handlerIDToTag[props.id] = this.handlerTag;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
componentDidMount() {
|
|
184
|
-
const props = this.props;
|
|
185
|
-
if (hasUnresolvedRefs(props)) {
|
|
186
|
-
// If there are unresolved refs (e.g. ".current" has not yet been set)
|
|
187
|
-
// passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to
|
|
188
|
-
// _update method that will try to update native handler props using
|
|
189
|
-
// setImmediate. This makes it so _update function gets called after all
|
|
190
|
-
// react components are mounted and we expect the missing ref object to
|
|
191
|
-
// be resolved by then.
|
|
192
|
-
this.updateEnqueued = setImmediate(() => {
|
|
193
|
-
this.updateEnqueued = null;
|
|
194
|
-
this.update();
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
this.createGestureHandler(filterConfig(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config));
|
|
198
|
-
this.attachGestureHandler(findNodeHandle(this.viewNode)); // TODO(TS) - check if this can be null
|
|
199
|
-
}
|
|
200
|
-
componentDidUpdate() {
|
|
201
|
-
const viewTag = findNodeHandle(this.viewNode);
|
|
202
|
-
if (this.viewTag !== viewTag) {
|
|
203
|
-
this.attachGestureHandler(viewTag); // TODO(TS) - check interaction between _viewTag & findNodeHandle
|
|
204
|
-
}
|
|
205
|
-
this.update();
|
|
206
|
-
}
|
|
207
|
-
componentWillUnmount() {
|
|
208
|
-
RNGestureHandlerModule.dropGestureHandler(this.handlerTag);
|
|
209
|
-
if (this.updateEnqueued) {
|
|
210
|
-
clearImmediate(this.updateEnqueued);
|
|
211
|
-
}
|
|
212
|
-
// We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context
|
|
213
|
-
const handlerID = this.props.id;
|
|
214
|
-
if (handlerID) {
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
216
|
-
delete handlerIDToTag[handlerID];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
update() {
|
|
220
|
-
const newConfig = filterConfig(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config);
|
|
221
|
-
if (!deepEqual(this.config, newConfig)) {
|
|
222
|
-
this.updateGestureHandler(newConfig);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
setNativeProps(updates) {
|
|
226
|
-
const mergedProps = { ...this.props, ...updates };
|
|
227
|
-
const newConfig = filterConfig(transformProps ? transformProps(mergedProps) : mergedProps, [...allowedProps, ...customNativeProps], config);
|
|
228
|
-
this.updateGestureHandler(newConfig);
|
|
229
|
-
}
|
|
230
|
-
render() {
|
|
231
|
-
let gestureEventHandler = this.onGestureHandlerEvent;
|
|
232
|
-
const { onGestureEvent, onGestureHandlerEvent, } = this.props;
|
|
233
|
-
if (onGestureEvent && typeof onGestureEvent !== 'function') {
|
|
234
|
-
// If it's not a method it should be an native Animated.event
|
|
235
|
-
// object. We set it directly as the handler for the view
|
|
236
|
-
// In this case nested handlers are not going to be supported
|
|
237
|
-
if (onGestureHandlerEvent) {
|
|
238
|
-
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
|
239
|
-
}
|
|
240
|
-
gestureEventHandler = onGestureEvent;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
if (onGestureHandlerEvent &&
|
|
244
|
-
typeof onGestureHandlerEvent !== 'function') {
|
|
245
|
-
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
let gestureStateEventHandler = this.onGestureHandlerStateChange;
|
|
249
|
-
const { onHandlerStateChange, onGestureHandlerStateChange, } = this.props;
|
|
250
|
-
if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {
|
|
251
|
-
// If it's not a method it should be an native Animated.event
|
|
252
|
-
// object. We set it directly as the handler for the view
|
|
253
|
-
// In this case nested handlers are not going to be supported
|
|
254
|
-
if (onGestureHandlerStateChange) {
|
|
255
|
-
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
|
256
|
-
}
|
|
257
|
-
gestureStateEventHandler = onHandlerStateChange;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
if (onGestureHandlerStateChange &&
|
|
261
|
-
typeof onGestureHandlerStateChange !== 'function') {
|
|
262
|
-
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const events = {
|
|
266
|
-
onGestureHandlerEvent: gestureEventHandler,
|
|
267
|
-
onGestureHandlerStateChange: gestureStateEventHandler,
|
|
268
|
-
};
|
|
269
|
-
this.propsRef.current = events;
|
|
270
|
-
const child = React.Children.only(this.props.children);
|
|
271
|
-
let grandChildren = child.props.children;
|
|
272
|
-
if (Touchable.TOUCH_TARGET_DEBUG &&
|
|
273
|
-
child.type &&
|
|
274
|
-
(child.type === 'RNGestureHandlerButton' ||
|
|
275
|
-
child.type.name === 'View' ||
|
|
276
|
-
child.type.displayName === 'View')) {
|
|
277
|
-
grandChildren = React.Children.toArray(grandChildren);
|
|
278
|
-
grandChildren.push(Touchable.renderDebugView({
|
|
279
|
-
color: 'mediumspringgreen',
|
|
280
|
-
hitSlop: child.props.hitSlop,
|
|
281
|
-
}));
|
|
282
|
-
}
|
|
283
|
-
return React.cloneElement(child, {
|
|
284
|
-
ref: this.refHandler,
|
|
285
|
-
collapsable: false,
|
|
286
|
-
...events,
|
|
287
|
-
}, grandChildren);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
Handler.displayName = name;
|
|
291
|
-
return Handler;
|
|
292
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { NativeViewGestureHandler, nativeViewProps, } from './NativeViewGestureHandler';
|
|
3
|
-
/*
|
|
4
|
-
* This array should consist of:
|
|
5
|
-
* - All keys in propTypes from NativeGestureHandler
|
|
6
|
-
* (and all keys in GestureHandlerPropTypes)
|
|
7
|
-
* - 'onGestureHandlerEvent'
|
|
8
|
-
* - 'onGestureHandlerStateChange'
|
|
9
|
-
*/
|
|
10
|
-
const NATIVE_WRAPPER_PROPS_FILTER = [
|
|
11
|
-
...nativeViewProps,
|
|
12
|
-
'onGestureHandlerEvent',
|
|
13
|
-
'onGestureHandlerStateChange',
|
|
14
|
-
];
|
|
15
|
-
export default function createNativeWrapper(Component, config = {}) {
|
|
16
|
-
const ComponentWrapper = React.forwardRef((props, ref) => {
|
|
17
|
-
// filter out props that should be passed to gesture handler wrapper
|
|
18
|
-
const gestureHandlerProps = Object.keys(props).reduce((res, key) => {
|
|
19
|
-
// TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
|
|
20
|
-
const allowedKeys = NATIVE_WRAPPER_PROPS_FILTER;
|
|
21
|
-
if (allowedKeys.includes(key)) {
|
|
22
|
-
// @ts-ignore FIXME(TS)
|
|
23
|
-
res[key] = props[key];
|
|
24
|
-
}
|
|
25
|
-
return res;
|
|
26
|
-
}, { ...config } // watch out not to modify config
|
|
27
|
-
);
|
|
28
|
-
const _ref = useRef();
|
|
29
|
-
const _gestureHandlerRef = useRef();
|
|
30
|
-
useImperativeHandle(ref,
|
|
31
|
-
// @ts-ignore TODO(TS) decide how nulls work in this context
|
|
32
|
-
() => {
|
|
33
|
-
const node = _gestureHandlerRef.current;
|
|
34
|
-
// add handlerTag for relations config
|
|
35
|
-
if (_ref.current && node) {
|
|
36
|
-
// @ts-ignore FIXME(TS) think about createHandler return type
|
|
37
|
-
_ref.current._handlerTag = node._handlerTag;
|
|
38
|
-
return _ref.current;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
}, [_ref, _gestureHandlerRef]);
|
|
42
|
-
return (<NativeViewGestureHandler {...gestureHandlerProps}
|
|
43
|
-
// @ts-ignore TODO(TS)
|
|
44
|
-
ref={_gestureHandlerRef}>
|
|
45
|
-
<Component {...props} ref={_ref}/>
|
|
46
|
-
</NativeViewGestureHandler>);
|
|
47
|
-
});
|
|
48
|
-
ComponentWrapper.displayName = Component.displayName || 'ComponentWrapper';
|
|
49
|
-
return ComponentWrapper;
|
|
50
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { State } from '../State';
|
|
3
|
-
import { ValueOf } from '../typeUtils';
|
|
4
|
-
export interface GestureEventPayload {
|
|
5
|
-
handlerTag: number;
|
|
6
|
-
numberOfPointers: number;
|
|
7
|
-
state: ValueOf<typeof State>;
|
|
8
|
-
}
|
|
9
|
-
export interface HandlerStateChangeEventPayload {
|
|
10
|
-
handlerTag: number;
|
|
11
|
-
numberOfPointers: number;
|
|
12
|
-
state: ValueOf<typeof State>;
|
|
13
|
-
oldState: ValueOf<typeof State>;
|
|
14
|
-
}
|
|
15
|
-
export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
16
|
-
nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
|
|
17
|
-
}
|
|
18
|
-
export interface HandlerStateChangeEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
19
|
-
nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
|
|
20
|
-
}
|
|
21
|
-
export declare type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = {
|
|
22
|
-
id?: string;
|
|
23
|
-
enabled?: boolean;
|
|
24
|
-
minPointers?: number;
|
|
25
|
-
waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
26
|
-
simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
27
|
-
shouldCancelWhenOutside?: boolean;
|
|
28
|
-
hitSlop?: number | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
|
|
29
|
-
onBegan?: (event: HandlerStateChangeEvent) => void;
|
|
30
|
-
onFailed?: (event: HandlerStateChangeEvent) => void;
|
|
31
|
-
onCancelled?: (event: HandlerStateChangeEvent) => void;
|
|
32
|
-
onActivated?: (event: HandlerStateChangeEvent) => void;
|
|
33
|
-
onEnded?: (event: HandlerStateChangeEvent) => void;
|
|
34
|
-
onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;
|
|
35
|
-
onHandlerStateChange?: (event: HandlerStateChangeEvent<ExtraEventPayloadT>) => void;
|
|
36
|
-
};
|
|
37
|
-
export declare const baseProps: readonly ["id", "enabled", "minPointers", "waitFor", "simultaneousHandlers", "shouldCancelWhenOutside", "hitSlop", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
|
|
38
|
-
export declare type TapGestureHandlerEventPayload = {
|
|
39
|
-
x: number;
|
|
40
|
-
y: number;
|
|
41
|
-
absoluteX: number;
|
|
42
|
-
absoluteY: number;
|
|
43
|
-
};
|
|
44
|
-
export interface TapGestureHandlerProps extends BaseGestureHandlerProps<TapGestureHandlerEventPayload> {
|
|
45
|
-
minPointers?: number;
|
|
46
|
-
maxDurationMs?: number;
|
|
47
|
-
maxDelayMs?: number;
|
|
48
|
-
numberOfTaps?: number;
|
|
49
|
-
maxDeltaX?: number;
|
|
50
|
-
maxDeltaY?: number;
|
|
51
|
-
maxDist?: number;
|
|
52
|
-
}
|
|
53
|
-
export declare type TapGestureHandler = typeof TapGestureHandler;
|
|
54
|
-
export declare const TapGestureHandler: React.ComponentType<TapGestureHandlerProps & React.RefAttributes<any>>;
|
|
55
|
-
export declare type FlingGestureHandlerEventPayload = {
|
|
56
|
-
x: number;
|
|
57
|
-
y: number;
|
|
58
|
-
absoluteX: number;
|
|
59
|
-
absoluteY: number;
|
|
60
|
-
};
|
|
61
|
-
export interface FlingGestureHandlerProps extends BaseGestureHandlerProps<FlingGestureHandlerEventPayload> {
|
|
62
|
-
direction?: number;
|
|
63
|
-
numberOfPointers?: number;
|
|
64
|
-
}
|
|
65
|
-
export declare type FlingGestureHandler = typeof FlingGestureHandler;
|
|
66
|
-
export declare const FlingGestureHandler: React.ComponentType<FlingGestureHandlerProps & React.RefAttributes<any>>;
|
|
67
|
-
declare class ForceTouchFallback extends React.Component {
|
|
68
|
-
static forceTouchAvailable: boolean;
|
|
69
|
-
componentDidMount(): void;
|
|
70
|
-
render(): React.ReactNode;
|
|
71
|
-
}
|
|
72
|
-
export declare type ForceTouchGestureHandlerEventPayload = {
|
|
73
|
-
x: number;
|
|
74
|
-
y: number;
|
|
75
|
-
absoluteX: number;
|
|
76
|
-
absoluteY: number;
|
|
77
|
-
force: number;
|
|
78
|
-
};
|
|
79
|
-
export interface ForceTouchGestureHandlerProps extends BaseGestureHandlerProps<ForceTouchGestureHandlerEventPayload> {
|
|
80
|
-
minForce?: number;
|
|
81
|
-
maxForce?: number;
|
|
82
|
-
feedbackOnActivation?: boolean;
|
|
83
|
-
}
|
|
84
|
-
export declare type ForceTouchGestureHandler = typeof ForceTouchGestureHandler & {
|
|
85
|
-
forceTouchAvailable: boolean;
|
|
86
|
-
};
|
|
87
|
-
export declare const ForceTouchGestureHandler: typeof ForceTouchFallback | React.ComponentClass<ForceTouchGestureHandlerProps & React.RefAttributes<any>, any> | React.FunctionComponent<ForceTouchGestureHandlerProps & React.RefAttributes<any>>;
|
|
88
|
-
export declare type LongPressGestureHandlerEventPayload = {
|
|
89
|
-
x: number;
|
|
90
|
-
y: number;
|
|
91
|
-
absoluteX: number;
|
|
92
|
-
absoluteY: number;
|
|
93
|
-
};
|
|
94
|
-
export interface LongPressGestureHandlerProps extends BaseGestureHandlerProps<LongPressGestureHandlerEventPayload> {
|
|
95
|
-
minDurationMs?: number;
|
|
96
|
-
maxDist?: number;
|
|
97
|
-
}
|
|
98
|
-
export declare type LongPressGestureHandler = typeof LongPressGestureHandler;
|
|
99
|
-
export declare const LongPressGestureHandler: React.ComponentType<LongPressGestureHandlerProps & React.RefAttributes<any>>;
|
|
100
|
-
export declare type PanGestureHandlerEventPayload = {
|
|
101
|
-
x: number;
|
|
102
|
-
y: number;
|
|
103
|
-
absoluteX: number;
|
|
104
|
-
absoluteY: number;
|
|
105
|
-
translationX: number;
|
|
106
|
-
translationY: number;
|
|
107
|
-
velocityX: number;
|
|
108
|
-
velocityY: number;
|
|
109
|
-
};
|
|
110
|
-
export interface PanGestureHandlerProps extends BaseGestureHandlerProps<PanGestureHandlerEventPayload> {
|
|
111
|
-
/** @deprecated use activeOffsetX*/
|
|
112
|
-
minDeltaX?: number;
|
|
113
|
-
/** @deprecated use activeOffsetY*/
|
|
114
|
-
minDeltaY?: number;
|
|
115
|
-
/** @deprecated use failOffsetX*/
|
|
116
|
-
maxDeltaX?: number;
|
|
117
|
-
/** @deprecated use failOffsetY*/
|
|
118
|
-
maxDeltaY?: number;
|
|
119
|
-
/** @deprecated use activeOffsetX*/
|
|
120
|
-
minOffsetX?: number;
|
|
121
|
-
/** @deprecated use failOffsetY*/
|
|
122
|
-
minOffsetY?: number;
|
|
123
|
-
activeOffsetY?: number | number[];
|
|
124
|
-
activeOffsetX?: number | number[];
|
|
125
|
-
failOffsetY?: number | number[];
|
|
126
|
-
failOffsetX?: number | number[];
|
|
127
|
-
minDist?: number;
|
|
128
|
-
minVelocity?: number;
|
|
129
|
-
minVelocityX?: number;
|
|
130
|
-
minVelocityY?: number;
|
|
131
|
-
minPointers?: number;
|
|
132
|
-
maxPointers?: number;
|
|
133
|
-
avgTouches?: boolean;
|
|
134
|
-
enableTrackpadTwoFingerGesture?: boolean;
|
|
135
|
-
}
|
|
136
|
-
export declare type PanGestureHandler = typeof PanGestureHandler;
|
|
137
|
-
export declare const PanGestureHandler: React.ComponentType<PanGestureHandlerProps & React.RefAttributes<any>>;
|
|
138
|
-
export declare type PinchGestureHandlerEventPayload = {
|
|
139
|
-
scale: number;
|
|
140
|
-
focalX: number;
|
|
141
|
-
focalY: number;
|
|
142
|
-
velocity: number;
|
|
143
|
-
};
|
|
144
|
-
export interface PinchGestureHandlerProps extends BaseGestureHandlerProps<PinchGestureHandlerEventPayload> {
|
|
145
|
-
}
|
|
146
|
-
export declare type PinchGestureHandler = typeof PinchGestureHandler;
|
|
147
|
-
export declare const PinchGestureHandler: React.ComponentType<PinchGestureHandlerProps & React.RefAttributes<any>>;
|
|
148
|
-
export declare type RotationGestureHandlerEventPayload = {
|
|
149
|
-
rotation: number;
|
|
150
|
-
anchorX: number;
|
|
151
|
-
anchorY: number;
|
|
152
|
-
velocity: number;
|
|
153
|
-
};
|
|
154
|
-
export interface RotationGestureHandlerProps extends BaseGestureHandlerProps<RotationGestureHandlerEventPayload> {
|
|
155
|
-
}
|
|
156
|
-
export declare type RotationGestureHandler = typeof RotationGestureHandler;
|
|
157
|
-
export declare const RotationGestureHandler: React.ComponentType<RotationGestureHandlerProps & React.RefAttributes<any>>;
|
|
158
|
-
export {};
|