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,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
PropsWithChildren,
|
|
4
|
+
ForwardedRef,
|
|
5
|
+
RefAttributes,
|
|
6
|
+
ReactElement,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import {
|
|
3
9
|
ScrollView as RNScrollView,
|
|
4
10
|
ScrollViewProps as RNScrollViewProps,
|
|
@@ -14,7 +20,10 @@ import {
|
|
|
14
20
|
|
|
15
21
|
import createNativeWrapper from '../handlers/createNativeWrapper';
|
|
16
22
|
|
|
17
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
NativeViewGestureHandlerProps,
|
|
25
|
+
nativeViewProps,
|
|
26
|
+
} from '../handlers/NativeViewGestureHandler';
|
|
18
27
|
|
|
19
28
|
export const ScrollView = createNativeWrapper<
|
|
20
29
|
PropsWithChildren<RNScrollViewProps>
|
|
@@ -23,15 +32,9 @@ export const ScrollView = createNativeWrapper<
|
|
|
23
32
|
shouldCancelWhenOutside: false,
|
|
24
33
|
});
|
|
25
34
|
// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
|
35
|
+
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
|
26
36
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
27
|
-
export type ScrollView = typeof ScrollView &
|
|
28
|
-
scrollTo(
|
|
29
|
-
y?: number | { x?: number; y?: number; animated?: boolean },
|
|
30
|
-
x?: number,
|
|
31
|
-
animated?: boolean
|
|
32
|
-
): void;
|
|
33
|
-
scrollToEnd(options?: { animated: boolean }): void;
|
|
34
|
-
};
|
|
37
|
+
export type ScrollView = typeof ScrollView & RNScrollView;
|
|
35
38
|
|
|
36
39
|
export const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {
|
|
37
40
|
shouldCancelWhenOutside: false,
|
|
@@ -39,47 +42,51 @@ export const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {
|
|
|
39
42
|
disallowInterruption: true,
|
|
40
43
|
});
|
|
41
44
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
42
|
-
export type Switch = typeof Switch;
|
|
45
|
+
export type Switch = typeof Switch & RNSwitch;
|
|
43
46
|
|
|
44
47
|
export const TextInput = createNativeWrapper<RNTextInputProps>(RNTextInput);
|
|
45
48
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
46
|
-
export type TextInput = typeof TextInput;
|
|
49
|
+
export type TextInput = typeof TextInput & RNTextInput;
|
|
47
50
|
|
|
48
51
|
export const DrawerLayoutAndroid = createNativeWrapper<
|
|
49
52
|
PropsWithChildren<RNDrawerLayoutAndroidProps>
|
|
50
53
|
>(RNDrawerLayoutAndroid, { disallowInterruption: true });
|
|
51
|
-
// we use literal object since TS gives error when using RN's `positions`
|
|
52
|
-
// @ts-ignore FIXME(TS) maybe this should be removed?
|
|
53
|
-
DrawerLayoutAndroid.positions = { Left: 'left', Right: 'right' };
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
55
|
-
export type DrawerLayoutAndroid = typeof DrawerLayoutAndroid
|
|
55
|
+
export type DrawerLayoutAndroid = typeof DrawerLayoutAndroid &
|
|
56
|
+
RNDrawerLayoutAndroid;
|
|
56
57
|
|
|
57
|
-
export const FlatList = React.forwardRef
|
|
58
|
-
|
|
58
|
+
export const FlatList = React.forwardRef((props, ref) => {
|
|
59
|
+
const flatListProps = {};
|
|
60
|
+
const scrollViewProps = {};
|
|
61
|
+
for (const [propName, value] of Object.entries(props)) {
|
|
62
|
+
// https://github.com/microsoft/TypeScript/issues/26255
|
|
63
|
+
if ((nativeViewProps as readonly string[]).includes(propName)) {
|
|
64
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
66
|
+
scrollViewProps[propName] = value;
|
|
67
|
+
} else {
|
|
68
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
70
|
+
flatListProps[propName] = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
59
75
|
<RNFlatList
|
|
60
76
|
ref={ref}
|
|
61
|
-
{...
|
|
62
|
-
renderScrollComponent={(scrollProps) =>
|
|
77
|
+
{...flatListProps}
|
|
78
|
+
renderScrollComponent={(scrollProps) => (
|
|
79
|
+
<ScrollView {...{ ...scrollProps, ...scrollViewProps }} />
|
|
80
|
+
)}
|
|
63
81
|
/>
|
|
64
|
-
)
|
|
65
|
-
)
|
|
82
|
+
);
|
|
83
|
+
}) as <ItemT = any>(
|
|
84
|
+
props: PropsWithChildren<
|
|
85
|
+
RNFlatListProps<ItemT> &
|
|
86
|
+
RefAttributes<FlatList<ItemT>> &
|
|
87
|
+
NativeViewGestureHandlerProps
|
|
88
|
+
>,
|
|
89
|
+
ref: ForwardedRef<FlatList<ItemT>>
|
|
90
|
+
) => ReactElement | null;
|
|
66
91
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
67
|
-
export type FlatList<ItemT> =
|
|
68
|
-
RNFlatListProps<ItemT> &
|
|
69
|
-
NativeViewGestureHandlerProps &
|
|
70
|
-
React.RefAttributes<any>
|
|
71
|
-
> & {
|
|
72
|
-
scrollToEnd: (params?: { animated?: boolean }) => void;
|
|
73
|
-
scrollToIndex: (params: {
|
|
74
|
-
animated?: boolean;
|
|
75
|
-
index: number;
|
|
76
|
-
viewOffset?: number;
|
|
77
|
-
viewPosition?: number;
|
|
78
|
-
}) => void;
|
|
79
|
-
scrollToItem: (params: {
|
|
80
|
-
animated?: boolean;
|
|
81
|
-
item: ItemT;
|
|
82
|
-
viewPosition?: number;
|
|
83
|
-
}) => void;
|
|
84
|
-
scrollToOffset: (params: { animated?: boolean; offset: number }) => void;
|
|
85
|
-
};
|
|
92
|
+
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
|
File without changes
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Similarily to the DrawerLayout component this deserves to be put in a
|
|
2
|
-
// separate repo. Although, keeping it here for the time being will allow us
|
|
3
|
-
//
|
|
2
|
+
// separate repo. Although, keeping it here for the time being will allow us to
|
|
3
|
+
// move faster and fix possible issues quicker
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Component } from 'react';
|
|
6
7
|
import {
|
|
7
8
|
Animated,
|
|
8
9
|
StyleSheet,
|
|
@@ -14,14 +15,18 @@ import {
|
|
|
14
15
|
} from 'react-native';
|
|
15
16
|
|
|
16
17
|
import {
|
|
17
|
-
PanGestureHandler,
|
|
18
|
-
TapGestureHandler,
|
|
19
|
-
PanGestureHandlerProps,
|
|
20
18
|
GestureEvent,
|
|
21
|
-
PanGestureHandlerEventPayload,
|
|
22
19
|
HandlerStateChangeEvent,
|
|
20
|
+
} from '../handlers/gestureHandlerCommon';
|
|
21
|
+
import {
|
|
22
|
+
PanGestureHandler,
|
|
23
|
+
PanGestureHandlerEventPayload,
|
|
24
|
+
PanGestureHandlerProps,
|
|
25
|
+
} from '../handlers/PanGestureHandler';
|
|
26
|
+
import {
|
|
27
|
+
TapGestureHandler,
|
|
23
28
|
TapGestureHandlerEventPayload,
|
|
24
|
-
} from '../handlers/
|
|
29
|
+
} from '../handlers/TapGestureHandler';
|
|
25
30
|
import { State } from '../State';
|
|
26
31
|
|
|
27
32
|
const DRAG_TOSS = 0.05;
|
|
@@ -31,30 +36,105 @@ type SwipeableExcludes = Exclude<
|
|
|
31
36
|
'onGestureEvent' | 'onHandlerStateChange'
|
|
32
37
|
>;
|
|
33
38
|
|
|
34
|
-
interface SwipeableProps
|
|
39
|
+
export interface SwipeableProps
|
|
35
40
|
extends Pick<PanGestureHandlerProps, SwipeableExcludes> {
|
|
41
|
+
/**
|
|
42
|
+
* Enables two-finger gestures on supported devices, for example iPads with
|
|
43
|
+
* trackpads. If not enabled the gesture will require click + drag, with
|
|
44
|
+
* `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger
|
|
45
|
+
* the gesture.
|
|
46
|
+
*/
|
|
36
47
|
enableTrackpadTwoFingerGesture?: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Specifies how much the visual interaction will be delayed compared to the
|
|
51
|
+
* gesture distance. e.g. value of 1 will indicate that the swipeable panel
|
|
52
|
+
* should exactly follow the gesture, 2 means it is going to be two times
|
|
53
|
+
* "slower".
|
|
54
|
+
*/
|
|
37
55
|
friction?: number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Distance from the left edge at which released panel will animate to the
|
|
59
|
+
* open state (or the open panel will animate into the closed state). By
|
|
60
|
+
* default it's a half of the panel's width.
|
|
61
|
+
*/
|
|
38
62
|
leftThreshold?: number;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Distance from the right edge at which released panel will animate to the
|
|
66
|
+
* open state (or the open panel will animate into the closed state). By
|
|
67
|
+
* default it's a half of the panel's width.
|
|
68
|
+
*/
|
|
39
69
|
rightThreshold?: number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Value indicating if the swipeable panel can be pulled further than the left
|
|
73
|
+
* actions panel's width. It is set to true by default as long as the left
|
|
74
|
+
* panel render method is present.
|
|
75
|
+
*/
|
|
40
76
|
overshootLeft?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Value indicating if the swipeable panel can be pulled further than the
|
|
80
|
+
* right actions panel's width. It is set to true by default as long as the
|
|
81
|
+
* right panel render method is present.
|
|
82
|
+
*/
|
|
41
83
|
overshootRight?: boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Specifies how much the visual interaction will be delayed compared to the
|
|
87
|
+
* gesture distance at overshoot. Default value is 1, it mean no friction, for
|
|
88
|
+
* a native feel, try 8 or above.
|
|
89
|
+
*/
|
|
42
90
|
overshootFriction?: number;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Called when left action panel gets open.
|
|
94
|
+
*/
|
|
43
95
|
onSwipeableLeftOpen?: () => void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Called when right action panel gets open.
|
|
99
|
+
*/
|
|
44
100
|
onSwipeableRightOpen?: () => void;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Called when action panel gets open (either right or left).
|
|
104
|
+
*/
|
|
45
105
|
onSwipeableOpen?: () => void;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Called when action panel is closed.
|
|
109
|
+
*/
|
|
46
110
|
onSwipeableClose?: () => void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Called when left action panel starts animating on open.
|
|
114
|
+
*/
|
|
47
115
|
onSwipeableLeftWillOpen?: () => void;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Called when right action panel starts animating on open.
|
|
119
|
+
*/
|
|
48
120
|
onSwipeableRightWillOpen?: () => void;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Called when action panel starts animating on open (either right or left).
|
|
124
|
+
*/
|
|
49
125
|
onSwipeableWillOpen?: () => void;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Called when action panel starts animating on close.
|
|
129
|
+
*/
|
|
50
130
|
onSwipeableWillClose?: () => void;
|
|
131
|
+
|
|
51
132
|
/**
|
|
52
133
|
*
|
|
53
134
|
* This map describes the values to use as inputRange for extra interpolation:
|
|
54
135
|
* AnimatedValue: [startValue, endValue]
|
|
55
136
|
*
|
|
56
|
-
* progressAnimatedValue: [0, 1]
|
|
57
|
-
* dragAnimatedValue: [0, +]
|
|
137
|
+
* progressAnimatedValue: [0, 1] dragAnimatedValue: [0, +]
|
|
58
138
|
*
|
|
59
139
|
* To support `rtl` flexbox layouts use `flexDirection` styling.
|
|
60
140
|
* */
|
|
@@ -67,8 +147,7 @@ interface SwipeableProps
|
|
|
67
147
|
* This map describes the values to use as inputRange for extra interpolation:
|
|
68
148
|
* AnimatedValue: [startValue, endValue]
|
|
69
149
|
*
|
|
70
|
-
* progressAnimatedValue: [0, 1]
|
|
71
|
-
* dragAnimatedValue: [0, -]
|
|
150
|
+
* progressAnimatedValue: [0, 1] dragAnimatedValue: [0, -]
|
|
72
151
|
*
|
|
73
152
|
* To support `rtl` flexbox layouts use `flexDirection` styling.
|
|
74
153
|
* */
|
|
@@ -76,9 +155,21 @@ interface SwipeableProps
|
|
|
76
155
|
progressAnimatedValue: Animated.AnimatedInterpolation,
|
|
77
156
|
dragAnimatedValue: Animated.AnimatedInterpolation
|
|
78
157
|
) => React.ReactNode;
|
|
158
|
+
|
|
79
159
|
useNativeAnimations?: boolean;
|
|
160
|
+
|
|
80
161
|
animationOptions?: Record<string, unknown>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Style object for the container (`Animated.View`), for example to override
|
|
165
|
+
* `overflow: 'hidden'`.
|
|
166
|
+
*/
|
|
81
167
|
containerStyle?: StyleProp<ViewStyle>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Style object for the children container (`Animated.View`), for example to
|
|
171
|
+
* apply `flex: 1`
|
|
172
|
+
*/
|
|
82
173
|
childrenContainerStyle?: StyleProp<ViewStyle>;
|
|
83
174
|
}
|
|
84
175
|
|
|
@@ -164,17 +255,12 @@ export default class Swipeable extends Component<
|
|
|
164
255
|
outputRange: [0, 1],
|
|
165
256
|
})
|
|
166
257
|
).interpolate({
|
|
167
|
-
inputRange: [
|
|
168
|
-
-rightWidth - (overshootRight ? 1 : overshootFriction!),
|
|
169
|
-
-rightWidth,
|
|
170
|
-
leftWidth,
|
|
171
|
-
leftWidth + (overshootLeft ? 1 : overshootFriction!),
|
|
172
|
-
],
|
|
258
|
+
inputRange: [-rightWidth - 1, -rightWidth, leftWidth, leftWidth + 1],
|
|
173
259
|
outputRange: [
|
|
174
|
-
-rightWidth - (overshootRight
|
|
260
|
+
-rightWidth - (overshootRight ? 1 / overshootFriction! : 0),
|
|
175
261
|
-rightWidth,
|
|
176
262
|
leftWidth,
|
|
177
|
-
leftWidth + (overshootLeft
|
|
263
|
+
leftWidth + (overshootLeft ? 1 / overshootFriction! : 0),
|
|
178
264
|
],
|
|
179
265
|
});
|
|
180
266
|
this.transX = transX;
|
|
@@ -349,7 +435,9 @@ export default class Swipeable extends Component<
|
|
|
349
435
|
<Animated.View
|
|
350
436
|
style={[
|
|
351
437
|
styles.leftActions,
|
|
352
|
-
// all those and below parameters can have ! since they are all
|
|
438
|
+
// all those and below parameters can have ! since they are all
|
|
439
|
+
// asigned in constructor in `updateAnimatedEvent` but TS cannot spot
|
|
440
|
+
// it for some reason
|
|
353
441
|
{ transform: [{ translateX: this.leftActionTranslate! }] },
|
|
354
442
|
]}>
|
|
355
443
|
{renderLeftActions(this.showLeftAction!, this.transX!)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Component } from 'react';
|
|
2
3
|
import {
|
|
3
4
|
Animated,
|
|
4
5
|
Platform,
|
|
@@ -13,7 +14,7 @@ import { BaseButton } from '../GestureButtons';
|
|
|
13
14
|
import {
|
|
14
15
|
GestureEvent,
|
|
15
16
|
HandlerStateChangeEvent,
|
|
16
|
-
} from '../../handlers/
|
|
17
|
+
} from '../../handlers/gestureHandlerCommon';
|
|
17
18
|
import { NativeViewGestureHandlerPayload } from '../../handlers/NativeViewGestureHandler';
|
|
18
19
|
import { TouchableNativeFeedbackExtraProps } from './TouchableNativeFeedback.android';
|
|
19
20
|
|
|
@@ -56,7 +57,7 @@ interface InternalProps {
|
|
|
56
57
|
|
|
57
58
|
// TODO: maybe can be better
|
|
58
59
|
// TODO: all clearTimeout have ! added, maybe they shouldn't ?
|
|
59
|
-
type Timeout =
|
|
60
|
+
type Timeout = ReturnType<typeof setTimeout> | null | undefined;
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* GenericTouchable is not intented to be used as it is.
|
|
@@ -70,6 +71,7 @@ export default class GenericTouchable extends Component<
|
|
|
70
71
|
delayLongPress: 600,
|
|
71
72
|
extraButtonProps: {
|
|
72
73
|
rippleColor: 'transparent',
|
|
74
|
+
exclusive: true,
|
|
73
75
|
},
|
|
74
76
|
};
|
|
75
77
|
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
TouchableNativeFeedbackProps,
|
|
4
4
|
ColorValue,
|
|
5
5
|
} from 'react-native';
|
|
6
|
-
import
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { Component } from 'react';
|
|
7
8
|
import GenericTouchable, { GenericTouchableProps } from './GenericTouchable';
|
|
8
9
|
|
|
9
10
|
export type TouchableNativeFeedbackExtraProps = {
|
package/src/components/touchables/{TouchableNativeFeedback.ts → TouchableNativeFeedback.tsx}
RENAMED
|
File without changes
|
|
@@ -9,7 +9,8 @@ import GenericTouchable, {
|
|
|
9
9
|
TOUCHABLE_STATE,
|
|
10
10
|
GenericTouchableProps,
|
|
11
11
|
} from './GenericTouchable';
|
|
12
|
-
import
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { Component } from 'react';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* TouchableOpacity bases on timing animation which has been used in RN's core
|
|
@@ -35,7 +36,7 @@ export default class TouchableOpacity extends Component<
|
|
|
35
36
|
toValue: value,
|
|
36
37
|
duration: duration,
|
|
37
38
|
easing: Easing.inOut(Easing.quad),
|
|
38
|
-
useNativeDriver:
|
|
39
|
+
useNativeDriver: false,
|
|
39
40
|
}).start();
|
|
40
41
|
};
|
|
41
42
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
2
3
|
import GenericTouchable, { GenericTouchableProps } from './GenericTouchable';
|
|
3
4
|
|
|
4
5
|
const TouchableWithoutFeedback = React.forwardRef<
|
|
5
6
|
GenericTouchable,
|
|
6
|
-
GenericTouchableProps
|
|
7
|
+
PropsWithChildren<GenericTouchableProps>
|
|
7
8
|
>((props, ref) => <GenericTouchable ref={ref} {...props} />);
|
|
8
9
|
|
|
9
10
|
TouchableWithoutFeedback.defaultProps = GenericTouchable.defaultProps;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
4
4
|
import GestureHandlerRootView from './GestureHandlerRootView';
|
|
5
5
|
|
|
6
|
-
export default function gestureHandlerRootHOC(
|
|
7
|
-
Component: React.ComponentType<
|
|
6
|
+
export default function gestureHandlerRootHOC<P>(
|
|
7
|
+
Component: React.ComponentType<P>,
|
|
8
8
|
containerStyles?: StyleProp<ViewStyle>
|
|
9
|
-
): React.ComponentType<
|
|
10
|
-
function Wrapper(props:
|
|
9
|
+
): React.ComponentType<P> {
|
|
10
|
+
function Wrapper(props: P) {
|
|
11
11
|
return (
|
|
12
12
|
<GestureHandlerRootView style={[styles.container, containerStyles]}>
|
|
13
13
|
<Component {...props} />
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import createHandler from './createHandler';
|
|
2
|
+
import {
|
|
3
|
+
BaseGestureHandlerProps,
|
|
4
|
+
baseGestureHandlerProps,
|
|
5
|
+
} from './gestureHandlerCommon';
|
|
6
|
+
|
|
7
|
+
export const flingGestureHandlerProps = [
|
|
8
|
+
'numberOfPointers',
|
|
9
|
+
'direction',
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
export type FlingGestureHandlerEventPayload = {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
absoluteX: number;
|
|
16
|
+
absoluteY: number;
|
|
17
|
+
};
|
|
18
|
+
export interface FlingGestureConfig {
|
|
19
|
+
/**
|
|
20
|
+
* Expressed allowed direction of movement. It's possible to pass one or many
|
|
21
|
+
* directions in one parameter:
|
|
22
|
+
*
|
|
23
|
+
* ```js
|
|
24
|
+
* direction={Directions.RIGHT | Directions.LEFT}
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* or
|
|
28
|
+
*
|
|
29
|
+
* ```js
|
|
30
|
+
* direction={Directions.DOWN}
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
direction?: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Determine exact number of points required to handle the fling gesture.
|
|
37
|
+
*/
|
|
38
|
+
numberOfPointers?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface FlingGestureHandlerProps
|
|
42
|
+
extends BaseGestureHandlerProps<FlingGestureHandlerEventPayload>,
|
|
43
|
+
FlingGestureConfig {}
|
|
44
|
+
|
|
45
|
+
export type FlingGestureHandler = typeof FlingGestureHandler;
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
|
47
|
+
export const FlingGestureHandler = createHandler<
|
|
48
|
+
FlingGestureHandlerProps,
|
|
49
|
+
FlingGestureHandlerEventPayload
|
|
50
|
+
>({
|
|
51
|
+
name: 'FlingGestureHandler',
|
|
52
|
+
allowedProps: [
|
|
53
|
+
...baseGestureHandlerProps,
|
|
54
|
+
...flingGestureHandlerProps,
|
|
55
|
+
] as const,
|
|
56
|
+
config: {},
|
|
57
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PlatformConstants from '../PlatformConstants';
|
|
3
|
+
import createHandler from './createHandler';
|
|
4
|
+
import {
|
|
5
|
+
BaseGestureHandlerProps,
|
|
6
|
+
baseGestureHandlerProps,
|
|
7
|
+
} from './gestureHandlerCommon';
|
|
8
|
+
|
|
9
|
+
export const forceTouchGestureHandlerProps = [
|
|
10
|
+
'minForce',
|
|
11
|
+
'maxForce',
|
|
12
|
+
'feedbackOnActivation',
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
class ForceTouchFallback extends React.Component {
|
|
16
|
+
static forceTouchAvailable = false;
|
|
17
|
+
componentDidMount() {
|
|
18
|
+
console.warn(
|
|
19
|
+
'ForceTouchGestureHandler is not available on this platform. Please use ForceTouchGestureHandler.forceTouchAvailable to conditionally render other components that would provide a fallback behavior specific to your usecase'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return this.props.children;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ForceTouchGestureHandlerEventPayload = {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
absoluteX: number;
|
|
31
|
+
absoluteY: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The pressure of a touch.
|
|
35
|
+
*/
|
|
36
|
+
force: number;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface ForceTouchGestureConfig {
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* A minimal pressure that is required before handler can activate. Should be a
|
|
43
|
+
* value from range `[0.0, 1.0]`. Default is `0.2`.
|
|
44
|
+
*/
|
|
45
|
+
minForce?: number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A maximal pressure that could be applied for handler. If the pressure is
|
|
49
|
+
* greater, handler fails. Should be a value from range `[0.0, 1.0]`.
|
|
50
|
+
*/
|
|
51
|
+
maxForce?: number;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Boolean value defining if haptic feedback has to be performed on
|
|
55
|
+
* activation.
|
|
56
|
+
*/
|
|
57
|
+
feedbackOnActivation?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ForceTouchGestureHandlerProps
|
|
61
|
+
extends BaseGestureHandlerProps<ForceTouchGestureHandlerEventPayload>,
|
|
62
|
+
ForceTouchGestureConfig {}
|
|
63
|
+
|
|
64
|
+
export type ForceTouchGestureHandler = typeof ForceTouchGestureHandler & {
|
|
65
|
+
forceTouchAvailable: boolean;
|
|
66
|
+
};
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
|
68
|
+
export const ForceTouchGestureHandler = PlatformConstants?.forceTouchAvailable
|
|
69
|
+
? createHandler<
|
|
70
|
+
ForceTouchGestureHandlerProps,
|
|
71
|
+
ForceTouchGestureHandlerEventPayload
|
|
72
|
+
>({
|
|
73
|
+
name: 'ForceTouchGestureHandler',
|
|
74
|
+
allowedProps: [
|
|
75
|
+
...baseGestureHandlerProps,
|
|
76
|
+
...forceTouchGestureHandlerProps,
|
|
77
|
+
] as const,
|
|
78
|
+
config: {},
|
|
79
|
+
})
|
|
80
|
+
: ForceTouchFallback;
|
|
81
|
+
|
|
82
|
+
(ForceTouchGestureHandler as ForceTouchGestureHandler).forceTouchAvailable =
|
|
83
|
+
PlatformConstants?.forceTouchAvailable || false;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import createHandler from './createHandler';
|
|
2
|
+
import {
|
|
3
|
+
BaseGestureHandlerProps,
|
|
4
|
+
baseGestureHandlerProps,
|
|
5
|
+
} from './gestureHandlerCommon';
|
|
6
|
+
|
|
7
|
+
export const longPressGestureHandlerProps = [
|
|
8
|
+
'minDurationMs',
|
|
9
|
+
'maxDist',
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
export type LongPressGestureHandlerEventPayload = {
|
|
13
|
+
/**
|
|
14
|
+
* X coordinate, expressed in points, of the current position of the pointer
|
|
15
|
+
* (finger or a leading pointer when there are multiple fingers placed)
|
|
16
|
+
* relative to the view attached to the handler.
|
|
17
|
+
*/
|
|
18
|
+
x: number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Y coordinate, expressed in points, of the current position of the pointer
|
|
22
|
+
* (finger or a leading pointer when there are multiple fingers placed)
|
|
23
|
+
* relative to the view attached to the handler.
|
|
24
|
+
*/
|
|
25
|
+
y: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* X coordinate, expressed in points, of the current position of the pointer
|
|
29
|
+
* (finger or a leading pointer when there are multiple fingers placed)
|
|
30
|
+
* relative to the root view. It is recommended to use `absoluteX` instead of
|
|
31
|
+
* `x` in cases when the view attached to the handler can be transformed as an
|
|
32
|
+
* effect of the gesture.
|
|
33
|
+
*/
|
|
34
|
+
absoluteX: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Y coordinate, expressed in points, of the current position of the pointer
|
|
38
|
+
* (finger or a leading pointer when there are multiple fingers placed)
|
|
39
|
+
* relative to the root view. It is recommended to use `absoluteY` instead of
|
|
40
|
+
* `y` in cases when the view attached to the handler can be transformed as an
|
|
41
|
+
* effect of the gesture.
|
|
42
|
+
*/
|
|
43
|
+
absoluteY: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Duration of the long press (time since the start of the event), expressed
|
|
47
|
+
* in milliseconds.
|
|
48
|
+
*/
|
|
49
|
+
duration: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export interface LongPressGestureConfig {
|
|
53
|
+
/**
|
|
54
|
+
* Minimum time, expressed in milliseconds, that a finger must remain pressed on
|
|
55
|
+
* the corresponding view. The default value is 500.
|
|
56
|
+
*/
|
|
57
|
+
minDurationMs?: number;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Maximum distance, expressed in points, that defines how far the finger is
|
|
61
|
+
* allowed to travel during a long press gesture. If the finger travels
|
|
62
|
+
* further than the defined distance and the handler hasn't yet activated, it
|
|
63
|
+
* will fail to recognize the gesture. The default value is 10.
|
|
64
|
+
*/
|
|
65
|
+
maxDist?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface LongPressGestureHandlerProps
|
|
69
|
+
extends BaseGestureHandlerProps<LongPressGestureHandlerEventPayload>,
|
|
70
|
+
LongPressGestureConfig {}
|
|
71
|
+
|
|
72
|
+
export type LongPressGestureHandler = typeof LongPressGestureHandler;
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
|
74
|
+
export const LongPressGestureHandler = createHandler<
|
|
75
|
+
LongPressGestureHandlerProps,
|
|
76
|
+
LongPressGestureHandlerEventPayload
|
|
77
|
+
>({
|
|
78
|
+
name: 'LongPressGestureHandler',
|
|
79
|
+
allowedProps: [
|
|
80
|
+
...baseGestureHandlerProps,
|
|
81
|
+
...longPressGestureHandlerProps,
|
|
82
|
+
] as const,
|
|
83
|
+
config: {},
|
|
84
|
+
});
|