react-native-gesture-handler 1.10.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +10 -8
- package/android/build.gradle +49 -1
- package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
- 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 +744 -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 +596 -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 +292 -0
- package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +90 -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 +81 -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/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/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +19 -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/lib/commonjs/EventType.js +16 -0
- package/lib/commonjs/EventType.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootView.android.js +1 -13
- package/lib/commonjs/GestureHandlerRootView.android.js.map +1 -1
- package/lib/commonjs/GestureHandlerRootView.js +11 -3
- package/lib/commonjs/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.js +3 -1
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +2 -2
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +41 -37
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +31 -12
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +10 -6
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +2 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js +1 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/gestureHandlerRootHOC.js +1 -1
- package/lib/commonjs/gestureHandlerRootHOC.js.map +1 -1
- 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 +6 -4
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
- 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 +65 -84
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +80 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js +440 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js +135 -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 +65 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js +193 -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 +31 -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 +144 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js +45 -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 +45 -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 +40 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/init.js +13 -0
- package/lib/commonjs/init.js.map +1 -0
- package/lib/commonjs/mocks.js +31 -2
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/utils.js +15 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/Errors.js +1 -1
- package/lib/commonjs/web/Errors.js.map +1 -1
- package/lib/commonjs/web/GestureHandler.js +4 -6
- package/lib/commonjs/web/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/NodeManager.js +8 -2
- package/lib/commonjs/web/NodeManager.js.map +1 -1
- package/lib/module/EventType.js +8 -0
- package/lib/module/EventType.js.map +1 -0
- package/lib/module/GestureHandlerRootView.android.js +2 -14
- package/lib/module/GestureHandlerRootView.android.js.map +1 -1
- package/lib/module/GestureHandlerRootView.js +5 -1
- package/lib/module/GestureHandlerRootView.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +3 -1
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +2 -2
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +43 -40
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureComponents.js +29 -11
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/Swipeable.js +9 -6
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +2 -1
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/components/touchables/TouchableOpacity.js +1 -1
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/module/gestureHandlerRootHOC.js +1 -1
- package/lib/module/gestureHandlerRootHOC.js.map +1 -1
- 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 +4 -3
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
- 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 +55 -77
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +66 -0
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector.js +402 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/module/handlers/gestures/eventReceiver.js +120 -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 +56 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js +175 -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 +22 -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 +135 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -0
- package/lib/module/handlers/gestures/pinchGesture.js +36 -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 +36 -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 +11 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/init.js +5 -0
- package/lib/module/init.js.map +1 -0
- package/lib/module/mocks.js +31 -2
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/utils.js +8 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/web/Errors.js +1 -1
- package/lib/module/web/Errors.js.map +1 -1
- package/lib/module/web/GestureHandler.js +4 -6
- package/lib/module/web/GestureHandler.js.map +1 -1
- package/lib/module/web/NodeManager.js +8 -2
- package/lib/module/web/NodeManager.js.map +1 -1
- package/lib/typescript/EventType.d.ts +8 -0
- package/lib/typescript/GestureHandlerRootView.android.d.ts +2 -4
- package/lib/typescript/GestureHandlerRootView.d.ts +5 -2
- package/lib/typescript/RNGestureHandlerModule.d.ts +1 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
- package/lib/typescript/components/DrawerLayout.d.ts +50 -1
- package/lib/typescript/components/GestureButtons.d.ts +36 -0
- package/lib/typescript/components/GestureComponents.d.ts +8 -35
- package/lib/typescript/components/Swipeable.d.ts +73 -6
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +2 -2
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -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 +19 -4
- 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/lib/typescript/handlers/createHandler.d.ts +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +8 -1
- 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 +16 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +97 -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 +7 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +26 -0
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +12 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +12 -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 +29 -2
- package/lib/typescript/init.d.ts +1 -0
- package/lib/typescript/mocks.d.ts +21 -2
- package/lib/typescript/utils.d.ts +1 -0
- package/lib/typescript/web/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/web/GestureHandler.d.ts +0 -1
- package/lib/typescript/web/PanGestureHandler.d.ts +0 -1
- package/lib/typescript/web/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/web/PressGestureHandler.d.ts +0 -1
- package/lib/typescript/web/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/web/TapGestureHandler.d.ts +0 -1
- package/package.json +8 -5
- package/src/EventType.ts +10 -0
- package/src/GestureHandlerRootView.android.tsx +9 -25
- package/src/GestureHandlerRootView.tsx +11 -2
- package/src/RNGestureHandlerModule.ts +5 -1
- package/src/RNGestureHandlerModule.web.ts +1 -0
- package/src/components/DrawerLayout.tsx +114 -41
- package/src/components/GestureButtons.tsx +45 -5
- package/src/components/GestureComponents.tsx +47 -41
- package/src/components/Swipeable.tsx +108 -21
- package/src/components/touchables/GenericTouchable.tsx +2 -1
- package/src/components/touchables/TouchableOpacity.tsx +1 -1
- 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 +67 -79
- package/src/handlers/gestureHandlerCommon.ts +185 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +19 -5
- package/src/handlers/gestures/GestureDetector.tsx +519 -0
- package/src/handlers/gestures/eventReceiver.ts +151 -0
- package/src/handlers/gestures/flingGesture.ts +27 -0
- package/src/handlers/gestures/forceTouchGesture.ts +74 -0
- package/src/handlers/gestures/gesture.ts +292 -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 +31 -0
- package/src/handlers/gestures/nativeGesture.ts +27 -0
- package/src/handlers/gestures/panGesture.ts +147 -0
- package/src/handlers/gestures/pinchGesture.ts +51 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
- package/src/handlers/gestures/rotationGesture.ts +51 -0
- package/src/handlers/gestures/tapGesture.ts +52 -0
- package/src/handlers/handlersRegistry.ts +22 -0
- package/src/index.ts +57 -17
- package/src/init.ts +5 -0
- package/src/mocks.ts +42 -2
- package/src/utils.ts +7 -0
- package/src/web/GestureHandler.ts +1 -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/lib/commonjs/handlers/gestureHandlers.js +0 -236
- package/lib/commonjs/handlers/gestureHandlers.js.map +0 -1
- package/lib/module/handlers/gestureHandlers.js +0 -216
- package/lib/module/handlers/gestureHandlers.js.map +0 -1
- package/lib/typescript/handlers/gestureHandlers.d.ts +0 -158
- package/src/handlers/gestureHandlers.ts +0 -511
@@ -0,0 +1,135 @@
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
|
3
|
+
import { ContinousBaseGesture } from './gesture';
|
4
|
+
|
5
|
+
function changeEventCalculator(current, previous) {
|
6
|
+
'worklet';
|
7
|
+
|
8
|
+
let changePayload;
|
9
|
+
|
10
|
+
if (previous === undefined) {
|
11
|
+
changePayload = {
|
12
|
+
changeX: current.translationX,
|
13
|
+
changeY: current.translationY
|
14
|
+
};
|
15
|
+
} else {
|
16
|
+
changePayload = {
|
17
|
+
changeX: current.translationX - previous.translationX,
|
18
|
+
changeY: current.translationY - previous.translationY
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
return { ...current,
|
23
|
+
...changePayload
|
24
|
+
};
|
25
|
+
}
|
26
|
+
|
27
|
+
export class PanGesture extends ContinousBaseGesture {
|
28
|
+
constructor() {
|
29
|
+
super();
|
30
|
+
|
31
|
+
_defineProperty(this, "config", {});
|
32
|
+
|
33
|
+
this.handlerName = 'PanGestureHandler';
|
34
|
+
}
|
35
|
+
|
36
|
+
activeOffsetY(offset) {
|
37
|
+
if (Array.isArray(offset)) {
|
38
|
+
this.config.activeOffsetYStart = offset[0];
|
39
|
+
this.config.activeOffsetYEnd = offset[1];
|
40
|
+
} else if (offset < 0) {
|
41
|
+
this.config.activeOffsetYStart = offset;
|
42
|
+
} else {
|
43
|
+
this.config.activeOffsetYEnd = offset;
|
44
|
+
}
|
45
|
+
|
46
|
+
return this;
|
47
|
+
}
|
48
|
+
|
49
|
+
activeOffsetX(offset) {
|
50
|
+
if (Array.isArray(offset)) {
|
51
|
+
this.config.activeOffsetXStart = offset[0];
|
52
|
+
this.config.activeOffsetXEnd = offset[1];
|
53
|
+
} else if (offset < 0) {
|
54
|
+
this.config.activeOffsetXStart = offset;
|
55
|
+
} else {
|
56
|
+
this.config.activeOffsetXEnd = offset;
|
57
|
+
}
|
58
|
+
|
59
|
+
return this;
|
60
|
+
}
|
61
|
+
|
62
|
+
failOffsetY(offset) {
|
63
|
+
if (Array.isArray(offset)) {
|
64
|
+
this.config.failOffsetYStart = offset[0];
|
65
|
+
this.config.failOffsetYEnd = offset[1];
|
66
|
+
} else if (offset < 0) {
|
67
|
+
this.config.failOffsetYStart = offset;
|
68
|
+
} else {
|
69
|
+
this.config.failOffsetYEnd = offset;
|
70
|
+
}
|
71
|
+
|
72
|
+
return this;
|
73
|
+
}
|
74
|
+
|
75
|
+
failOffsetX(offset) {
|
76
|
+
if (Array.isArray(offset)) {
|
77
|
+
this.config.failOffsetXStart = offset[0];
|
78
|
+
this.config.failOffsetXEnd = offset[1];
|
79
|
+
} else if (offset < 0) {
|
80
|
+
this.config.failOffsetXStart = offset;
|
81
|
+
} else {
|
82
|
+
this.config.failOffsetXEnd = offset;
|
83
|
+
}
|
84
|
+
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
|
88
|
+
minPointers(minPointers) {
|
89
|
+
this.config.minPointers = minPointers;
|
90
|
+
return this;
|
91
|
+
}
|
92
|
+
|
93
|
+
maxPointers(maxPointers) {
|
94
|
+
this.config.maxPointers = maxPointers;
|
95
|
+
return this;
|
96
|
+
}
|
97
|
+
|
98
|
+
minDistance(distance) {
|
99
|
+
this.config.minDist = distance;
|
100
|
+
return this;
|
101
|
+
}
|
102
|
+
|
103
|
+
minVelocity(velocity) {
|
104
|
+
this.config.minVelocity = velocity;
|
105
|
+
return this;
|
106
|
+
}
|
107
|
+
|
108
|
+
minVelocityX(velocity) {
|
109
|
+
this.config.minVelocityX = velocity;
|
110
|
+
return this;
|
111
|
+
}
|
112
|
+
|
113
|
+
minVelocityY(velocity) {
|
114
|
+
this.config.minVelocityY = velocity;
|
115
|
+
return this;
|
116
|
+
}
|
117
|
+
|
118
|
+
averageTouches(value) {
|
119
|
+
this.config.avgTouches = value;
|
120
|
+
return this;
|
121
|
+
}
|
122
|
+
|
123
|
+
enableTrackpadTwoFingerGesture(value) {
|
124
|
+
this.config.enableTrackpadTwoFingerGesture = value;
|
125
|
+
return this;
|
126
|
+
}
|
127
|
+
|
128
|
+
onChange(callback) {
|
129
|
+
// @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record
|
130
|
+
this.handlers.changeEventCalculator = changeEventCalculator;
|
131
|
+
return super.onChange(callback);
|
132
|
+
}
|
133
|
+
|
134
|
+
}
|
135
|
+
//# sourceMappingURL=panGesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["panGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","changeX","translationX","changeY","translationY","PanGesture","constructor","handlerName","activeOffsetY","offset","Array","isArray","config","activeOffsetYStart","activeOffsetYEnd","activeOffsetX","activeOffsetXStart","activeOffsetXEnd","failOffsetY","failOffsetYStart","failOffsetYEnd","failOffsetX","failOffsetXStart","failOffsetXEnd","minPointers","maxPointers","minDistance","distance","minDist","minVelocity","velocity","minVelocityX","minVelocityY","averageTouches","value","avgTouches","enableTrackpadTwoFingerGesture","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AAYA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,YADH;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO;AAFH,KAAhB;AAID,GALD,MAKO;AACLL,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,YAAR,GAAuBJ,QAAQ,CAACI,YAD3B;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO,YAAR,GAAuBN,QAAQ,CAACM;AAF3B,KAAhB;AAID;;AAED,SAAO,EAAE,GAAGP,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMM,UAAN,SAAyBV,oBAAzB,CAGL;AAGAW,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAFwC,EAExC;;AAGZ,SAAKC,WAAL,GAAmB,mBAAnB;AACD;;AAEDC,EAAAA,aAAa,CAACC,MAAD,EAA4B;AACvC,QAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAJ,EAA2B;AACzB,WAAKG,MAAL,CAAYC,kBAAZ,GAAiCJ,MAAM,CAAC,CAAD,CAAvC;AACA,WAAKG,MAAL,CAAYE,gBAAZ,GAA+BL,MAAM,CAAC,CAAD,CAArC;AACD,KAHD,MAGO,IAAIA,MAAM,GAAG,CAAb,EAAgB;AACrB,WAAKG,MAAL,CAAYC,kBAAZ,GAAiCJ,MAAjC;AACD,KAFM,MAEA;AACL,WAAKG,MAAL,CAAYE,gBAAZ,GAA+BL,MAA/B;AACD;;AACD,WAAO,IAAP;AACD;;AAEDM,EAAAA,aAAa,CAACN,MAAD,EAA4B;AACvC,QAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAJ,EAA2B;AACzB,WAAKG,MAAL,CAAYI,kBAAZ,GAAiCP,MAAM,CAAC,CAAD,CAAvC;AACA,WAAKG,MAAL,CAAYK,gBAAZ,GAA+BR,MAAM,CAAC,CAAD,CAArC;AACD,KAHD,MAGO,IAAIA,MAAM,GAAG,CAAb,EAAgB;AACrB,WAAKG,MAAL,CAAYI,kBAAZ,GAAiCP,MAAjC;AACD,KAFM,MAEA;AACL,WAAKG,MAAL,CAAYK,gBAAZ,GAA+BR,MAA/B;AACD;;AACD,WAAO,IAAP;AACD;;AAEDS,EAAAA,WAAW,CAACT,MAAD,EAA4B;AACrC,QAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAJ,EAA2B;AACzB,WAAKG,MAAL,CAAYO,gBAAZ,GAA+BV,MAAM,CAAC,CAAD,CAArC;AACA,WAAKG,MAAL,CAAYQ,cAAZ,GAA6BX,MAAM,CAAC,CAAD,CAAnC;AACD,KAHD,MAGO,IAAIA,MAAM,GAAG,CAAb,EAAgB;AACrB,WAAKG,MAAL,CAAYO,gBAAZ,GAA+BV,MAA/B;AACD,KAFM,MAEA;AACL,WAAKG,MAAL,CAAYQ,cAAZ,GAA6BX,MAA7B;AACD;;AACD,WAAO,IAAP;AACD;;AAEDY,EAAAA,WAAW,CAACZ,MAAD,EAA4B;AACrC,QAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAJ,EAA2B;AACzB,WAAKG,MAAL,CAAYU,gBAAZ,GAA+Bb,MAAM,CAAC,CAAD,CAArC;AACA,WAAKG,MAAL,CAAYW,cAAZ,GAA6Bd,MAAM,CAAC,CAAD,CAAnC;AACD,KAHD,MAGO,IAAIA,MAAM,GAAG,CAAb,EAAgB;AACrB,WAAKG,MAAL,CAAYU,gBAAZ,GAA+Bb,MAA/B;AACD,KAFM,MAEA;AACL,WAAKG,MAAL,CAAYW,cAAZ,GAA6Bd,MAA7B;AACD;;AACD,WAAO,IAAP;AACD;;AAEDe,EAAAA,WAAW,CAACA,WAAD,EAAsB;AAC/B,SAAKZ,MAAL,CAAYY,WAAZ,GAA0BA,WAA1B;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,WAAW,CAACA,WAAD,EAAsB;AAC/B,SAAKb,MAAL,CAAYa,WAAZ,GAA0BA,WAA1B;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKf,MAAL,CAAYgB,OAAZ,GAAsBD,QAAtB;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKlB,MAAL,CAAYiB,WAAZ,GAA0BC,QAA1B;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,YAAY,CAACD,QAAD,EAAmB;AAC7B,SAAKlB,MAAL,CAAYmB,YAAZ,GAA2BD,QAA3B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,YAAY,CAACF,QAAD,EAAmB;AAC7B,SAAKlB,MAAL,CAAYoB,YAAZ,GAA2BF,QAA3B;AACA,WAAO,IAAP;AACD;;AAEDG,EAAAA,cAAc,CAACC,KAAD,EAAiB;AAC7B,SAAKtB,MAAL,CAAYuB,UAAZ,GAAyBD,KAAzB;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,8BAA8B,CAACF,KAAD,EAAiB;AAC7C,SAAKtB,MAAL,CAAYwB,8BAAZ,GAA6CF,KAA7C;AACA,WAAO,IAAP;AACD;;AAEDG,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAc3C,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMyC,QAAN,CAAeC,QAAf,CAAP;AACD;;AA3GD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\nimport {\n PanGestureConfig,\n PanGestureHandlerEventPayload,\n} from '../PanGestureHandler';\n\ntype PanGestureChangeEventPayload = {\n changeX: number;\n changeY: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<PanGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<PanGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: PanGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n changeX: current.translationX,\n changeY: current.translationY,\n };\n } else {\n changePayload = {\n changeX: current.translationX - previous.translationX,\n changeY: current.translationY - previous.translationY,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PanGesture extends ContinousBaseGesture<\n PanGestureHandlerEventPayload,\n PanGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & PanGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'PanGestureHandler';\n }\n\n activeOffsetY(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetYStart = offset[0];\n this.config.activeOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetYStart = offset;\n } else {\n this.config.activeOffsetYEnd = offset;\n }\n return this;\n }\n\n activeOffsetX(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetXStart = offset[0];\n this.config.activeOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetXStart = offset;\n } else {\n this.config.activeOffsetXEnd = offset;\n }\n return this;\n }\n\n failOffsetY(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.failOffsetYStart = offset[0];\n this.config.failOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetYStart = offset;\n } else {\n this.config.failOffsetYEnd = offset;\n }\n return this;\n }\n\n failOffsetX(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.failOffsetXStart = offset[0];\n this.config.failOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetXStart = offset;\n } else {\n this.config.failOffsetXEnd = offset;\n }\n return this;\n }\n\n minPointers(minPointers: number) {\n this.config.minPointers = minPointers;\n return this;\n }\n\n maxPointers(maxPointers: number) {\n this.config.maxPointers = maxPointers;\n return this;\n }\n\n minDistance(distance: number) {\n this.config.minDist = distance;\n return this;\n }\n\n minVelocity(velocity: number) {\n this.config.minVelocity = velocity;\n return this;\n }\n\n minVelocityX(velocity: number) {\n this.config.minVelocityX = velocity;\n return this;\n }\n\n minVelocityY(velocity: number) {\n this.config.minVelocityY = velocity;\n return this;\n }\n\n averageTouches(value: boolean) {\n this.config.avgTouches = value;\n return this;\n }\n\n enableTrackpadTwoFingerGesture(value: boolean) {\n this.config.enableTrackpadTwoFingerGesture = value;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PanGestureHandlerEventPayload & PanGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PanGestureType = InstanceType<typeof PanGesture>;\n"]}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ContinousBaseGesture } from './gesture';
|
2
|
+
|
3
|
+
function changeEventCalculator(current, previous) {
|
4
|
+
'worklet';
|
5
|
+
|
6
|
+
let changePayload;
|
7
|
+
|
8
|
+
if (previous === undefined) {
|
9
|
+
changePayload = {
|
10
|
+
scaleChange: current.scale
|
11
|
+
};
|
12
|
+
} else {
|
13
|
+
changePayload = {
|
14
|
+
scaleChange: current.scale / previous.scale
|
15
|
+
};
|
16
|
+
}
|
17
|
+
|
18
|
+
return { ...current,
|
19
|
+
...changePayload
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
export class PinchGesture extends ContinousBaseGesture {
|
24
|
+
constructor() {
|
25
|
+
super();
|
26
|
+
this.handlerName = 'PinchGestureHandler';
|
27
|
+
}
|
28
|
+
|
29
|
+
onChange(callback) {
|
30
|
+
// @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record
|
31
|
+
this.handlers.changeEventCalculator = changeEventCalculator;
|
32
|
+
return super.onChange(callback);
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|
36
|
+
//# sourceMappingURL=pinchGesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["pinchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","scaleChange","scale","PinchGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":"AAAA,SAASA,oBAAT,QAAqC,WAArC;;AAQA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,YAAN,SAA2BR,oBAA3B,CAGL;AACAS,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,qBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcZ,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMU,QAAN,CAAeC,QAAf,CAAP;AACD;;AAjBD","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\ntype PinchGestureChangeEventPayload = {\n scaleChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<PinchGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<PinchGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: PinchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n scaleChange: current.scale,\n };\n } else {\n changePayload = {\n scaleChange: current.scale / previous.scale,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PinchGesture extends ContinousBaseGesture<\n PinchGestureHandlerEventPayload,\n PinchGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'PinchGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PinchGestureHandlerEventPayload & PinchGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PinchGestureType = InstanceType<typeof PinchGesture>;\n"]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
let Reanimated;
|
2
|
+
|
3
|
+
try {
|
4
|
+
Reanimated = require('react-native-reanimated');
|
5
|
+
|
6
|
+
if (!Reanimated.setGestureState) {
|
7
|
+
Reanimated.setGestureState = () => {
|
8
|
+
'worklet';
|
9
|
+
|
10
|
+
console.warn('Please use newer version of react-native-reanimated in order to control state of the gestures.');
|
11
|
+
};
|
12
|
+
} // When 'react-native-reanimated' is not available we want to
|
13
|
+
// quietly continue
|
14
|
+
// eslint-disable-next-line no-empty
|
15
|
+
|
16
|
+
} catch (e) {}
|
17
|
+
|
18
|
+
export { Reanimated };
|
19
|
+
//# sourceMappingURL=reanimatedWrapper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["reanimatedWrapper.ts"],"names":["Reanimated","require","setGestureState","console","warn","e"],"mappings":"AAUA,IAAIA,UAAJ;;AAkBA,IAAI;AACFA,EAAAA,UAAU,GAAGC,OAAO,CAAC,yBAAD,CAApB;;AAEA,MAAI,CAACD,UAAU,CAACE,eAAhB,EAAiC;AAC/BF,IAAAA,UAAU,CAACE,eAAX,GAA6B,MAAM;AACjC;;AACAC,MAAAA,OAAO,CAACC,IAAR,CACE,gGADF;AAGD,KALD;AAMD,GAVC,CAWF;AACA;AACA;;AACD,CAdD,CAcE,OAAOC,CAAP,EAAU,CAAE;;AAEd,SAASL,UAAT","sourcesContent":["import { ComponentClass } from 'react';\nimport {\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../gestureHandlerCommon';\n\nexport interface SharedValue<T> {\n value: T;\n}\n\nlet Reanimated: {\n default: {\n // Slightly modified definition copied from 'react-native-reanimated'\n // eslint-disable-next-line @typescript-eslint/ban-types\n createAnimatedComponent<P extends object>(\n component: ComponentClass<P>,\n options?: unknown\n ): ComponentClass<P>;\n };\n useEvent: (\n callback: (event: GestureUpdateEvent | GestureStateChangeEvent) => void,\n events: string[],\n rebuild: boolean\n ) => unknown;\n useSharedValue: <T>(value: T) => SharedValue<T>;\n setGestureState: (handlerTag: number, newState: number) => void;\n};\n\ntry {\n Reanimated = require('react-native-reanimated');\n\n if (!Reanimated.setGestureState) {\n Reanimated.setGestureState = () => {\n 'worklet';\n console.warn(\n 'Please use newer version of react-native-reanimated in order to control state of the gestures.'\n );\n };\n }\n // When 'react-native-reanimated' is not available we want to\n // quietly continue\n // eslint-disable-next-line no-empty\n} catch (e) {}\n\nexport { Reanimated };\n"]}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ContinousBaseGesture } from './gesture';
|
2
|
+
|
3
|
+
function changeEventCalculator(current, previous) {
|
4
|
+
'worklet';
|
5
|
+
|
6
|
+
let changePayload;
|
7
|
+
|
8
|
+
if (previous === undefined) {
|
9
|
+
changePayload = {
|
10
|
+
rotationChange: current.rotation
|
11
|
+
};
|
12
|
+
} else {
|
13
|
+
changePayload = {
|
14
|
+
rotationChange: current.rotation - previous.rotation
|
15
|
+
};
|
16
|
+
}
|
17
|
+
|
18
|
+
return { ...current,
|
19
|
+
...changePayload
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
export class RotationGesture extends ContinousBaseGesture {
|
24
|
+
constructor() {
|
25
|
+
super();
|
26
|
+
this.handlerName = 'RotationGestureHandler';
|
27
|
+
}
|
28
|
+
|
29
|
+
onChange(callback) {
|
30
|
+
// @ts-ignore TS being overprotective, RotationGestureHandlerEventPayload is Record
|
31
|
+
this.handlers.changeEventCalculator = changeEventCalculator;
|
32
|
+
return super.onChange(callback);
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|
36
|
+
//# sourceMappingURL=rotationGesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["rotationGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","rotationChange","rotation","RotationGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":"AAAA,SAASA,oBAAT,QAAqC,WAArC;;AAQA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,cAAc,EAAEJ,OAAO,CAACK;AADV,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,cAAc,EAAEJ,OAAO,CAACK,QAAR,GAAmBJ,QAAQ,CAACI;AAD9B,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,eAAN,SAA8BR,oBAA9B,CAGL;AACAS,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,wBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcZ,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMU,QAAN,CAAeC,QAAf,CAAP;AACD;;AAjBD","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\ntype RotationGestureChangeEventPayload = {\n rotationChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<RotationGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<RotationGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: RotationGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n rotationChange: current.rotation,\n };\n } else {\n changePayload = {\n rotationChange: current.rotation - previous.rotation,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class RotationGesture extends ContinousBaseGesture<\n RotationGestureHandlerEventPayload,\n RotationGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'RotationGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n RotationGestureHandlerEventPayload & RotationGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, RotationGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type RotationGestureType = InstanceType<typeof RotationGesture>;\n"]}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
|
3
|
+
import { BaseGesture } from './gesture';
|
4
|
+
export class TapGesture extends BaseGesture {
|
5
|
+
constructor() {
|
6
|
+
super();
|
7
|
+
|
8
|
+
_defineProperty(this, "config", {});
|
9
|
+
|
10
|
+
this.handlerName = 'TapGestureHandler';
|
11
|
+
}
|
12
|
+
|
13
|
+
minPointers(minPointers) {
|
14
|
+
this.config.minPointers = minPointers;
|
15
|
+
return this;
|
16
|
+
}
|
17
|
+
|
18
|
+
numberOfTaps(count) {
|
19
|
+
this.config.numberOfTaps = count;
|
20
|
+
return this;
|
21
|
+
}
|
22
|
+
|
23
|
+
maxDistance(maxDist) {
|
24
|
+
this.config.maxDist = maxDist;
|
25
|
+
return this;
|
26
|
+
}
|
27
|
+
|
28
|
+
maxDuration(duration) {
|
29
|
+
this.config.maxDurationMs = duration;
|
30
|
+
return this;
|
31
|
+
}
|
32
|
+
|
33
|
+
maxDelay(delay) {
|
34
|
+
this.config.maxDelayMs = delay;
|
35
|
+
return this;
|
36
|
+
}
|
37
|
+
|
38
|
+
maxDeltaX(delta) {
|
39
|
+
this.config.maxDeltaX = delta;
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
|
43
|
+
maxDeltaY(delta) {
|
44
|
+
this.config.maxDeltaY = delta;
|
45
|
+
return this;
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
49
|
+
//# sourceMappingURL=tapGesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["tapGesture.ts"],"names":["BaseGesture","TapGesture","constructor","handlerName","minPointers","config","numberOfTaps","count","maxDistance","maxDist","maxDuration","duration","maxDurationMs","maxDelay","delay","maxDelayMs","maxDeltaX","delta","maxDeltaY"],"mappings":";;AAAA,SAA4BA,WAA5B,QAA+C,WAA/C;AAMA,OAAO,MAAMC,UAAN,SAAyBD,WAAzB,CAAoE;AAGzEE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAFwC,EAExC;;AAGZ,SAAKC,WAAL,GAAmB,mBAAnB;AACD;;AAEDC,EAAAA,WAAW,CAACA,WAAD,EAAsB;AAC/B,SAAKC,MAAL,CAAYD,WAAZ,GAA0BA,WAA1B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,YAAY,CAACC,KAAD,EAAgB;AAC1B,SAAKF,MAAL,CAAYC,YAAZ,GAA2BC,KAA3B;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,OAAD,EAAkB;AAC3B,SAAKJ,MAAL,CAAYI,OAAZ,GAAsBA,OAAtB;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKN,MAAL,CAAYO,aAAZ,GAA4BD,QAA5B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,QAAQ,CAACC,KAAD,EAAgB;AACtB,SAAKT,MAAL,CAAYU,UAAZ,GAAyBD,KAAzB;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAgB;AACvB,SAAKZ,MAAL,CAAYW,SAAZ,GAAwBC,KAAxB;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,SAAS,CAACD,KAAD,EAAgB;AACvB,SAAKZ,MAAL,CAAYa,SAAZ,GAAwBD,KAAxB;AACA,WAAO,IAAP;AACD;;AA1CwE","sourcesContent":["import { BaseGestureConfig, BaseGesture } from './gesture';\nimport {\n TapGestureConfig,\n TapGestureHandlerEventPayload,\n} from '../TapGestureHandler';\n\nexport class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {\n public config: BaseGestureConfig & TapGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'TapGestureHandler';\n }\n\n minPointers(minPointers: number) {\n this.config.minPointers = minPointers;\n return this;\n }\n\n numberOfTaps(count: number) {\n this.config.numberOfTaps = count;\n return this;\n }\n\n maxDistance(maxDist: number) {\n this.config.maxDist = maxDist;\n return this;\n }\n\n maxDuration(duration: number) {\n this.config.maxDurationMs = duration;\n return this;\n }\n\n maxDelay(delay: number) {\n this.config.maxDelayMs = delay;\n return this;\n }\n\n maxDeltaX(delta: number) {\n this.config.maxDeltaX = delta;\n return this;\n }\n\n maxDeltaY(delta: number) {\n this.config.maxDeltaY = delta;\n return this;\n }\n}\n\nexport type TapGestureType = InstanceType<typeof TapGesture>;\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export const handlerIDToTag = {};
|
2
|
+
const handlers = new Map();
|
3
|
+
let handlerTag = 1;
|
4
|
+
export function getNextHandlerTag() {
|
5
|
+
return handlerTag++;
|
6
|
+
}
|
7
|
+
export function registerHandler(handlerTag, handler) {
|
8
|
+
handlers.set(handlerTag, handler);
|
9
|
+
}
|
10
|
+
export function unregisterHandler(handlerTag) {
|
11
|
+
handlers.delete(handlerTag);
|
12
|
+
}
|
13
|
+
export function findHandler(handlerTag) {
|
14
|
+
return handlers.get(handlerTag);
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=handlersRegistry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["handlersRegistry.ts"],"names":["handlerIDToTag","handlers","Map","handlerTag","getNextHandlerTag","registerHandler","handler","set","unregisterHandler","delete","findHandler","get"],"mappings":"AAEA,OAAO,MAAMA,cAAsC,GAAG,EAA/C;AACP,MAAMC,QAAQ,GAAG,IAAIC,GAAJ,EAAjB;AAEA,IAAIC,UAAU,GAAG,CAAjB;AAEA,OAAO,SAASC,iBAAT,GAAqC;AAC1C,SAAOD,UAAU,EAAjB;AACD;AAED,OAAO,SAASE,eAAT,CAAyBF,UAAzB,EAA6CG,OAA7C,EAAmE;AACxEL,EAAAA,QAAQ,CAACM,GAAT,CAAaJ,UAAb,EAAyBG,OAAzB;AACD;AAED,OAAO,SAASE,iBAAT,CAA2BL,UAA3B,EAA+C;AACpDF,EAAAA,QAAQ,CAACQ,MAAT,CAAgBN,UAAhB;AACD;AAED,OAAO,SAASO,WAAT,CAAqBP,UAArB,EAAyC;AAC9C,SAAOF,QAAQ,CAACU,GAAT,CAAaR,UAAb,CAAP;AACD","sourcesContent":["import { GestureType } from './gestures/gesture';\n\nexport const handlerIDToTag: Record<string, number> = {};\nconst handlers = new Map<number, GestureType>();\n\nlet handlerTag = 1;\n\nexport function getNextHandlerTag(): number {\n return handlerTag++;\n}\n\nexport function registerHandler(handlerTag: number, handler: GestureType) {\n handlers.set(handlerTag, handler);\n}\n\nexport function unregisterHandler(handlerTag: number) {\n handlers.delete(handlerTag);\n}\n\nexport function findHandler(handlerTag: number) {\n return handlers.get(handlerTag);\n}\n"]}
|
package/lib/module/index.js
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
+
import { initialize } from './init';
|
1
2
|
export { Directions } from './Directions';
|
2
3
|
export { State } from './State';
|
3
4
|
export { default as gestureHandlerRootHOC } from './gestureHandlerRootHOC';
|
4
5
|
export { default as GestureHandlerRootView } from './GestureHandlerRootView';
|
5
|
-
export { TapGestureHandler
|
6
|
+
export { TapGestureHandler } from './handlers/TapGestureHandler';
|
7
|
+
export { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';
|
8
|
+
export { LongPressGestureHandler } from './handlers/LongPressGestureHandler';
|
9
|
+
export { PanGestureHandler } from './handlers/PanGestureHandler';
|
10
|
+
export { PinchGestureHandler } from './handlers/PinchGestureHandler';
|
11
|
+
export { RotationGestureHandler } from './handlers/RotationGestureHandler';
|
12
|
+
export { FlingGestureHandler } from './handlers/FlingGestureHandler';
|
6
13
|
export { default as createNativeWrapper } from './handlers/createNativeWrapper';
|
14
|
+
export { GestureDetector } from './handlers/gestures/GestureDetector';
|
15
|
+
export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';
|
7
16
|
export { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';
|
8
17
|
export { RawButton, BaseButton, RectButton, BorderlessButton } from './components/GestureButtons';
|
9
18
|
export { TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback } from './components/touchables';
|
10
19
|
export { ScrollView, Switch, TextInput, DrawerLayoutAndroid, FlatList } from './components/GestureComponents';
|
11
20
|
export { default as Swipeable } from './components/Swipeable';
|
12
21
|
export { default as DrawerLayout } from './components/DrawerLayout';
|
22
|
+
initialize();
|
13
23
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["Directions","State","default","gestureHandlerRootHOC","GestureHandlerRootView","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","createNativeWrapper","NativeViewGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","Switch","TextInput","DrawerLayoutAndroid","FlatList","Swipeable","DrawerLayout"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,yBAAjD;AACA,SAASD,OAAO,IAAIE,sBAApB,QAAkD,0BAAlD;
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["initialize","Directions","State","default","gestureHandlerRootHOC","GestureHandlerRootView","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","createNativeWrapper","GestureDetector","GestureObjects","Gesture","NativeViewGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","Switch","TextInput","DrawerLayoutAndroid","FlatList","Swipeable","DrawerLayout"],"mappings":"AAAA,SAASA,UAAT,QAA2B,QAA3B;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,yBAAjD;AACA,SAASD,OAAO,IAAIE,sBAApB,QAAkD,0BAAlD;AA4CA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,wBAAT,QAAyC,qCAAzC;AACA,SAASC,uBAAT,QAAwC,oCAAxC;AACA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAASC,sBAAT,QAAuC,mCAAvC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAAST,OAAO,IAAIU,mBAApB,QAA+C,gCAA/C;AAKA,SAASC,eAAT,QAAgC,qCAAhC;AACA,SAASC,cAAc,IAAIC,OAA3B,QAA0C,oCAA1C;AAiBA,SAASC,wBAAT,QAAyC,qCAAzC;AAOA,SACEC,SADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,gBAJF,QAKO,6BALP;AAMA,SACEC,kBADF,EAEEC,uBAFF,EAGEC,gBAHF,EAIEC,wBAJF,QAKO,yBALP;AAMA,SACEC,UADF,EAEEC,MAFF,EAGEC,SAHF,EAIEC,mBAJF,EAKEC,QALF,QAMO,gCANP;AA8CA,SAAS3B,OAAO,IAAI4B,SAApB,QAAqC,wBAArC;AASA,SAAS5B,OAAO,IAAI6B,YAApB,QAAwC,2BAAxC;AAEAhC,UAAU","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { default as gestureHandlerRootHOC } from './gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './GestureHandlerRootView';\nexport type {\n // event types\n GestureEvent,\n HandlerStateChangeEvent,\n // event payloads types\n GestureEventPayload,\n HandlerStateChangeEventPayload,\n // pointer events\n GestureTouchEvent,\n TouchData,\n // new api event types\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n TapGestureHandlerProps,\n} from './handlers/TapGestureHandler';\nexport type {\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureHandlerProps,\n} from './handlers/ForceTouchGestureHandler';\nexport type {\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from './handlers/LongPressGestureHandler';\nexport type {\n PanGestureHandlerEventPayload,\n PanGestureHandlerProps,\n} from './handlers/PanGestureHandler';\nexport type {\n PinchGestureHandlerEventPayload,\n PinchGestureHandlerProps,\n} from './handlers/PinchGestureHandler';\nexport type {\n RotationGestureHandlerEventPayload,\n RotationGestureHandlerProps,\n} from './handlers/RotationGestureHandler';\nexport type {\n FlingGestureHandlerEventPayload,\n FlingGestureHandlerProps,\n} from './handlers/FlingGestureHandler';\nexport { TapGestureHandler } from './handlers/TapGestureHandler';\nexport { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';\nexport { LongPressGestureHandler } from './handlers/LongPressGestureHandler';\nexport { PanGestureHandler } from './handlers/PanGestureHandler';\nexport { PinchGestureHandler } from './handlers/PinchGestureHandler';\nexport { RotationGestureHandler } from './handlers/RotationGestureHandler';\nexport { FlingGestureHandler } from './handlers/FlingGestureHandler';\nexport { default as createNativeWrapper } from './handlers/createNativeWrapper';\nexport type {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from './handlers/NativeViewGestureHandler';\nexport { GestureDetector } from './handlers/gestures/GestureDetector';\nexport { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';\nexport type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';\nexport type { PanGestureType as PanGesture } from './handlers/gestures/panGesture';\nexport type { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture';\nexport type { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture';\nexport type { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture';\nexport type { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture';\nexport type { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture';\nexport type { NativeGestureType as NativeGesture } from './handlers/gestures/nativeGesture';\nexport type { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture';\nexport type {\n ComposedGestureType as ComposedGesture,\n RaceGestureType as RaceGesture,\n SimultaneousGestureType as SimultaneousGesture,\n ExclusiveGestureType as ExclusiveGesture,\n} from './handlers/gestures/gestureComposition';\nexport type { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager';\nexport { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';\nexport type {\n RawButtonProps,\n BaseButtonProps,\n RectButtonProps,\n BorderlessButtonProps,\n} from './components/GestureButtons';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n} from './components/GestureButtons';\nexport {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} from './components/touchables';\nexport {\n ScrollView,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n FlatList,\n} from './components/GestureComponents';\nexport type {\n //events\n GestureHandlerGestureEvent,\n GestureHandlerStateChangeEvent,\n //event payloads\n GestureHandlerGestureEventNativeEvent,\n GestureHandlerStateChangeNativeEvent,\n NativeViewGestureHandlerGestureEvent,\n NativeViewGestureHandlerStateChangeEvent,\n TapGestureHandlerGestureEvent,\n TapGestureHandlerStateChangeEvent,\n ForceTouchGestureHandlerGestureEvent,\n ForceTouchGestureHandlerStateChangeEvent,\n LongPressGestureHandlerGestureEvent,\n LongPressGestureHandlerStateChangeEvent,\n PanGestureHandlerGestureEvent,\n PanGestureHandlerStateChangeEvent,\n PinchGestureHandlerGestureEvent,\n PinchGestureHandlerStateChangeEvent,\n RotationGestureHandlerGestureEvent,\n RotationGestureHandlerStateChangeEvent,\n FlingGestureHandlerGestureEvent,\n FlingGestureHandlerStateChangeEvent,\n // handlers props\n NativeViewGestureHandlerProperties,\n TapGestureHandlerProperties,\n LongPressGestureHandlerProperties,\n PanGestureHandlerProperties,\n PinchGestureHandlerProperties,\n RotationGestureHandlerProperties,\n FlingGestureHandlerProperties,\n ForceTouchGestureHandlerProperties,\n // buttons props\n RawButtonProperties,\n BaseButtonProperties,\n RectButtonProperties,\n BorderlessButtonProperties,\n} from './handlers/gestureHandlerTypesCompat';\n\nexport { default as Swipeable } from './components/Swipeable';\nexport type {\n DrawerLayoutProps,\n DrawerPosition,\n DrawerState,\n DrawerType,\n DrawerLockMode,\n DrawerKeyboardDismissMode,\n} from './components/DrawerLayout';\nexport { default as DrawerLayout } from './components/DrawerLayout';\n\ninitialize();\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["init.ts"],"names":["startListening","initialize"],"mappings":"AAAA,SAASA,cAAT,QAA+B,mCAA/B;AAEA,OAAO,SAASC,UAAT,GAAsB;AAC3BD,EAAAA,cAAc;AACf","sourcesContent":["import { startListening } from './handlers/gestures/eventReceiver';\n\nexport function initialize() {\n startListening();\n}\n"]}
|
package/lib/module/mocks.js
CHANGED
@@ -1,18 +1,47 @@
|
|
1
|
-
import {
|
1
|
+
import { TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, ScrollView, FlatList, Switch, TextInput, DrawerLayoutAndroid, View } from 'react-native';
|
2
2
|
import { State } from './State';
|
3
3
|
import { Directions } from './Directions';
|
4
4
|
|
5
5
|
const NOOP = () => {// do nothing
|
6
6
|
};
|
7
7
|
|
8
|
-
const ScrollView = RNScrollView;
|
9
8
|
const PanGestureHandler = View;
|
10
9
|
const attachGestureHandler = NOOP;
|
11
10
|
const createGestureHandler = NOOP;
|
12
11
|
const dropGestureHandler = NOOP;
|
13
12
|
const updateGestureHandler = NOOP;
|
13
|
+
const NativeViewGestureHandler = View;
|
14
|
+
const TapGestureHandler = View;
|
15
|
+
const ForceTouchGestureHandler = View;
|
16
|
+
const LongPressGestureHandler = View;
|
17
|
+
const PinchGestureHandler = View;
|
18
|
+
const RotationGestureHandler = View;
|
19
|
+
const FlingGestureHandler = View;
|
20
|
+
const RawButton = TouchableNativeFeedback;
|
21
|
+
const BaseButton = TouchableNativeFeedback;
|
22
|
+
const RectButton = TouchableNativeFeedback;
|
23
|
+
const BorderlessButton = TouchableNativeFeedback;
|
14
24
|
export default {
|
25
|
+
TouchableHighlight,
|
26
|
+
TouchableNativeFeedback,
|
27
|
+
TouchableOpacity,
|
28
|
+
TouchableWithoutFeedback,
|
15
29
|
ScrollView,
|
30
|
+
FlatList,
|
31
|
+
Switch,
|
32
|
+
TextInput,
|
33
|
+
DrawerLayoutAndroid,
|
34
|
+
NativeViewGestureHandler,
|
35
|
+
TapGestureHandler,
|
36
|
+
ForceTouchGestureHandler,
|
37
|
+
LongPressGestureHandler,
|
38
|
+
PinchGestureHandler,
|
39
|
+
RotationGestureHandler,
|
40
|
+
FlingGestureHandler,
|
41
|
+
RawButton,
|
42
|
+
BaseButton,
|
43
|
+
RectButton,
|
44
|
+
BorderlessButton,
|
16
45
|
PanGestureHandler,
|
17
46
|
attachGestureHandler,
|
18
47
|
createGestureHandler,
|
package/lib/module/mocks.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["mocks.ts"],"names":["
|
1
|
+
{"version":3,"sources":["mocks.ts"],"names":["TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","FlatList","Switch","TextInput","DrawerLayoutAndroid","View","State","Directions","NOOP","PanGestureHandler","attachGestureHandler","createGestureHandler","dropGestureHandler","updateGestureHandler","NativeViewGestureHandler","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton"],"mappings":"AAAA,SACEA,kBADF,EAEEC,uBAFF,EAGEC,gBAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,QANF,EAOEC,MAPF,EAQEC,SARF,EASEC,mBATF,EAUEC,IAVF,QAWO,cAXP;AAYA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,UAAT,QAA2B,cAA3B;;AAEA,MAAMC,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,iBAAiB,GAAGJ,IAA1B;AACA,MAAMK,oBAAoB,GAAGF,IAA7B;AACA,MAAMG,oBAAoB,GAAGH,IAA7B;AACA,MAAMI,kBAAkB,GAAGJ,IAA3B;AACA,MAAMK,oBAAoB,GAAGL,IAA7B;AACA,MAAMM,wBAAwB,GAAGT,IAAjC;AACA,MAAMU,iBAAiB,GAAGV,IAA1B;AACA,MAAMW,wBAAwB,GAAGX,IAAjC;AACA,MAAMY,uBAAuB,GAAGZ,IAAhC;AACA,MAAMa,mBAAmB,GAAGb,IAA5B;AACA,MAAMc,sBAAsB,GAAGd,IAA/B;AACA,MAAMe,mBAAmB,GAAGf,IAA5B;AACA,MAAMgB,SAAS,GAAGxB,uBAAlB;AACA,MAAMyB,UAAU,GAAGzB,uBAAnB;AACA,MAAM0B,UAAU,GAAG1B,uBAAnB;AACA,MAAM2B,gBAAgB,GAAG3B,uBAAzB;AAEA,eAAe;AACbD,EAAAA,kBADa;AAEbC,EAAAA,uBAFa;AAGbC,EAAAA,gBAHa;AAIbC,EAAAA,wBAJa;AAKbC,EAAAA,UALa;AAMbC,EAAAA,QANa;AAObC,EAAAA,MAPa;AAQbC,EAAAA,SARa;AASbC,EAAAA,mBATa;AAUbU,EAAAA,wBAVa;AAWbC,EAAAA,iBAXa;AAYbC,EAAAA,wBAZa;AAabC,EAAAA,uBAba;AAcbC,EAAAA,mBAda;AAebC,EAAAA,sBAfa;AAgBbC,EAAAA,mBAhBa;AAiBbC,EAAAA,SAjBa;AAkBbC,EAAAA,UAlBa;AAmBbC,EAAAA,UAnBa;AAoBbC,EAAAA,gBApBa;AAqBbf,EAAAA,iBArBa;AAsBbC,EAAAA,oBAtBa;AAuBbC,EAAAA,oBAvBa;AAwBbC,EAAAA,kBAxBa;AAyBbC,EAAAA,oBAzBa;AA0Bb;AACAN,EAAAA,UA3Ba;AA4BbD,EAAAA;AA5Ba,CAAf","sourcesContent":["import {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n View,\n} from 'react-native';\nimport { State } from './State';\nimport { Directions } from './Directions';\n\nconst NOOP = () => {\n // do nothing\n};\nconst PanGestureHandler = View;\nconst attachGestureHandler = NOOP;\nconst createGestureHandler = NOOP;\nconst dropGestureHandler = NOOP;\nconst updateGestureHandler = NOOP;\nconst NativeViewGestureHandler = View;\nconst TapGestureHandler = View;\nconst ForceTouchGestureHandler = View;\nconst LongPressGestureHandler = View;\nconst PinchGestureHandler = View;\nconst RotationGestureHandler = View;\nconst FlingGestureHandler = View;\nconst RawButton = TouchableNativeFeedback;\nconst BaseButton = TouchableNativeFeedback;\nconst RectButton = TouchableNativeFeedback;\nconst BorderlessButton = TouchableNativeFeedback;\n\nexport default {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n NativeViewGestureHandler,\n TapGestureHandler,\n ForceTouchGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PanGestureHandler,\n attachGestureHandler,\n createGestureHandler,\n dropGestureHandler,\n updateGestureHandler,\n // probably can be removed\n Directions,\n State,\n} as const;\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["utils.ts"],"names":["toArray","object","Array","isArray"],"mappings":"AAAA,OAAO,SAASA,OAAT,CAAoBC,MAApB,EAA0C;AAC/C,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAL,EAA4B;AAC1B,WAAO,CAACA,MAAD,CAAP;AACD;;AAED,SAAOA,MAAP;AACD","sourcesContent":["export function toArray<T>(object: T | T[]): T[] {\n if (!Array.isArray(object)) {\n return [object];\n }\n\n return object;\n}\n"]}
|
package/lib/module/web/Errors.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export class GesturePropError extends Error {
|
2
2
|
constructor(name, value, expectedType) {
|
3
|
-
super(
|
3
|
+
super(`Invalid property \`${name}: ${value}\` expected \`${expectedType}\``);
|
4
4
|
}
|
5
5
|
|
6
6
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Errors.ts"],"names":["GesturePropError","Error","constructor","name","value","expectedType"],"mappings":"AAAA,OAAO,MAAMA,gBAAN,SAA+BC,KAA/B,CAAqC;AAC1CC,EAAAA,WAAW,CAACC,IAAD,EAAeC,KAAf,EAA+BC,YAA/B,EAAqD;AAC9D,
|
1
|
+
{"version":3,"sources":["Errors.ts"],"names":["GesturePropError","Error","constructor","name","value","expectedType"],"mappings":"AAAA,OAAO,MAAMA,gBAAN,SAA+BC,KAA/B,CAAqC;AAC1CC,EAAAA,WAAW,CAACC,IAAD,EAAeC,KAAf,EAA+BC,YAA/B,EAAqD;AAC9D,UACG,sBAAqBF,IAAK,KAAIC,KAAM,iBAAgBC,YAAa,IADpE;AAGD;;AALyC","sourcesContent":["export class GesturePropError extends Error {\n constructor(name: string, value: unknown, expectedType: string) {\n super(\n `Invalid property \\`${name}: ${value}\\` expected \\`${expectedType}\\``\n );\n }\n}\n"]}
|
@@ -13,7 +13,7 @@ let gestureInstances = 0;
|
|
13
13
|
|
14
14
|
class GestureHandler {
|
15
15
|
get id() {
|
16
|
-
return
|
16
|
+
return `${this.name}${this.gestureInstance}`;
|
17
17
|
}
|
18
18
|
|
19
19
|
get isDiscrete() {
|
@@ -378,8 +378,8 @@ class GestureHandler {
|
|
378
378
|
setupEvents() {
|
379
379
|
// TODO(TS) Hammer types aren't exactly that what we get in runtime
|
380
380
|
if (!this.isDiscrete) {
|
381
|
-
this.hammer.on(
|
382
|
-
this.hammer.on(
|
381
|
+
this.hammer.on(`${this.name}start`, event => this.onStart(event));
|
382
|
+
this.hammer.on(`${this.name}end ${this.name}cancel`, event => {
|
383
383
|
this.onGestureEnded(event);
|
384
384
|
});
|
385
385
|
}
|
@@ -451,9 +451,7 @@ function invokeNullableMethod(method, event) {
|
|
451
451
|
} = method.__nodeConfig;
|
452
452
|
|
453
453
|
if (Array.isArray(argMapping)) {
|
454
|
-
for (const index
|
455
|
-
const [key, value] = argMapping[index];
|
456
|
-
|
454
|
+
for (const [index, [key, value]] of argMapping.entries()) {
|
457
455
|
if (key in event.nativeEvent) {
|
458
456
|
// @ts-ignore fix method type
|
459
457
|
const nativeValue = event.nativeEvent[key];
|