@react-native-oh-tpl/react-native-gesture-handler 2.12.1-0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/DrawerLayout/package.json +6 -0
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/RNGestureHandler.podspec +44 -0
- package/Swipeable/package.json +6 -0
- package/android/build.gradle +209 -0
- package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
- package/android/fabric/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +29 -0
- package/android/fabric/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +12 -0
- package/android/gradle.properties +19 -0
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +10 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +50 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +23 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +25 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +16 -0
- package/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +13 -0
- package/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +17 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +21 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +100 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +807 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerInteractionController.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +671 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerRegistry.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +47 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +120 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +100 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/ManualGestureHandler.kt +11 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +257 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/OnTouchEventListener.kt +9 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +322 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +103 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PointerEventsConfig.kt +23 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +125 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +93 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/ScaleGestureDetector.java +558 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt +168 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/ViewConfigurationHelper.kt +10 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +16 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +423 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +15 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +75 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +74 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +702 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +100 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +142 -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 +78 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +51 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +78 -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/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/FlingGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +22 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/LongPressGestureHandlerEventDataBuilder.kt +33 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/ManualGestureHandlerEventDataBuilder.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/NativeGestureHandlerEventDataBuilder.kt +18 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +42 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PinchGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/RotationGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/TapGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/jni/CMakeLists.txt +37 -0
- package/android/src/main/jni/cpp-adapter.cpp +44 -0
- package/ios/Handlers/RNFlingHandler.h +4 -0
- package/ios/Handlers/RNFlingHandler.m +152 -0
- package/ios/Handlers/RNForceTouchHandler.h +4 -0
- package/ios/Handlers/RNForceTouchHandler.m +175 -0
- package/ios/Handlers/RNHoverHandler.h +12 -0
- package/ios/Handlers/RNHoverHandler.m +153 -0
- package/ios/Handlers/RNLongPressHandler.h +12 -0
- package/ios/Handlers/RNLongPressHandler.m +183 -0
- package/ios/Handlers/RNManualHandler.h +4 -0
- package/ios/Handlers/RNManualHandler.m +88 -0
- package/ios/Handlers/RNNativeViewHandler.h +15 -0
- package/ios/Handlers/RNNativeViewHandler.mm +193 -0
- package/ios/Handlers/RNPanHandler.h +12 -0
- package/ios/Handlers/RNPanHandler.m +331 -0
- package/ios/Handlers/RNPinchHandler.h +12 -0
- package/ios/Handlers/RNPinchHandler.m +95 -0
- package/ios/Handlers/RNRotationHandler.h +12 -0
- package/ios/Handlers/RNRotationHandler.m +93 -0
- package/ios/Handlers/RNTapHandler.h +12 -0
- package/ios/Handlers/RNTapHandler.m +265 -0
- package/ios/RNGHTouchEventType.h +9 -0
- package/ios/RNGestureHandler.h +90 -0
- package/ios/RNGestureHandler.m +493 -0
- package/ios/RNGestureHandler.xcodeproj/project.pbxproj +690 -0
- package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNGestureHandlerActionType.h +10 -0
- package/ios/RNGestureHandlerButton.h +19 -0
- package/ios/RNGestureHandlerButton.m +77 -0
- package/ios/RNGestureHandlerButtonComponentView.h +17 -0
- package/ios/RNGestureHandlerButtonComponentView.mm +64 -0
- package/ios/RNGestureHandlerButtonManager.h +5 -0
- package/ios/RNGestureHandlerButtonManager.m +34 -0
- package/ios/RNGestureHandlerDirection.h +8 -0
- package/ios/RNGestureHandlerEvents.h +65 -0
- package/ios/RNGestureHandlerEvents.m +260 -0
- package/ios/RNGestureHandlerManager.h +35 -0
- package/ios/RNGestureHandlerManager.mm +367 -0
- package/ios/RNGestureHandlerModule.h +7 -0
- package/ios/RNGestureHandlerModule.mm +320 -0
- package/ios/RNGestureHandlerPointerTracker.h +25 -0
- package/ios/RNGestureHandlerPointerTracker.m +243 -0
- package/ios/RNGestureHandlerRegistry.h +21 -0
- package/ios/RNGestureHandlerRegistry.m +63 -0
- package/ios/RNGestureHandlerRootViewComponentView.mm +21 -0
- package/ios/RNGestureHandlerState.h +10 -0
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/RNManualActivationRecognizer.h +10 -0
- package/ios/RNManualActivationRecognizer.m +88 -0
- package/ios/RNRootViewGestureRecognizer.h +17 -0
- package/ios/RNRootViewGestureRecognizer.m +106 -0
- package/jest-utils/package.json +6 -0
- package/jestSetup.js +7 -0
- package/lib/commonjs/ActionType.js +15 -0
- package/lib/commonjs/ActionType.js.map +1 -0
- package/lib/commonjs/Directions.js +15 -0
- package/lib/commonjs/Directions.js.map +1 -0
- package/lib/commonjs/EnableNewWebImplementation.js +35 -0
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js +15 -0
- package/lib/commonjs/GestureHandlerRootViewContext.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 +29 -0
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js +149 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +163 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.windows.js +158 -0
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +16 -0
- package/lib/commonjs/RNRenderer.js.map +1 -0
- package/lib/commonjs/RNRenderer.web.js +11 -0
- package/lib/commonjs/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/State.js +18 -0
- package/lib/commonjs/State.js.map +1 -0
- package/lib/commonjs/TouchEventType.js +16 -0
- package/lib/commonjs/TouchEventType.js.map +1 -0
- package/lib/commonjs/components/DrawerLayout.js +566 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -0
- package/lib/commonjs/components/GestureButtons.js +240 -0
- package/lib/commonjs/components/GestureButtons.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +115 -0
- package/lib/commonjs/components/GestureComponents.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.web.js +52 -0
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +14 -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/GestureHandlerRootView.android.js +31 -0
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +31 -0
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.web.js +25 -0
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +408 -0
- package/lib/commonjs/components/Swipeable.js.map +1 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js +40 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js +289 -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 +77 -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/getReactNativeVersion.js +22 -0
- package/lib/commonjs/getReactNativeVersion.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.web.js +11 -0
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +27 -0
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js +15 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/commonjs/ghQueueMicrotask.js +12 -0
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js +25 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +49 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +27 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +27 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js +123 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js +23 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js +14 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js +23 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/TapGestureHandler.js +27 -0
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +464 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -0
- package/lib/commonjs/handlers/createNativeWrapper.js +74 -0
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +103 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +6 -0
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js +669 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js +147 -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 +241 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js +105 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js +90 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +65 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +32 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js +74 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js +35 -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 +149 -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 +37 -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 +60 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/commonjs/handlers/handlersRegistry.js +67 -0
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
- package/lib/commonjs/index.js +266 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/init.js +32 -0
- package/lib/commonjs/init.js.map +1 -0
- package/lib/commonjs/jestUtils/index.js +20 -0
- package/lib/commonjs/jestUtils/index.js.map +1 -0
- package/lib/commonjs/jestUtils/jestUtils.js +375 -0
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -0
- package/lib/commonjs/mocks.js +66 -0
- package/lib/commonjs/mocks.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +15 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +15 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/commonjs/typeUtils.js +2 -0
- package/lib/commonjs/typeUtils.js.map +1 -0
- package/lib/commonjs/utils.js +63 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/constants.js +16 -0
- package/lib/commonjs/web/constants.js.map +1 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +165 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +156 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +167 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/GestureHandler.js +794 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +62 -0
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +151 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +61 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +178 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js +448 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +174 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +186 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js +280 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web/interfaces.js +55 -0
- package/lib/commonjs/web/interfaces.js.map +1 -0
- package/lib/commonjs/web/tools/CircularBuffer.js +59 -0
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -0
- package/lib/commonjs/web/tools/EventManager.js +127 -0
- package/lib/commonjs/web/tools/EventManager.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js +6 -0
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +349 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +118 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/commonjs/web/tools/InteractionManager.js +114 -0
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js +204 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/commonjs/web/tools/NodeManager.js +48 -0
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerEventManager.js +198 -0
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerTracker.js +226 -0
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -0
- package/lib/commonjs/web/tools/TouchEventManager.js +138 -0
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -0
- package/lib/commonjs/web/tools/VelocityTracker.js +111 -0
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
- package/lib/commonjs/web/utils.js +15 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +105 -0
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +53 -0
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/Errors.js +16 -0
- package/lib/commonjs/web_hammer/Errors.js.map +1 -0
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +170 -0
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/GestureHandler.js +579 -0
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +54 -0
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +71 -0
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +66 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/NodeManager.js +46 -0
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -0
- package/lib/commonjs/web_hammer/PanGestureHandler.js +208 -0
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +40 -0
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/PressGestureHandler.js +188 -0
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +44 -0
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/TapGestureHandler.js +192 -0
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/constants.js +64 -0
- package/lib/commonjs/web_hammer/constants.js.map +1 -0
- package/lib/commonjs/web_hammer/utils.js +42 -0
- package/lib/commonjs/web_hammer/utils.js.map +1 -0
- package/lib/module/ActionType.js +7 -0
- package/lib/module/ActionType.js.map +1 -0
- package/lib/module/Directions.js +7 -0
- package/lib/module/Directions.js.map +1 -0
- package/lib/module/EnableNewWebImplementation.js +22 -0
- package/lib/module/EnableNewWebImplementation.js.map +1 -0
- package/lib/module/GestureHandlerRootViewContext.js +3 -0
- package/lib/module/GestureHandlerRootViewContext.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 +19 -0
- package/lib/module/RNGestureHandlerModule.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.macos.js +110 -0
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.web.js +122 -0
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.windows.js +118 -0
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -0
- package/lib/module/RNRenderer.js +4 -0
- package/lib/module/RNRenderer.js.map +1 -0
- package/lib/module/RNRenderer.web.js +4 -0
- package/lib/module/RNRenderer.web.js.map +1 -0
- package/lib/module/State.js +10 -0
- package/lib/module/State.js.map +1 -0
- package/lib/module/TouchEventType.js +8 -0
- package/lib/module/TouchEventType.js.map +1 -0
- package/lib/module/components/DrawerLayout.js +551 -0
- package/lib/module/components/DrawerLayout.js.map +1 -0
- package/lib/module/components/GestureButtons.js +206 -0
- package/lib/module/components/GestureButtons.js.map +1 -0
- package/lib/module/components/GestureComponents.js +90 -0
- package/lib/module/components/GestureComponents.js.map +1 -0
- package/lib/module/components/GestureComponents.web.js +28 -0
- package/lib/module/components/GestureComponents.web.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.js +3 -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/GestureHandlerRootView.android.js +14 -0
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +14 -0
- package/lib/module/components/GestureHandlerRootView.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.web.js +9 -0
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/components/Swipeable.js +390 -0
- package/lib/module/components/Swipeable.js.map +1 -0
- package/lib/module/components/gestureHandlerRootHOC.js +22 -0
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/module/components/touchables/GenericTouchable.js +273 -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/lib/module/components/touchables/TouchableNativeFeedback.js +3 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -0
- package/lib/module/components/touchables/TouchableOpacity.js +63 -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/lib/module/components/touchables/index.js +5 -0
- package/lib/module/components/touchables/index.js.map +1 -0
- package/lib/module/getReactNativeVersion.js +10 -0
- package/lib/module/getReactNativeVersion.js.map +1 -0
- package/lib/module/getReactNativeVersion.web.js +4 -0
- package/lib/module/getReactNativeVersion.web.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +20 -0
- package/lib/module/getShadowNodeFromRef.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.web.js +8 -0
- package/lib/module/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/module/ghQueueMicrotask.js +5 -0
- package/lib/module/ghQueueMicrotask.js.map +1 -0
- package/lib/module/handlers/FlingGestureHandler.js +11 -0
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/handlers/ForceTouchGestureHandler.js +31 -0
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js +13 -0
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/handlers/NativeViewGestureHandler.js +12 -0
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/handlers/PanGestureHandler.js +107 -0
- package/lib/module/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/handlers/PinchGestureHandler.js +10 -0
- package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.js +3 -0
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/module/handlers/RotationGestureHandler.js +10 -0
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/handlers/TapGestureHandler.js +13 -0
- package/lib/module/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/handlers/createHandler.js +433 -0
- package/lib/module/handlers/createHandler.js.map +1 -0
- package/lib/module/handlers/createNativeWrapper.js +62 -0
- package/lib/module/handlers/createNativeWrapper.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +81 -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 +619 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/module/handlers/gestures/eventReceiver.js +131 -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 +222 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -0
- package/lib/module/handlers/gestures/gestureComposition.js +90 -0
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/module/handlers/gestures/gestureObjects.js +71 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/module/handlers/gestures/gestureStateManager.js +54 -0
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/module/handlers/gestures/gestureStateManager.web.js +21 -0
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -0
- package/lib/module/handlers/gestures/hoverGesture.js +62 -0
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js +25 -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 +140 -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 +30 -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 +50 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/module/handlers/handlersRegistry.js +44 -0
- package/lib/module/handlers/handlersRegistry.js.map +1 -0
- package/lib/module/index.js +25 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/init.js +16 -0
- package/lib/module/init.js.map +1 -0
- package/lib/module/jestUtils/index.js +2 -0
- package/lib/module/jestUtils/index.js.map +1 -0
- package/lib/module/jestUtils/jestUtils.js +350 -0
- package/lib/module/jestUtils/jestUtils.js.map +1 -0
- package/lib/module/mocks.js +56 -0
- package/lib/module/mocks.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/module/typeUtils.js +2 -0
- package/lib/module/typeUtils.js.map +1 -0
- package/lib/module/utils.js +44 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/web/constants.js +8 -0
- package/lib/module/web/constants.js.map +1 -0
- package/lib/module/web/detectors/RotationGestureDetector.js +155 -0
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js +145 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js +152 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/GestureHandler.js +776 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -0
- package/lib/module/web/handlers/HoverGestureHandler.js +47 -0
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js +136 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/ManualGestureHandler.js +49 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +163 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PanGestureHandler.js +433 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PinchGestureHandler.js +159 -0
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/RotationGestureHandler.js +171 -0
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/TapGestureHandler.js +265 -0
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/web/interfaces.js +45 -0
- package/lib/module/web/interfaces.js.map +1 -0
- package/lib/module/web/tools/CircularBuffer.js +50 -0
- package/lib/module/web/tools/CircularBuffer.js.map +1 -0
- package/lib/module/web/tools/EventManager.js +118 -0
- package/lib/module/web/tools/EventManager.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerDelegate.js +2 -0
- package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +335 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +102 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/module/web/tools/InteractionManager.js +105 -0
- package/lib/module/web/tools/InteractionManager.js.map +1 -0
- package/lib/module/web/tools/LeastSquareSolver.js +195 -0
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/module/web/tools/NodeManager.js +39 -0
- package/lib/module/web/tools/NodeManager.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +184 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -0
- package/lib/module/web/tools/PointerTracker.js +213 -0
- package/lib/module/web/tools/PointerTracker.js.map +1 -0
- package/lib/module/web/tools/TouchEventManager.js +124 -0
- package/lib/module/web/tools/TouchEventManager.js.map +1 -0
- package/lib/module/web/tools/VelocityTracker.js +98 -0
- package/lib/module/web/tools/VelocityTracker.js.map +1 -0
- package/lib/module/web/utils.js +8 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/module/web_hammer/DiscreteGestureHandler.js +94 -0
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js +40 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/Errors.js +7 -0
- package/lib/module/web_hammer/Errors.js.map +1 -0
- package/lib/module/web_hammer/FlingGestureHandler.js +156 -0
- package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/GestureHandler.js +563 -0
- package/lib/module/web_hammer/GestureHandler.js.map +1 -0
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +44 -0
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/LongPressGestureHandler.js +58 -0
- package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/NativeViewGestureHandler.js +49 -0
- package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/NodeManager.js +33 -0
- package/lib/module/web_hammer/NodeManager.js.map +1 -0
- package/lib/module/web_hammer/PanGestureHandler.js +194 -0
- package/lib/module/web_hammer/PanGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/PinchGestureHandler.js +29 -0
- package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/PressGestureHandler.js +174 -0
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/RotationGestureHandler.js +32 -0
- package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/TapGestureHandler.js +180 -0
- package/lib/module/web_hammer/TapGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/constants.js +43 -0
- package/lib/module/web_hammer/constants.js.map +1 -0
- package/lib/module/web_hammer/utils.js +19 -0
- package/lib/module/web_hammer/utils.js.map +1 -0
- package/lib/typescript/ActionType.d.ts +7 -0
- package/lib/typescript/Directions.d.ts +7 -0
- package/lib/typescript/EnableNewWebImplementation.d.ts +3 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +3 -0
- package/lib/typescript/PlatformConstants.d.ts +5 -0
- package/lib/typescript/PlatformConstants.web.d.ts +4 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +13 -0
- package/lib/typescript/RNGestureHandlerModule.macos.d.ts +47 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +50 -0
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +48 -0
- package/lib/typescript/RNRenderer.d.ts +1 -0
- package/lib/typescript/RNRenderer.web.d.ts +3 -0
- package/lib/typescript/State.d.ts +9 -0
- package/lib/typescript/TouchEventType.d.ts +8 -0
- package/lib/typescript/components/DrawerLayout.d.ts +148 -0
- package/lib/typescript/components/GestureButtons.d.ts +121 -0
- package/lib/typescript/components/GestureComponents.d.ts +22 -0
- package/lib/typescript/components/GestureComponents.web.d.ts +8 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +4 -0
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +4 -0
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +6 -0
- package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -0
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +6 -0
- package/lib/typescript/components/Swipeable.d.ts +178 -0
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +3 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +68 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +36 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +45 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +2 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +25 -0
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +7 -0
- package/lib/typescript/components/touchables/index.d.ts +7 -0
- package/lib/typescript/getReactNativeVersion.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
- package/lib/typescript/ghQueueMicrotask.d.ts +1 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +34 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +44 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +56 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +28 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +139 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +29 -0
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +29 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +57 -0
- package/lib/typescript/handlers/createHandler.d.ts +11 -0
- package/lib/typescript/handlers/createNativeWrapper.d.ts +3 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +68 -0
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +42 -0
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +19 -0
- package/lib/typescript/handlers/gestures/eventReceiver.d.ts +4 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +15 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +110 -0
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +41 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +4 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +32 -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 +11 -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 +14 -0
- package/lib/typescript/index.d.ts +52 -0
- package/lib/typescript/init.d.ts +2 -0
- package/lib/typescript/jestUtils/index.d.ts +1 -0
- package/lib/typescript/jestUtils/jestUtils.d.ts +28 -0
- package/lib/typescript/mocks.d.ts +44 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +14 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +6 -0
- package/lib/typescript/typeUtils.d.ts +1 -0
- package/lib/typescript/utils.d.ts +8 -0
- package/lib/typescript/web/constants.d.ts +7 -0
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +30 -0
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +29 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +27 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +90 -0
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +10 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +26 -0
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +12 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +24 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +55 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +28 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +29 -0
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +39 -0
- package/lib/typescript/web/interfaces.d.ts +141 -0
- package/lib/typescript/web/tools/CircularBuffer.d.ts +11 -0
- package/lib/typescript/web/tools/EventManager.d.ts +34 -0
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +22 -0
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +29 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +21 -0
- package/lib/typescript/web/tools/InteractionManager.d.ts +17 -0
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +12 -0
- package/lib/typescript/web/tools/NodeManager.d.ts +11 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +8 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +53 -0
- package/lib/typescript/web/tools/TouchEventManager.d.ts +6 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +13 -0
- package/lib/typescript/web/utils.d.ts +4 -0
- package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +20 -0
- package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +15 -0
- package/lib/typescript/web_hammer/Errors.d.ts +3 -0
- package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +43 -0
- package/lib/typescript/web_hammer/GestureHandler.d.ts +145 -0
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +40 -0
- package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +38 -0
- package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +7 -0
- package/lib/typescript/web_hammer/NodeManager.d.ts +8 -0
- package/lib/typescript/web_hammer/PanGestureHandler.d.ts +56 -0
- package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +13 -0
- package/lib/typescript/web_hammer/PressGestureHandler.d.ts +83 -0
- package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +13 -0
- package/lib/typescript/web_hammer/TapGestureHandler.d.ts +57 -0
- package/lib/typescript/web_hammer/constants.d.ts +39 -0
- package/lib/typescript/web_hammer/utils.d.ts +9 -0
- package/package.json +156 -0
- package/src/ActionType.ts +9 -0
- package/src/Directions.ts +9 -0
- package/src/EnableNewWebImplementation.ts +35 -0
- package/src/GestureHandlerRootViewContext.ts +3 -0
- package/src/PlatformConstants.ts +8 -0
- package/src/PlatformConstants.web.ts +5 -0
- package/src/RNGestureHandlerModule.macos.ts +133 -0
- package/src/RNGestureHandlerModule.ts +50 -0
- package/src/RNGestureHandlerModule.web.ts +146 -0
- package/src/RNGestureHandlerModule.windows.ts +144 -0
- package/src/RNRenderer.ts +3 -0
- package/src/RNRenderer.web.ts +3 -0
- package/src/State.ts +13 -0
- package/src/TouchEventType.ts +10 -0
- package/src/components/DrawerLayout.tsx +743 -0
- package/src/components/GestureButtons.tsx +332 -0
- package/src/components/GestureComponents.tsx +148 -0
- package/src/components/GestureComponents.web.tsx +41 -0
- package/src/components/GestureHandlerButton.tsx +5 -0
- package/src/components/GestureHandlerButton.web.tsx +6 -0
- package/src/components/GestureHandlerRootView.android.tsx +24 -0
- package/src/components/GestureHandlerRootView.tsx +23 -0
- package/src/components/GestureHandlerRootView.web.tsx +17 -0
- package/src/components/Swipeable.tsx +584 -0
- package/src/components/gestureHandlerRootHOC.tsx +32 -0
- package/src/components/touchables/GenericTouchable.tsx +301 -0
- package/src/components/touchables/TouchableHighlight.tsx +115 -0
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +91 -0
- package/src/components/touchables/TouchableNativeFeedback.tsx +3 -0
- package/src/components/touchables/TouchableOpacity.tsx +75 -0
- package/src/components/touchables/TouchableWithoutFeedback.tsx +14 -0
- package/src/components/touchables/index.ts +7 -0
- package/src/getReactNativeVersion.ts +11 -0
- package/src/getReactNativeVersion.web.ts +3 -0
- package/src/getShadowNodeFromRef.ts +22 -0
- package/src/getShadowNodeFromRef.web.ts +7 -0
- package/src/ghQueueMicrotask.ts +5 -0
- package/src/handlers/FlingGestureHandler.ts +59 -0
- package/src/handlers/ForceTouchGestureHandler.ts +90 -0
- package/src/handlers/LongPressGestureHandler.ts +88 -0
- package/src/handlers/NativeViewGestureHandler.ts +55 -0
- package/src/handlers/PanGestureHandler.ts +325 -0
- package/src/handlers/PinchGestureHandler.ts +48 -0
- package/src/handlers/PressabilityDebugView.tsx +2 -0
- package/src/handlers/PressabilityDebugView.web.tsx +4 -0
- package/src/handlers/RotationGestureHandler.ts +48 -0
- package/src/handlers/TapGestureHandler.ts +94 -0
- package/src/handlers/createHandler.tsx +533 -0
- package/src/handlers/createNativeWrapper.tsx +80 -0
- package/src/handlers/gestureHandlerCommon.ts +250 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +106 -0
- package/src/handlers/gestures/GestureDetector.tsx +822 -0
- package/src/handlers/gestures/eventReceiver.ts +155 -0
- package/src/handlers/gestures/flingGesture.ts +27 -0
- package/src/handlers/gestures/forceTouchGesture.ts +74 -0
- package/src/handlers/gestures/gesture.ts +349 -0
- package/src/handlers/gestures/gestureComposition.ts +122 -0
- package/src/handlers/gestures/gestureObjects.ts +84 -0
- package/src/handlers/gestures/gestureStateManager.ts +62 -0
- package/src/handlers/gestures/gestureStateManager.web.ts +24 -0
- package/src/handlers/gestures/hoverGesture.ts +83 -0
- package/src/handlers/gestures/longPressGesture.ts +28 -0
- package/src/handlers/gestures/manualGesture.ts +31 -0
- package/src/handlers/gestures/nativeGesture.ts +27 -0
- package/src/handlers/gestures/panGesture.ts +152 -0
- package/src/handlers/gestures/pinchGesture.ts +51 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +56 -0
- package/src/handlers/gestures/rotationGesture.ts +51 -0
- package/src/handlers/gestures/tapGesture.ts +53 -0
- package/src/handlers/handlersRegistry.ts +60 -0
- package/src/index.ts +174 -0
- package/src/init.ts +18 -0
- package/src/jestUtils/index.ts +1 -0
- package/src/jestUtils/jestUtils.ts +505 -0
- package/src/mocks.ts +67 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -0
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
- package/src/typeUtils.ts +1 -0
- package/src/utils.ts +54 -0
- package/src/web/constants.ts +8 -0
- package/src/web/detectors/RotationGestureDetector.ts +168 -0
- package/src/web/detectors/ScaleGestureDetector.ts +172 -0
- package/src/web/handlers/FlingGestureHandler.ts +161 -0
- package/src/web/handlers/GestureHandler.ts +849 -0
- package/src/web/handlers/HoverGestureHandler.ts +43 -0
- package/src/web/handlers/LongPressGestureHandler.ts +125 -0
- package/src/web/handlers/ManualGestureHandler.ts +43 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +167 -0
- package/src/web/handlers/PanGestureHandler.ts +485 -0
- package/src/web/handlers/PinchGestureHandler.ts +158 -0
- package/src/web/handlers/RotationGestureHandler.ts +172 -0
- package/src/web/handlers/TapGestureHandler.ts +273 -0
- package/src/web/interfaces.ts +167 -0
- package/src/web/tools/CircularBuffer.ts +42 -0
- package/src/web/tools/EventManager.ts +104 -0
- package/src/web/tools/GestureHandlerDelegate.ts +23 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +389 -0
- package/src/web/tools/GestureHandlerWebDelegate.ts +115 -0
- package/src/web/tools/InteractionManager.ts +130 -0
- package/src/web/tools/LeastSquareSolver.ts +182 -0
- package/src/web/tools/NodeManager.ts +43 -0
- package/src/web/tools/PointerEventManager.ts +202 -0
- package/src/web/tools/PointerTracker.ts +240 -0
- package/src/web/tools/TouchEventManager.ts +167 -0
- package/src/web/tools/VelocityTracker.ts +98 -0
- package/src/web/utils.ts +8 -0
- package/src/web_hammer/DiscreteGestureHandler.ts +82 -0
- package/src/web_hammer/DraggingGestureHandler.ts +34 -0
- package/src/web_hammer/Errors.ts +7 -0
- package/src/web_hammer/FlingGestureHandler.ts +134 -0
- package/src/web_hammer/GestureHandler.ts +599 -0
- package/src/web_hammer/IndiscreteGestureHandler.ts +33 -0
- package/src/web_hammer/LongPressGestureHandler.ts +56 -0
- package/src/web_hammer/NativeViewGestureHandler.ts +47 -0
- package/src/web_hammer/NodeManager.ts +42 -0
- package/src/web_hammer/PanGestureHandler.ts +226 -0
- package/src/web_hammer/PinchGestureHandler.ts +25 -0
- package/src/web_hammer/PressGestureHandler.ts +167 -0
- package/src/web_hammer/RotationGestureHandler.ts +25 -0
- package/src/web_hammer/TapGestureHandler.ts +172 -0
- package/src/web_hammer/constants.ts +48 -0
- package/src/web_hammer/utils.ts +24 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
package com.swmansion.gesturehandler.core
|
2
|
+
|
3
|
+
import android.view.MotionEvent
|
4
|
+
|
5
|
+
object GestureUtils {
|
6
|
+
fun getLastPointerX(event: MotionEvent, averageTouches: Boolean): Float {
|
7
|
+
val excludeIndex = if (event.actionMasked == MotionEvent.ACTION_POINTER_UP) event.actionIndex else -1
|
8
|
+
return if (averageTouches) {
|
9
|
+
var sum = 0f
|
10
|
+
var count = 0
|
11
|
+
for (i in 0 until event.pointerCount) {
|
12
|
+
if (i != excludeIndex) {
|
13
|
+
sum += event.getX(i)
|
14
|
+
count++
|
15
|
+
}
|
16
|
+
}
|
17
|
+
sum / count
|
18
|
+
} else {
|
19
|
+
var lastPointerIdx = event.pointerCount - 1
|
20
|
+
if (lastPointerIdx == excludeIndex) {
|
21
|
+
lastPointerIdx--
|
22
|
+
}
|
23
|
+
event.getX(lastPointerIdx)
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
fun getLastPointerY(event: MotionEvent, averageTouches: Boolean): Float {
|
28
|
+
val excludeIndex = if (event.actionMasked == MotionEvent.ACTION_POINTER_UP) event.actionIndex else -1
|
29
|
+
return if (averageTouches) {
|
30
|
+
var sum = 0f
|
31
|
+
var count = 0
|
32
|
+
for (i in 0 until event.pointerCount) {
|
33
|
+
if (i != excludeIndex) {
|
34
|
+
sum += event.getY(i)
|
35
|
+
count++
|
36
|
+
}
|
37
|
+
}
|
38
|
+
sum / count
|
39
|
+
} else {
|
40
|
+
var lastPointerIdx = event.pointerCount - 1
|
41
|
+
if (lastPointerIdx == excludeIndex) {
|
42
|
+
lastPointerIdx -= 1
|
43
|
+
}
|
44
|
+
event.getY(lastPointerIdx)
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
package com.swmansion.gesturehandler.core
|
2
|
+
|
3
|
+
import android.os.Handler
|
4
|
+
import android.os.Looper
|
5
|
+
import android.view.MotionEvent
|
6
|
+
import android.view.View
|
7
|
+
import android.view.ViewGroup
|
8
|
+
import com.swmansion.gesturehandler.react.RNViewConfigurationHelper
|
9
|
+
|
10
|
+
class HoverGestureHandler : GestureHandler<HoverGestureHandler>() {
|
11
|
+
private var handler: Handler? = null
|
12
|
+
private var finishRunnable = Runnable { finish() }
|
13
|
+
|
14
|
+
private infix fun isAncestorOf(other: GestureHandler<*>): Boolean {
|
15
|
+
var current: View? = other.view
|
16
|
+
|
17
|
+
while (current != null) {
|
18
|
+
if (current == this.view) {
|
19
|
+
return true
|
20
|
+
}
|
21
|
+
|
22
|
+
current = current.parent as? View
|
23
|
+
}
|
24
|
+
|
25
|
+
return false
|
26
|
+
}
|
27
|
+
|
28
|
+
private fun isViewDisplayedOverAnother(view: View, other: View, rootView: View = view.rootView): Boolean? {
|
29
|
+
// traverse the tree starting on the root view, to see which view will be drawn first
|
30
|
+
if (rootView == other) {
|
31
|
+
return true
|
32
|
+
}
|
33
|
+
|
34
|
+
if (rootView == view) {
|
35
|
+
return false
|
36
|
+
}
|
37
|
+
|
38
|
+
if (rootView is ViewGroup) {
|
39
|
+
for (i in 0 until rootView.childCount) {
|
40
|
+
val child = viewConfigHelper.getChildInDrawingOrderAtIndex(rootView, i)
|
41
|
+
return isViewDisplayedOverAnother(view, other, child) ?: continue
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
return null
|
46
|
+
}
|
47
|
+
|
48
|
+
override fun shouldBeCancelledBy(handler: GestureHandler<*>): Boolean {
|
49
|
+
if (handler is HoverGestureHandler && !(handler isAncestorOf this)) {
|
50
|
+
return isViewDisplayedOverAnother(handler.view!!, this.view!!)!!
|
51
|
+
}
|
52
|
+
|
53
|
+
return super.shouldBeCancelledBy(handler)
|
54
|
+
}
|
55
|
+
|
56
|
+
override fun shouldRequireToWaitForFailure(handler: GestureHandler<*>): Boolean {
|
57
|
+
if (handler is HoverGestureHandler) {
|
58
|
+
if (!(this isAncestorOf handler) && !(handler isAncestorOf this)) {
|
59
|
+
isViewDisplayedOverAnother(this.view!!, handler.view!!)?.let {
|
60
|
+
return it
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return super.shouldRequireToWaitForFailure(handler)
|
66
|
+
}
|
67
|
+
|
68
|
+
override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>): Boolean {
|
69
|
+
if (handler is HoverGestureHandler && (this isAncestorOf handler || handler isAncestorOf this)) {
|
70
|
+
return true
|
71
|
+
}
|
72
|
+
|
73
|
+
return super.shouldRecognizeSimultaneously(handler)
|
74
|
+
}
|
75
|
+
|
76
|
+
override fun onHandle(event: MotionEvent, sourceEvent: MotionEvent) {
|
77
|
+
if (event.action == MotionEvent.ACTION_DOWN) {
|
78
|
+
handler?.removeCallbacksAndMessages(null)
|
79
|
+
handler = null
|
80
|
+
} else if (event.action == MotionEvent.ACTION_UP) {
|
81
|
+
if (!isWithinBounds) {
|
82
|
+
finish()
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
override fun onHandleHover(event: MotionEvent, sourceEvent: MotionEvent) {
|
88
|
+
when {
|
89
|
+
event.action == MotionEvent.ACTION_HOVER_EXIT -> {
|
90
|
+
if (handler == null) {
|
91
|
+
handler = Handler(Looper.getMainLooper())
|
92
|
+
}
|
93
|
+
|
94
|
+
handler!!.postDelayed(finishRunnable, 4)
|
95
|
+
}
|
96
|
+
|
97
|
+
!isWithinBounds -> {
|
98
|
+
finish()
|
99
|
+
}
|
100
|
+
|
101
|
+
this.state == STATE_UNDETERMINED &&
|
102
|
+
(event.action == MotionEvent.ACTION_HOVER_MOVE || event.action == MotionEvent.ACTION_HOVER_ENTER) -> {
|
103
|
+
begin()
|
104
|
+
activate()
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
private fun finish() {
|
110
|
+
when (this.state) {
|
111
|
+
STATE_UNDETERMINED -> cancel()
|
112
|
+
STATE_BEGAN -> fail()
|
113
|
+
STATE_ACTIVE -> end()
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
companion object {
|
118
|
+
private val viewConfigHelper = RNViewConfigurationHelper()
|
119
|
+
}
|
120
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
package com.swmansion.gesturehandler.core
|
2
|
+
|
3
|
+
import android.content.Context
|
4
|
+
import android.os.Handler
|
5
|
+
import android.os.Looper
|
6
|
+
import android.os.SystemClock
|
7
|
+
import android.view.MotionEvent
|
8
|
+
|
9
|
+
class LongPressGestureHandler(context: Context) : GestureHandler<LongPressGestureHandler>() {
|
10
|
+
var minDurationMs = DEFAULT_MIN_DURATION_MS
|
11
|
+
val duration: Int
|
12
|
+
get() = (previousTime - startTime).toInt()
|
13
|
+
private val defaultMaxDistSq: Float
|
14
|
+
private var maxDistSq: Float
|
15
|
+
private var startX = 0f
|
16
|
+
private var startY = 0f
|
17
|
+
private var startTime: Long = 0
|
18
|
+
private var previousTime: Long = 0
|
19
|
+
private var handler: Handler? = null
|
20
|
+
|
21
|
+
init {
|
22
|
+
setShouldCancelWhenOutside(true)
|
23
|
+
|
24
|
+
val defaultMaxDist = DEFAULT_MAX_DIST_DP * context.resources.displayMetrics.density
|
25
|
+
defaultMaxDistSq = defaultMaxDist * defaultMaxDist
|
26
|
+
maxDistSq = defaultMaxDistSq
|
27
|
+
}
|
28
|
+
|
29
|
+
override fun resetConfig() {
|
30
|
+
super.resetConfig()
|
31
|
+
minDurationMs = DEFAULT_MIN_DURATION_MS
|
32
|
+
maxDistSq = defaultMaxDistSq
|
33
|
+
}
|
34
|
+
|
35
|
+
fun setMaxDist(maxDist: Float): LongPressGestureHandler {
|
36
|
+
maxDistSq = maxDist * maxDist
|
37
|
+
return this
|
38
|
+
}
|
39
|
+
|
40
|
+
override fun onHandle(event: MotionEvent, sourceEvent: MotionEvent) {
|
41
|
+
if (state == STATE_UNDETERMINED) {
|
42
|
+
previousTime = SystemClock.uptimeMillis()
|
43
|
+
startTime = previousTime
|
44
|
+
begin()
|
45
|
+
startX = sourceEvent.rawX
|
46
|
+
startY = sourceEvent.rawY
|
47
|
+
handler = Handler(Looper.getMainLooper())
|
48
|
+
if (minDurationMs > 0) {
|
49
|
+
handler!!.postDelayed({ activate() }, minDurationMs)
|
50
|
+
} else if (minDurationMs == 0L) {
|
51
|
+
activate()
|
52
|
+
}
|
53
|
+
}
|
54
|
+
if (sourceEvent.actionMasked == MotionEvent.ACTION_UP) {
|
55
|
+
handler?.let {
|
56
|
+
it.removeCallbacksAndMessages(null)
|
57
|
+
handler = null
|
58
|
+
}
|
59
|
+
if (state == STATE_ACTIVE) {
|
60
|
+
end()
|
61
|
+
} else {
|
62
|
+
fail()
|
63
|
+
}
|
64
|
+
} else {
|
65
|
+
// calculate distance from start
|
66
|
+
val deltaX = sourceEvent.rawX - startX
|
67
|
+
val deltaY = sourceEvent.rawY - startY
|
68
|
+
val distSq = deltaX * deltaX + deltaY * deltaY
|
69
|
+
if (distSq > maxDistSq) {
|
70
|
+
if (state == STATE_ACTIVE) {
|
71
|
+
cancel()
|
72
|
+
} else {
|
73
|
+
fail()
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
override fun onStateChange(newState: Int, previousState: Int) {
|
80
|
+
handler?.let {
|
81
|
+
it.removeCallbacksAndMessages(null)
|
82
|
+
handler = null
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
override fun dispatchStateChange(newState: Int, prevState: Int) {
|
87
|
+
previousTime = SystemClock.uptimeMillis()
|
88
|
+
super.dispatchStateChange(newState, prevState)
|
89
|
+
}
|
90
|
+
|
91
|
+
override fun dispatchHandlerUpdate(event: MotionEvent) {
|
92
|
+
previousTime = SystemClock.uptimeMillis()
|
93
|
+
super.dispatchHandlerUpdate(event)
|
94
|
+
}
|
95
|
+
|
96
|
+
companion object {
|
97
|
+
private const val DEFAULT_MIN_DURATION_MS: Long = 500
|
98
|
+
private const val DEFAULT_MAX_DIST_DP = 10f
|
99
|
+
}
|
100
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
package com.swmansion.gesturehandler.core
|
2
|
+
|
3
|
+
import android.view.MotionEvent
|
4
|
+
|
5
|
+
class ManualGestureHandler : GestureHandler<ManualGestureHandler>() {
|
6
|
+
override fun onHandle(event: MotionEvent, sourceEvent: MotionEvent) {
|
7
|
+
if (state == STATE_UNDETERMINED) {
|
8
|
+
begin()
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
@@ -0,0 +1,257 @@
|
|
1
|
+
package com.swmansion.gesturehandler.core
|
2
|
+
|
3
|
+
import android.os.SystemClock
|
4
|
+
import android.view.MotionEvent
|
5
|
+
import android.view.View
|
6
|
+
import android.view.ViewConfiguration
|
7
|
+
import android.view.ViewGroup
|
8
|
+
import android.widget.ScrollView
|
9
|
+
import com.facebook.react.views.scroll.ReactScrollView
|
10
|
+
import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
|
11
|
+
import com.facebook.react.views.textinput.ReactEditText
|
12
|
+
|
13
|
+
class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
14
|
+
private var shouldActivateOnStart = false
|
15
|
+
var disallowInterruption = false
|
16
|
+
private set
|
17
|
+
|
18
|
+
private var hook: NativeViewGestureHandlerHook = defaultHook
|
19
|
+
|
20
|
+
init {
|
21
|
+
setShouldCancelWhenOutside(true)
|
22
|
+
}
|
23
|
+
|
24
|
+
override fun resetConfig() {
|
25
|
+
super.resetConfig()
|
26
|
+
shouldActivateOnStart = false
|
27
|
+
disallowInterruption = false
|
28
|
+
}
|
29
|
+
|
30
|
+
fun setShouldActivateOnStart(shouldActivateOnStart: Boolean) = apply {
|
31
|
+
this.shouldActivateOnStart = shouldActivateOnStart
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Set this to `true` when wrapping native components that are supposed to be an exclusive
|
36
|
+
* target for a touch stream. Like for example switch or slider component which when activated
|
37
|
+
* aren't supposed to be cancelled by scrollview or other container that may also handle touches.
|
38
|
+
*/
|
39
|
+
fun setDisallowInterruption(disallowInterruption: Boolean) = apply {
|
40
|
+
this.disallowInterruption = disallowInterruption
|
41
|
+
}
|
42
|
+
|
43
|
+
override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>): Boolean {
|
44
|
+
// if the gesture is marked by user as simultaneous with other or the hook return true
|
45
|
+
if (super.shouldRecognizeSimultaneously(handler) || hook.shouldRecognizeSimultaneously(handler)) {
|
46
|
+
return true
|
47
|
+
}
|
48
|
+
|
49
|
+
if (handler is NativeViewGestureHandler) {
|
50
|
+
// Special case when the peer handler is also an instance of NativeViewGestureHandler:
|
51
|
+
// For the `disallowInterruption` to work correctly we need to check the property when
|
52
|
+
// accessed as a peer, because simultaneous recognizers can be set on either side of the
|
53
|
+
// connection.
|
54
|
+
if (handler.state == STATE_ACTIVE && handler.disallowInterruption) {
|
55
|
+
// other handler is active and it disallows interruption, we don't want to get into its way
|
56
|
+
return false
|
57
|
+
}
|
58
|
+
}
|
59
|
+
val canBeInterrupted = !disallowInterruption
|
60
|
+
val otherState = handler.state
|
61
|
+
return if (state == STATE_ACTIVE && otherState == STATE_ACTIVE && canBeInterrupted) {
|
62
|
+
// if both handlers are active and the current handler can be interrupted it we return `false`
|
63
|
+
// as it means the other handler has turned active and returning `true` would prevent it from
|
64
|
+
// interrupting the current handler
|
65
|
+
false
|
66
|
+
} else state == STATE_ACTIVE && canBeInterrupted && (!hook.shouldCancelRootViewGestureHandlerIfNecessary() || handler.tag > 0)
|
67
|
+
// otherwise we can only return `true` if already in an active state
|
68
|
+
}
|
69
|
+
|
70
|
+
override fun shouldBeCancelledBy(handler: GestureHandler<*>): Boolean {
|
71
|
+
return !disallowInterruption
|
72
|
+
}
|
73
|
+
|
74
|
+
override fun onPrepare() {
|
75
|
+
when (val view = view) {
|
76
|
+
is NativeViewGestureHandlerHook -> this.hook = view
|
77
|
+
is ReactEditText -> this.hook = EditTextHook(this, view)
|
78
|
+
is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
|
79
|
+
is ReactScrollView -> this.hook = ScrollViewHook()
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
override fun onHandle(event: MotionEvent, sourceEvent: MotionEvent) {
|
84
|
+
val view = view!!
|
85
|
+
if (event.actionMasked == MotionEvent.ACTION_UP) {
|
86
|
+
view.onTouchEvent(event)
|
87
|
+
if ((state == STATE_UNDETERMINED || state == STATE_BEGAN) && view.isPressed) {
|
88
|
+
activate()
|
89
|
+
}
|
90
|
+
end()
|
91
|
+
hook.afterGestureEnd(event)
|
92
|
+
} else if (state == STATE_UNDETERMINED || state == STATE_BEGAN) {
|
93
|
+
when {
|
94
|
+
shouldActivateOnStart -> {
|
95
|
+
tryIntercept(view, event)
|
96
|
+
view.onTouchEvent(event)
|
97
|
+
activate()
|
98
|
+
}
|
99
|
+
tryIntercept(view, event) -> {
|
100
|
+
view.onTouchEvent(event)
|
101
|
+
activate()
|
102
|
+
}
|
103
|
+
hook.wantsToHandleEventBeforeActivation() -> {
|
104
|
+
hook.handleEventBeforeActivation(event)
|
105
|
+
}
|
106
|
+
state != STATE_BEGAN -> {
|
107
|
+
if (hook.canBegin()) {
|
108
|
+
begin()
|
109
|
+
} else {
|
110
|
+
cancel()
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
} else if (state == STATE_ACTIVE) {
|
115
|
+
view.onTouchEvent(event)
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
override fun onCancel() {
|
120
|
+
val time = SystemClock.uptimeMillis()
|
121
|
+
val event = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0f, 0f, 0).apply {
|
122
|
+
action = MotionEvent.ACTION_CANCEL
|
123
|
+
}
|
124
|
+
view!!.onTouchEvent(event)
|
125
|
+
event.recycle()
|
126
|
+
}
|
127
|
+
|
128
|
+
override fun onReset() {
|
129
|
+
this.hook = defaultHook
|
130
|
+
}
|
131
|
+
|
132
|
+
companion object {
|
133
|
+
private fun tryIntercept(view: View, event: MotionEvent) =
|
134
|
+
view is ViewGroup && view.onInterceptTouchEvent(event)
|
135
|
+
|
136
|
+
private val defaultHook = object : NativeViewGestureHandlerHook {}
|
137
|
+
}
|
138
|
+
|
139
|
+
interface NativeViewGestureHandlerHook {
|
140
|
+
/**
|
141
|
+
* Called when gesture is in the UNDETERMINED state, shouldActivateOnStart is set to false,
|
142
|
+
* and both tryIntercept and wantsToHandleEventBeforeActivation returned false.
|
143
|
+
*
|
144
|
+
* @return Boolean value signalling whether the handler can transition to the BEGAN state. If false
|
145
|
+
* the gesture will be cancelled.
|
146
|
+
*/
|
147
|
+
fun canBegin() = true
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Called after the gesture transitions to the END state.
|
151
|
+
*/
|
152
|
+
fun afterGestureEnd(event: MotionEvent) = Unit
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @return Boolean value signalling whether the gesture can be recognized simultaneously with
|
156
|
+
* other (handler). Returning false doesn't necessarily prevent it from happening.
|
157
|
+
*/
|
158
|
+
fun shouldRecognizeSimultaneously(handler: GestureHandler<*>) = false
|
159
|
+
|
160
|
+
/**
|
161
|
+
* shouldActivateOnStart and tryIntercept have priority over this method
|
162
|
+
*
|
163
|
+
* @return Boolean value signalling if the hook wants to handle events passed to the handler
|
164
|
+
* before it activates (after that the events are passed to the underlying view).
|
165
|
+
*/
|
166
|
+
fun wantsToHandleEventBeforeActivation() = false
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Will be called with events if wantsToHandleEventBeforeActivation returns true.
|
170
|
+
*/
|
171
|
+
fun handleEventBeforeActivation(event: MotionEvent) = Unit
|
172
|
+
|
173
|
+
/**
|
174
|
+
* @return Boolean value indicating whether the RootViewGestureHandler should be cancelled
|
175
|
+
* by this one.
|
176
|
+
*/
|
177
|
+
fun shouldCancelRootViewGestureHandlerIfNecessary() = false
|
178
|
+
}
|
179
|
+
|
180
|
+
private class EditTextHook(
|
181
|
+
private val handler: NativeViewGestureHandler,
|
182
|
+
private val editText: ReactEditText
|
183
|
+
) : NativeViewGestureHandlerHook {
|
184
|
+
private var startX = 0f
|
185
|
+
private var startY = 0f
|
186
|
+
private var touchSlopSquared: Int
|
187
|
+
|
188
|
+
init {
|
189
|
+
val vc = ViewConfiguration.get(editText.context)
|
190
|
+
touchSlopSquared = vc.scaledTouchSlop * vc.scaledTouchSlop
|
191
|
+
}
|
192
|
+
|
193
|
+
override fun afterGestureEnd(event: MotionEvent) {
|
194
|
+
if ((event.x - startX) * (event.x - startX) + (event.y - startY) * (event.y - startY) < touchSlopSquared) {
|
195
|
+
editText.requestFocusFromJS()
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
// recognize alongside every handler besides RootViewGestureHandler, which is a private inner class
|
200
|
+
// of RNGestureHandlerRootHelper so no explicit type checks, but its tag is always negative
|
201
|
+
// also if other handler is NativeViewGestureHandler then don't override the default implementation
|
202
|
+
override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>) =
|
203
|
+
handler.tag > 0 && handler !is NativeViewGestureHandler
|
204
|
+
|
205
|
+
override fun wantsToHandleEventBeforeActivation() = true
|
206
|
+
|
207
|
+
override fun handleEventBeforeActivation(event: MotionEvent) {
|
208
|
+
handler.activate()
|
209
|
+
editText.onTouchEvent(event)
|
210
|
+
|
211
|
+
startX = event.x
|
212
|
+
startY = event.y
|
213
|
+
}
|
214
|
+
|
215
|
+
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
|
216
|
+
}
|
217
|
+
|
218
|
+
private class SwipeRefreshLayoutHook(
|
219
|
+
private val handler: NativeViewGestureHandler,
|
220
|
+
private val swipeRefreshLayout: ReactSwipeRefreshLayout
|
221
|
+
) : NativeViewGestureHandlerHook {
|
222
|
+
override fun wantsToHandleEventBeforeActivation() = true
|
223
|
+
|
224
|
+
override fun handleEventBeforeActivation(event: MotionEvent) {
|
225
|
+
// RefreshControl from GH is set up in a way that ScrollView wrapped with it should wait for
|
226
|
+
// it to fail. This way the RefreshControl is not canceled by the scroll handler.
|
227
|
+
// The problem with this approach is that the RefreshControl handler stays active all the time
|
228
|
+
// preventing scroll from activating.
|
229
|
+
// This is a workaround to prevent it from happening.
|
230
|
+
|
231
|
+
// First get the ScrollView under the RefreshControl, if there is none, return.
|
232
|
+
val scroll = swipeRefreshLayout.getChildAt(0) as? ScrollView ?: return
|
233
|
+
|
234
|
+
// Then find the first NativeViewGestureHandler attached to it
|
235
|
+
val scrollHandler = handler.orchestrator
|
236
|
+
?.getHandlersForView(scroll)
|
237
|
+
?.first {
|
238
|
+
it is NativeViewGestureHandler
|
239
|
+
}
|
240
|
+
|
241
|
+
// If handler was found, it's active and the ScrollView is not at the top, fail the RefreshControl
|
242
|
+
if (scrollHandler != null && scrollHandler.state == STATE_ACTIVE && scroll.scrollY > 0) {
|
243
|
+
handler.fail()
|
244
|
+
}
|
245
|
+
|
246
|
+
// The drawback is that the smooth transition from scrolling to refreshing in a single swipe
|
247
|
+
// is impossible this way and two swipes are required:
|
248
|
+
// - one to go back to top
|
249
|
+
// - one to actually refresh
|
250
|
+
// oh well ¯\_(ツ)_/¯
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
private class ScrollViewHook : NativeViewGestureHandlerHook {
|
255
|
+
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
|
256
|
+
}
|
257
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
package com.swmansion.gesturehandler.core
|
2
|
+
|
3
|
+
import android.view.MotionEvent
|
4
|
+
|
5
|
+
interface OnTouchEventListener {
|
6
|
+
fun <T : GestureHandler<T>> onHandlerUpdate(handler: T, event: MotionEvent)
|
7
|
+
fun <T : GestureHandler<T>> onStateChange(handler: T, newState: Int, oldState: Int)
|
8
|
+
fun <T : GestureHandler<T>> onTouchEvent(handler: T)
|
9
|
+
}
|