@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 @@
|
|
1
|
+
{"version":3,"sources":["GestureDetector.tsx"],"names":["React","useContext","useEffect","useRef","useState","BaseGesture","CALLBACK_TYPE","Reanimated","registerHandler","unregisterHandler","RNGestureHandlerModule","baseGestureHandlerWithMonitorProps","filterConfig","findNodeHandle","scheduleFlushOperations","GestureStateManager","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","hoverGestureHandlerProps","State","TouchEventType","ActionType","isFabric","isJestEnv","tagMessage","getReactNativeVersion","getShadowNodeFromRef","Platform","onGestureHandlerEvent","RNRenderer","isNewWebImplementationEnabled","nativeViewGestureHandlerProps","GestureHandlerRootViewContext","ghQueueMicrotask","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","dropHandlers","preparedGesture","handler","config","dropGestureHandler","testId","checkGestureCallbacksForWorklets","gesture","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","attachHandlers","gestureConfig","viewTag","webEventHandlersRef","mountedRef","firstExecution","initialize","prepare","createGestureHandler","handlerName","requireToFail","simultaneousWith","blocksHandlers","updateGestureHandler","simultaneousHandlers","waitFor","actionType","shouldUseReanimated","REANIMATED_WORKLET","JS_FUNCTION_NEW_API","OS","attachGestureHandler","JS_FUNCTION_OLD_API","animatedHandlers","isAnimatedGesture","g","value","updateHandlers","i","length","previousHandlersValue","newHandlersValue","shouldUpdateSharedValue","gestureId","needsToReattach","isStateChangeEvent","event","oldState","isTouchEvent","eventType","getHandler","type","BEGAN","onBegin","START","onStart","UPDATE","onUpdate","CHANGE","onChange","END","onEnd","FINALIZE","onFinalize","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","touchEventTypeToCallbackType","UNDEFINED","runWorklet","args","warn","useAnimatedGesture","needsRebuild","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","validateDetectorChildren","__DEV__","REACT_NATIVE_VERSION","wrapType","minor","major","_reactInternals","elementType","_reactInternalFiber","instance","findHostInstance_DEPRECATED","_internalFiberInstanceHandleDEV","sibling","Error","return","applyUserSelectProp","userSelect","toGestureArray","GestureDetector","props","rootViewContext","useReanimatedHook","some","firstRender","viewRef","previousViewTag","forceReattach","e","nativeEvent","onGestureHandlerStateChange","renderState","setRenderState","forceRender","onHandlersUpdate","skipConfigUpdate","needsToRebuildReanimatedEvent","refFunction","node","global","isFormsStackingContext","children","Wrap","Component","render","child","Children","only","cloneElement","collapsable","AnimatedWrap","default","createAnimatedComponent"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,MAAvC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAGEC,WAHF,EAKEC,aALF,QAMO,WANP;AAOA,SAASC,UAAT,QAAwC,qBAAxC;AACA,SAASC,eAAT,EAA0BC,iBAA1B,QAAmD,qBAAnD;AACA,OAAOC,sBAAP,MAAmC,8BAAnC;AACA,SACEC,kCADF,EAEEC,YAFF,EAGEC,cAHF,EAQEC,uBARF,QAUO,yBAVP;AAWA,SACEC,mBADF,QAGO,uBAHP;AAIA,SAASC,wBAAT,QAAyC,wBAAzC;AACA,SAASC,6BAAT,QAA8C,6BAA9C;AACA,SAASC,4BAAT,QAA6C,4BAA7C;AACA,SACEC,sBADF,EAEEC,kCAFF,QAGO,sBAHP;AAIA,SAASC,sBAAT,QAAuC,sBAAvC;AACA,SAASC,wBAAT,QAAyC,gBAAzC;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,cAAT,QAA+B,sBAA/B;AAEA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SA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QAA/B,CAAP;AACD;AACF,CA5KM;;AA8KP,MAAMC,IAAN,SAAmB9L,KAAK,CAAC+L,SAAzB,CAIG;AACDC,EAAAA,MAAM,GAAG;AACP,QAAI;AACF;AACA;AACA;AACA;AACA;AACA,YAAMC,KAAU,GAAGjM,KAAK,CAACkM,QAAN,CAAeC,IAAf,CAAoB,KAAK3B,KAAL,CAAWqB,QAA/B,CAAnB;AACA,0BAAO7L,KAAK,CAACoM,YAAN,CACLH,KADK,EAEL;AAAEI,QAAAA,WAAW,EAAE;AAAf,OAFK,EAGL;AACAJ,MAAAA,KAAK,CAACzB,KAAN,CAAYqB,QAJP,CAAP;AAMD,KAbD,CAaE,OAAOb,CAAP,EAAU;AACV,YAAM,IAAId,KAAJ,CACJtI,UAAU,CACP,2KADO,CADN,CAAN;AAKD;AACF;;AAtBA;;AAyBH,MAAM0K,YAAY,4BAAG/L,UAAH,aAAGA,UAAH,8CAAGA,UAAU,CAAEgM,OAAf,wDAAG,oBAAqBC,uBAArB,CAA6CV,IAA7C,CAAH,yEAAyDA,IAA3E","sourcesContent":["import React, { useContext, useEffect, useRef, useState } from 'react';\r\nimport {\r\n GestureType,\r\n HandlerCallbacks,\r\n BaseGesture,\r\n GestureRef,\r\n CALLBACK_TYPE,\r\n} from './gesture';\r\nimport { Reanimated, SharedValue } from './reanimatedWrapper';\r\nimport { registerHandler, unregisterHandler } from '../handlersRegistry';\r\nimport RNGestureHandlerModule from '../../RNGestureHandlerModule';\r\nimport {\r\n baseGestureHandlerWithMonitorProps,\r\n filterConfig,\r\n findNodeHandle,\r\n GestureTouchEvent,\r\n GestureUpdateEvent,\r\n GestureStateChangeEvent,\r\n HandlerStateChangeEvent,\r\n scheduleFlushOperations,\r\n UserSelect,\r\n} from '../gestureHandlerCommon';\r\nimport {\r\n GestureStateManager,\r\n GestureStateManagerType,\r\n} from './gestureStateManager';\r\nimport { flingGestureHandlerProps } from '../FlingGestureHandler';\r\nimport { forceTouchGestureHandlerProps } from '../ForceTouchGestureHandler';\r\nimport { longPressGestureHandlerProps } from '../LongPressGestureHandler';\r\nimport {\r\n panGestureHandlerProps,\r\n panGestureHandlerCustomNativeProps,\r\n} from '../PanGestureHandler';\r\nimport { tapGestureHandlerProps } from '../TapGestureHandler';\r\nimport { hoverGestureHandlerProps } from './hoverGesture';\r\nimport { State } from '../../State';\r\nimport { TouchEventType } from '../../TouchEventType';\r\nimport { ComposedGesture } from './gestureComposition';\r\nimport { ActionType } from '../../ActionType';\r\nimport { isFabric, isJestEnv, tagMessage } from '../../utils';\r\nimport { getReactNativeVersion } from '../../getReactNativeVersion';\r\nimport { getShadowNodeFromRef } from '../../getShadowNodeFromRef';\r\nimport { Platform } from 'react-native';\r\nimport type RNGestureHandlerModuleWeb from '../../RNGestureHandlerModule.web';\r\nimport { onGestureHandlerEvent } from './eventReceiver';\r\nimport { RNRenderer } from '../../RNRenderer';\r\nimport { isNewWebImplementationEnabled } from '../../EnableNewWebImplementation';\r\nimport { nativeViewGestureHandlerProps } from '../NativeViewGestureHandler';\r\nimport GestureHandlerRootViewContext from '../../GestureHandlerRootViewContext';\r\nimport { ghQueueMicrotask } from '../../ghQueueMicrotask';\r\n\r\ndeclare const global: {\r\n isFormsStackingContext: (node: unknown) => boolean | null; // JSI function\r\n};\r\n\r\nconst ALLOWED_PROPS = [\r\n ...baseGestureHandlerWithMonitorProps,\r\n ...tapGestureHandlerProps,\r\n ...panGestureHandlerProps,\r\n ...panGestureHandlerCustomNativeProps,\r\n ...longPressGestureHandlerProps,\r\n ...forceTouchGestureHandlerProps,\r\n ...flingGestureHandlerProps,\r\n ...hoverGestureHandlerProps,\r\n ...nativeViewGestureHandlerProps,\r\n];\r\n\r\nexport type GestureConfigReference = {\r\n config: GestureType[];\r\n animatedEventHandler: unknown;\r\n animatedHandlers: SharedValue<\r\n HandlerCallbacks<Record<string, unknown>>[] | null\r\n > | null;\r\n firstExecution: boolean;\r\n useReanimatedHook: boolean;\r\n};\r\n\r\nfunction convertToHandlerTag(ref: GestureRef): number {\r\n if (typeof ref === 'number') {\r\n return ref;\r\n } else if (ref instanceof BaseGesture) {\r\n return ref.handlerTag;\r\n } else {\r\n // @ts-ignore in this case it should be a ref either to gesture object or\r\n // a gesture handler component, in both cases handlerTag property exists\r\n return ref.current?.handlerTag ?? -1;\r\n }\r\n}\r\n\r\nfunction extractValidHandlerTags(interactionGroup: GestureRef[] | undefined) {\r\n return (\r\n interactionGroup?.map(convertToHandlerTag)?.filter((tag) => tag > 0) ?? []\r\n );\r\n}\r\n\r\nfunction dropHandlers(preparedGesture: GestureConfigReference) {\r\n for (const handler of preparedGesture.config) {\r\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\r\n\r\n unregisterHandler(handler.handlerTag, handler.config.testId);\r\n }\r\n\r\n scheduleFlushOperations();\r\n}\r\n\r\nfunction checkGestureCallbacksForWorklets(gesture: GestureType) {\r\n // if a gesture is explicitly marked to run on the JS thread there is no need to check\r\n // if callbacks are worklets as the user is aware they will be ran on the JS thread\r\n if (gesture.config.runOnJS) {\r\n return;\r\n }\r\n\r\n const areSomeNotWorklets = gesture.handlers.isWorklet.includes(false);\r\n const areSomeWorklets = gesture.handlers.isWorklet.includes(true);\r\n\r\n // if some of the callbacks are worklets and some are not, and the gesture is not\r\n // explicitly marked with `.runOnJS(true)` show an error\r\n if (areSomeNotWorklets && areSomeWorklets) {\r\n console.error(\r\n tagMessage(\r\n `Some of the callbacks in the gesture are worklets and some are not. Either make sure that all calbacks are marked as 'worklet' if you wish to run them on the UI thread or use '.runOnJS(true)' modifier on the gesture explicitly to run all callbacks on the JS thread.`\r\n )\r\n );\r\n }\r\n}\r\n\r\ninterface WebEventHandler {\r\n onGestureHandlerEvent: (event: HandlerStateChangeEvent<unknown>) => void;\r\n onGestureHandlerStateChange?: (\r\n event: HandlerStateChangeEvent<unknown>\r\n ) => void;\r\n}\r\n\r\ninterface AttachHandlersConfig {\r\n preparedGesture: GestureConfigReference;\r\n gestureConfig: ComposedGesture | GestureType;\r\n gesture: GestureType[];\r\n viewTag: number;\r\n webEventHandlersRef: React.RefObject<WebEventHandler>;\r\n mountedRef: React.RefObject<boolean>;\r\n}\r\n\r\nfunction attachHandlers({\r\n preparedGesture,\r\n gestureConfig,\r\n gesture,\r\n viewTag,\r\n webEventHandlersRef,\r\n mountedRef,\r\n}: AttachHandlersConfig) {\r\n if (!preparedGesture.firstExecution) {\r\n gestureConfig.initialize();\r\n } else {\r\n preparedGesture.firstExecution = false;\r\n }\r\n\r\n // use queueMicrotask to extract handlerTags, because all refs should be initialized\r\n // when it's ran\r\n ghQueueMicrotask(() => {\r\n if (!mountedRef.current) {\r\n return;\r\n }\r\n gestureConfig.prepare();\r\n });\r\n\r\n for (const handler of gesture) {\r\n checkGestureCallbacksForWorklets(handler);\r\n RNGestureHandlerModule.createGestureHandler(\r\n handler.handlerName,\r\n handler.handlerTag,\r\n filterConfig(handler.config, ALLOWED_PROPS)\r\n );\r\n\r\n registerHandler(handler.handlerTag, handler, handler.config.testId);\r\n }\r\n\r\n // use queueMicrotask to extract handlerTags, because all refs should be initialized\r\n // when it's ran\r\n ghQueueMicrotask(() => {\r\n if (!mountedRef.current) {\r\n return;\r\n }\r\n for (const handler of gesture) {\r\n let requireToFail: number[] = [];\r\n if (handler.config.requireToFail) {\r\n requireToFail = extractValidHandlerTags(handler.config.requireToFail);\r\n }\r\n\r\n let simultaneousWith: number[] = [];\r\n if (handler.config.simultaneousWith) {\r\n simultaneousWith = extractValidHandlerTags(\r\n handler.config.simultaneousWith\r\n );\r\n }\r\n\r\n let blocksHandlers: number[] = [];\r\n if (handler.config.blocksHandlers) {\r\n blocksHandlers = extractValidHandlerTags(handler.config.blocksHandlers);\r\n }\r\n\r\n RNGestureHandlerModule.updateGestureHandler(\r\n handler.handlerTag,\r\n filterConfig(handler.config, ALLOWED_PROPS, {\r\n simultaneousHandlers: simultaneousWith,\r\n waitFor: requireToFail,\r\n blocksHandlers: blocksHandlers,\r\n })\r\n );\r\n }\r\n\r\n scheduleFlushOperations();\r\n });\r\n\r\n preparedGesture.config = gesture;\r\n\r\n for (const gesture of preparedGesture.config) {\r\n const actionType = gesture.shouldUseReanimated\r\n ? ActionType.REANIMATED_WORKLET\r\n : ActionType.JS_FUNCTION_NEW_API;\r\n\r\n if (Platform.OS === 'web') {\r\n (\r\n RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler\r\n )(\r\n gesture.handlerTag,\r\n viewTag,\r\n ActionType.JS_FUNCTION_OLD_API, // ignored on web\r\n webEventHandlersRef\r\n );\r\n } else {\r\n RNGestureHandlerModule.attachGestureHandler(\r\n gesture.handlerTag,\r\n viewTag,\r\n actionType\r\n );\r\n }\r\n }\r\n\r\n if (preparedGesture.animatedHandlers) {\r\n const isAnimatedGesture = (g: GestureType) => g.shouldUseReanimated;\r\n\r\n preparedGesture.animatedHandlers.value = gesture\r\n .filter(isAnimatedGesture)\r\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\r\n Record<string, unknown>\r\n >[];\r\n }\r\n}\r\n\r\nfunction updateHandlers(\r\n preparedGesture: GestureConfigReference,\r\n gestureConfig: ComposedGesture | GestureType,\r\n gesture: GestureType[],\r\n mountedRef: React.RefObject<boolean>\r\n) {\r\n gestureConfig.prepare();\r\n\r\n for (let i = 0; i < gesture.length; i++) {\r\n const handler = preparedGesture.config[i];\r\n checkGestureCallbacksForWorklets(handler);\r\n\r\n // only update handlerTag when it's actually different, it may be the same\r\n // if gesture config object is wrapped with useMemo\r\n if (gesture[i].handlerTag !== handler.handlerTag) {\r\n gesture[i].handlerTag = handler.handlerTag;\r\n gesture[i].handlers.handlerTag = handler.handlerTag;\r\n }\r\n }\r\n\r\n // use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated\r\n // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait\r\n // in case of external relations)\r\n ghQueueMicrotask(() => {\r\n if (!mountedRef.current) {\r\n return;\r\n }\r\n for (let i = 0; i < gesture.length; i++) {\r\n const handler = preparedGesture.config[i];\r\n\r\n handler.config = gesture[i].config;\r\n handler.handlers = gesture[i].handlers;\r\n\r\n const requireToFail = extractValidHandlerTags(\r\n handler.config.requireToFail\r\n );\r\n\r\n const simultaneousWith = extractValidHandlerTags(\r\n handler.config.simultaneousWith\r\n );\r\n\r\n RNGestureHandlerModule.updateGestureHandler(\r\n handler.handlerTag,\r\n filterConfig(handler.config, ALLOWED_PROPS, {\r\n simultaneousHandlers: simultaneousWith,\r\n waitFor: requireToFail,\r\n })\r\n );\r\n\r\n registerHandler(handler.handlerTag, handler, handler.config.testId);\r\n }\r\n\r\n if (preparedGesture.animatedHandlers) {\r\n const previousHandlersValue =\r\n preparedGesture.animatedHandlers.value ?? [];\r\n const newHandlersValue = preparedGesture.config\r\n .filter((g) => g.shouldUseReanimated) // ignore gestures that shouldn't run on UI\r\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\r\n Record<string, unknown>\r\n >[];\r\n\r\n // if amount of gesture configs changes, we need to update the callbacks in shared value\r\n let shouldUpdateSharedValue =\r\n previousHandlersValue.length !== newHandlersValue.length;\r\n\r\n if (!shouldUpdateSharedValue) {\r\n // if the amount is the same, we need to check if any of the configs inside has changed\r\n for (let i = 0; i < newHandlersValue.length; i++) {\r\n if (\r\n // we can use the `gestureId` prop as it's unique for every config instance\r\n newHandlersValue[i].gestureId !== previousHandlersValue[i].gestureId\r\n ) {\r\n shouldUpdateSharedValue = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (shouldUpdateSharedValue) {\r\n preparedGesture.animatedHandlers.value = newHandlersValue;\r\n }\r\n }\r\n\r\n scheduleFlushOperations();\r\n });\r\n}\r\n\r\nfunction needsToReattach(\r\n preparedGesture: GestureConfigReference,\r\n gesture: GestureType[]\r\n) {\r\n if (gesture.length !== preparedGesture.config.length) {\r\n return true;\r\n }\r\n for (let i = 0; i < gesture.length; i++) {\r\n if (\r\n gesture[i].handlerName !== preparedGesture.config[i].handlerName ||\r\n gesture[i].shouldUseReanimated !==\r\n preparedGesture.config[i].shouldUseReanimated\r\n ) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction isStateChangeEvent(\r\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\r\n): event is GestureStateChangeEvent {\r\n 'worklet';\r\n // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point\r\n return event.oldState != null;\r\n}\r\n\r\nfunction isTouchEvent(\r\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\r\n): event is GestureTouchEvent {\r\n 'worklet';\r\n return event.eventType != null;\r\n}\r\n\r\nfunction getHandler(\r\n type: CALLBACK_TYPE,\r\n gesture: HandlerCallbacks<Record<string, unknown>>\r\n) {\r\n 'worklet';\r\n switch (type) {\r\n case CALLBACK_TYPE.BEGAN:\r\n return gesture.onBegin;\r\n case CALLBACK_TYPE.START:\r\n return gesture.onStart;\r\n case CALLBACK_TYPE.UPDATE:\r\n return gesture.onUpdate;\r\n case CALLBACK_TYPE.CHANGE:\r\n return gesture.onChange;\r\n case CALLBACK_TYPE.END:\r\n return gesture.onEnd;\r\n case CALLBACK_TYPE.FINALIZE:\r\n return gesture.onFinalize;\r\n case CALLBACK_TYPE.TOUCHES_DOWN:\r\n return gesture.onTouchesDown;\r\n case CALLBACK_TYPE.TOUCHES_MOVE:\r\n return gesture.onTouchesMove;\r\n case CALLBACK_TYPE.TOUCHES_UP:\r\n return gesture.onTouchesUp;\r\n case CALLBACK_TYPE.TOUCHES_CANCELLED:\r\n return gesture.onTouchesCancelled;\r\n }\r\n}\r\n\r\nfunction touchEventTypeToCallbackType(\r\n eventType: TouchEventType\r\n): CALLBACK_TYPE {\r\n 'worklet';\r\n switch (eventType) {\r\n case TouchEventType.TOUCHES_DOWN:\r\n return CALLBACK_TYPE.TOUCHES_DOWN;\r\n case TouchEventType.TOUCHES_MOVE:\r\n return CALLBACK_TYPE.TOUCHES_MOVE;\r\n case TouchEventType.TOUCHES_UP:\r\n return CALLBACK_TYPE.TOUCHES_UP;\r\n case TouchEventType.TOUCHES_CANCELLED:\r\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\r\n }\r\n return CALLBACK_TYPE.UNDEFINED;\r\n}\r\n\r\nfunction runWorklet(\r\n type: CALLBACK_TYPE,\r\n gesture: HandlerCallbacks<Record<string, unknown>>,\r\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent,\r\n ...args: any[]\r\n) {\r\n 'worklet';\r\n const handler = getHandler(type, gesture);\r\n if (gesture.isWorklet[type]) {\r\n // @ts-ignore Logic below makes sure the correct event is send to the\r\n // correct handler.\r\n handler?.(event, ...args);\r\n } else if (handler) {\r\n console.warn(tagMessage('Animated gesture callback must be a worklet'));\r\n }\r\n}\r\n\r\nfunction useAnimatedGesture(\r\n preparedGesture: GestureConfigReference,\r\n needsRebuild: boolean\r\n) {\r\n if (!Reanimated) {\r\n return;\r\n }\r\n\r\n // Hooks are called conditionally, but the condition is whether the\r\n // react-native-reanimated is installed, which shouldn't change while running\r\n // eslint-disable-next-line react-hooks/rules-of-hooks\r\n const sharedHandlersCallbacks = Reanimated.useSharedValue<\r\n HandlerCallbacks<Record<string, unknown>>[] | null\r\n >(null);\r\n\r\n // eslint-disable-next-line react-hooks/rules-of-hooks\r\n const lastUpdateEvent = Reanimated.useSharedValue<\r\n (GestureUpdateEvent | undefined)[]\r\n >([]);\r\n\r\n // not every gesture needs a state controller, init them lazily\r\n const stateControllers: GestureStateManagerType[] = [];\r\n\r\n const callback = (\r\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent\r\n ) => {\r\n 'worklet';\r\n\r\n const currentCallback = sharedHandlersCallbacks.value;\r\n if (!currentCallback) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < currentCallback.length; i++) {\r\n const gesture = currentCallback[i];\r\n\r\n if (event.handlerTag === gesture.handlerTag) {\r\n if (isStateChangeEvent(event)) {\r\n if (\r\n event.oldState === State.UNDETERMINED &&\r\n event.state === State.BEGAN\r\n ) {\r\n runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);\r\n } else if (\r\n (event.oldState === State.BEGAN ||\r\n event.oldState === State.UNDETERMINED) &&\r\n event.state === State.ACTIVE\r\n ) {\r\n runWorklet(CALLBACK_TYPE.START, gesture, event);\r\n lastUpdateEvent.value[gesture.handlerTag] = undefined;\r\n } else if (\r\n event.oldState !== event.state &&\r\n event.state === State.END\r\n ) {\r\n if (event.oldState === State.ACTIVE) {\r\n runWorklet(CALLBACK_TYPE.END, gesture, event, true);\r\n }\r\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);\r\n } else if (\r\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\r\n event.state !== event.oldState\r\n ) {\r\n if (event.oldState === State.ACTIVE) {\r\n runWorklet(CALLBACK_TYPE.END, gesture, event, false);\r\n }\r\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);\r\n }\r\n } else if (isTouchEvent(event)) {\r\n if (!stateControllers[i]) {\r\n stateControllers[i] = GestureStateManager.create(event.handlerTag);\r\n }\r\n\r\n if (event.eventType !== TouchEventType.UNDETERMINED) {\r\n runWorklet(\r\n touchEventTypeToCallbackType(event.eventType),\r\n gesture,\r\n event,\r\n stateControllers[i]\r\n );\r\n }\r\n } else {\r\n runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);\r\n\r\n if (gesture.onChange && gesture.changeEventCalculator) {\r\n runWorklet(\r\n CALLBACK_TYPE.CHANGE,\r\n gesture,\r\n gesture.changeEventCalculator?.(\r\n event,\r\n lastUpdateEvent.value[gesture.handlerTag]\r\n )\r\n );\r\n\r\n lastUpdateEvent.value[gesture.handlerTag] = event;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n // eslint-disable-next-line react-hooks/rules-of-hooks\r\n const event = Reanimated.useEvent(\r\n callback,\r\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\r\n needsRebuild\r\n );\r\n\r\n preparedGesture.animatedEventHandler = event;\r\n preparedGesture.animatedHandlers = sharedHandlersCallbacks;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nfunction validateDetectorChildren(ref: any) {\r\n // finds the first native view under the Wrap component and traverses the fiber tree upwards\r\n // to check whether there is more than one native view as a pseudo-direct child of GestureDetector\r\n // i.e. this is not ok:\r\n // Wrap\r\n // |\r\n // / \\\r\n // / \\\r\n // / \\\r\n // / \\\r\n // NativeView NativeView\r\n //\r\n // but this is fine:\r\n // Wrap\r\n // |\r\n // NativeView\r\n // |\r\n // / \\\r\n // / \\\r\n // / \\\r\n // / \\\r\n // NativeView NativeView\r\n if (__DEV__ && Platform.OS !== 'web') {\r\n const REACT_NATIVE_VERSION = getReactNativeVersion();\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n const wrapType =\r\n REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0\r\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n ref._reactInternals.elementType\r\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n ref._reactInternalFiber.elementType;\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n let instance =\r\n RNRenderer.findHostInstance_DEPRECATED(\r\n ref\r\n )._internalFiberInstanceHandleDEV;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n while (instance && instance.elementType !== wrapType) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n if (instance.sibling) {\r\n throw new Error(\r\n 'GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.'\r\n );\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\r\n instance = instance.return;\r\n }\r\n }\r\n}\r\n\r\nconst applyUserSelectProp = (\r\n userSelect: UserSelect,\r\n gesture: ComposedGesture | GestureType\r\n): void => {\r\n for (const g of gesture.toGestureArray()) {\r\n g.config.userSelect = userSelect;\r\n }\r\n};\r\n\r\ninterface GestureDetectorProps {\r\n gesture: ComposedGesture | GestureType;\r\n userSelect?: UserSelect;\r\n children?: React.ReactNode;\r\n}\r\ninterface GestureDetectorState {\r\n firstRender: boolean;\r\n viewRef: React.Component | null;\r\n previousViewTag: number;\r\n forceReattach: boolean;\r\n}\r\nexport const GestureDetector = (props: GestureDetectorProps) => {\r\n const rootViewContext = useContext(GestureHandlerRootViewContext);\r\n if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {\r\n throw new Error(\r\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\r\n );\r\n }\r\n\r\n const gestureConfig = props.gesture;\r\n\r\n if (props.userSelect) {\r\n applyUserSelectProp(props.userSelect, gestureConfig);\r\n }\r\n\r\n const gesture = gestureConfig.toGestureArray();\r\n const useReanimatedHook = gesture.some((g) => g.shouldUseReanimated);\r\n\r\n // store state in ref to prevent unnecessary renders\r\n const state = useRef<GestureDetectorState>({\r\n firstRender: true,\r\n viewRef: null,\r\n previousViewTag: -1,\r\n forceReattach: false,\r\n }).current;\r\n const mountedRef = useRef(false);\r\n const webEventHandlersRef = useRef<WebEventHandler>({\r\n onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {\r\n onGestureHandlerEvent(e.nativeEvent);\r\n },\r\n onGestureHandlerStateChange: isNewWebImplementationEnabled()\r\n ? (e: HandlerStateChangeEvent<unknown>) => {\r\n onGestureHandlerEvent(e.nativeEvent);\r\n }\r\n : undefined,\r\n });\r\n\r\n const [renderState, setRenderState] = useState(false);\r\n function forceRender() {\r\n setRenderState(!renderState);\r\n }\r\n\r\n const preparedGesture = React.useRef<GestureConfigReference>({\r\n config: gesture,\r\n animatedEventHandler: null,\r\n animatedHandlers: null,\r\n firstExecution: true,\r\n useReanimatedHook: useReanimatedHook,\r\n }).current;\r\n\r\n if (useReanimatedHook !== preparedGesture.useReanimatedHook) {\r\n throw new Error(\r\n tagMessage(\r\n 'You cannot change the thread the callbacks are ran on while the app is running'\r\n )\r\n );\r\n }\r\n\r\n function onHandlersUpdate(skipConfigUpdate?: boolean) {\r\n // if the underlying view has changed we need to reattach handlers to the new view\r\n const viewTag = findNodeHandle(state.viewRef) as number;\r\n const forceReattach = viewTag !== state.previousViewTag;\r\n\r\n if (forceReattach || needsToReattach(preparedGesture, gesture)) {\r\n validateDetectorChildren(state.viewRef);\r\n dropHandlers(preparedGesture);\r\n attachHandlers({\r\n preparedGesture,\r\n gestureConfig,\r\n gesture,\r\n webEventHandlersRef,\r\n viewTag,\r\n mountedRef,\r\n });\r\n\r\n state.previousViewTag = viewTag;\r\n state.forceReattach = forceReattach;\r\n if (forceReattach) {\r\n forceRender();\r\n }\r\n } else if (!skipConfigUpdate) {\r\n updateHandlers(preparedGesture, gestureConfig, gesture, mountedRef);\r\n }\r\n }\r\n\r\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\r\n // config update will be enough as all necessary items are stored in shared values anyway\r\n const needsToRebuildReanimatedEvent =\r\n preparedGesture.firstExecution ||\r\n needsToReattach(preparedGesture, gesture) ||\r\n state.forceReattach;\r\n\r\n state.forceReattach = false;\r\n\r\n if (preparedGesture.firstExecution) {\r\n gestureConfig.initialize();\r\n }\r\n\r\n if (useReanimatedHook) {\r\n // Whether animatedGesture or gesture is used shouldn't change while the app is running\r\n // eslint-disable-next-line react-hooks/rules-of-hooks\r\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\r\n }\r\n\r\n useEffect(() => {\r\n const viewTag = findNodeHandle(state.viewRef) as number;\r\n state.firstRender = true;\r\n mountedRef.current = true;\r\n\r\n validateDetectorChildren(state.viewRef);\r\n\r\n attachHandlers({\r\n preparedGesture,\r\n gestureConfig,\r\n gesture,\r\n webEventHandlersRef,\r\n viewTag,\r\n mountedRef,\r\n });\r\n\r\n return () => {\r\n mountedRef.current = false;\r\n dropHandlers(preparedGesture);\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!state.firstRender) {\r\n onHandlersUpdate();\r\n } else {\r\n state.firstRender = false;\r\n }\r\n }, [props]);\r\n\r\n const refFunction = (ref: unknown) => {\r\n if (ref !== null) {\r\n // @ts-ignore Just setting the view ref\r\n state.viewRef = ref;\r\n\r\n // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed\r\n if (state.previousViewTag === -1) {\r\n state.previousViewTag = findNodeHandle(state.viewRef) as number;\r\n }\r\n\r\n // pass true as `skipConfigUpdate`, here we only want to trigger the eventual reattaching of handlers\r\n // in case the view has changed, while config update would be handled be the `useEffect` above\r\n onHandlersUpdate(true);\r\n\r\n if (isFabric()) {\r\n const node = getShadowNodeFromRef(ref);\r\n if (global.isFormsStackingContext(node) === false) {\r\n console.error(\r\n tagMessage(\r\n 'GestureDetector has received a child that may get view-flattened. ' +\r\n '\\nTo prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.'\r\n )\r\n );\r\n }\r\n }\r\n }\r\n };\r\n\r\n if (useReanimatedHook) {\r\n return (\r\n <AnimatedWrap\r\n ref={refFunction}\r\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\r\n {props.children}\r\n </AnimatedWrap>\r\n );\r\n } else {\r\n return <Wrap ref={refFunction}>{props.children}</Wrap>;\r\n }\r\n};\r\n\r\nclass Wrap extends React.Component<{\r\n onGestureHandlerEvent?: unknown;\r\n // implicit `children` prop has been removed in @types/react^18.0.0\r\n children?: React.ReactNode;\r\n}> {\r\n render() {\r\n try {\r\n // I don't think that fighting with types over such a simple function is worth it\r\n // The only thing it does is add 'collapsable: false' to the child component\r\n // to make sure it is in the native view hierarchy so the detector can find\r\n // correct viewTag to attach to.\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const child: any = React.Children.only(this.props.children);\r\n return React.cloneElement(\r\n child,\r\n { collapsable: false },\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n child.props.children\r\n );\r\n } catch (e) {\r\n throw new Error(\r\n tagMessage(\r\n `GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\r\n )\r\n );\r\n }\r\n }\r\n}\r\n\r\nconst AnimatedWrap = Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\r\n"]}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import { DeviceEventEmitter } from 'react-native';
|
2
|
+
import { State } from '../../State';
|
3
|
+
import { TouchEventType } from '../../TouchEventType';
|
4
|
+
import { findHandler, findOldGestureHandler } from '../handlersRegistry';
|
5
|
+
import { GestureStateManager } from './gestureStateManager';
|
6
|
+
let gestureHandlerEventSubscription = null;
|
7
|
+
let gestureHandlerStateChangeEventSubscription = null;
|
8
|
+
const gestureStateManagers = new Map();
|
9
|
+
const lastUpdateEvent = [];
|
10
|
+
|
11
|
+
function isStateChangeEvent(event) {
|
12
|
+
// @ts-ignore oldState doesn't exist on GestureTouchEvent and that's the point
|
13
|
+
return event.oldState != null;
|
14
|
+
}
|
15
|
+
|
16
|
+
function isTouchEvent(event) {
|
17
|
+
return event.eventType != null;
|
18
|
+
}
|
19
|
+
|
20
|
+
export function onGestureHandlerEvent(event) {
|
21
|
+
var _handler$handlers7, _handler$handlers7$on, _handler$handlers8, _handler$handlers8$on, _handler$handlers9, _handler$handlers9$on, _handler$handlers10, _handler$handlers10$o;
|
22
|
+
|
23
|
+
const handler = findHandler(event.handlerTag);
|
24
|
+
|
25
|
+
if (handler) {
|
26
|
+
if (isStateChangeEvent(event)) {
|
27
|
+
if (event.oldState === State.UNDETERMINED && event.state === State.BEGAN) {
|
28
|
+
var _handler$handlers$onB, _handler$handlers;
|
29
|
+
|
30
|
+
(_handler$handlers$onB = (_handler$handlers = handler.handlers).onBegin) === null || _handler$handlers$onB === void 0 ? void 0 : _handler$handlers$onB.call(_handler$handlers, event);
|
31
|
+
} else if ((event.oldState === State.BEGAN || event.oldState === State.UNDETERMINED) && event.state === State.ACTIVE) {
|
32
|
+
var _handler$handlers$onS, _handler$handlers2;
|
33
|
+
|
34
|
+
(_handler$handlers$onS = (_handler$handlers2 = handler.handlers).onStart) === null || _handler$handlers$onS === void 0 ? void 0 : _handler$handlers$onS.call(_handler$handlers2, event);
|
35
|
+
lastUpdateEvent[handler.handlers.handlerTag] = event;
|
36
|
+
} else if (event.oldState !== event.state && event.state === State.END) {
|
37
|
+
var _handler$handlers$onF, _handler$handlers4;
|
38
|
+
|
39
|
+
if (event.oldState === State.ACTIVE) {
|
40
|
+
var _handler$handlers$onE, _handler$handlers3;
|
41
|
+
|
42
|
+
(_handler$handlers$onE = (_handler$handlers3 = handler.handlers).onEnd) === null || _handler$handlers$onE === void 0 ? void 0 : _handler$handlers$onE.call(_handler$handlers3, event, true);
|
43
|
+
}
|
44
|
+
|
45
|
+
(_handler$handlers$onF = (_handler$handlers4 = handler.handlers).onFinalize) === null || _handler$handlers$onF === void 0 ? void 0 : _handler$handlers$onF.call(_handler$handlers4, event, true);
|
46
|
+
lastUpdateEvent[handler.handlers.handlerTag] = undefined;
|
47
|
+
} else if ((event.state === State.FAILED || event.state === State.CANCELLED) && event.oldState !== event.state) {
|
48
|
+
var _handler$handlers$onF2, _handler$handlers6;
|
49
|
+
|
50
|
+
if (event.oldState === State.ACTIVE) {
|
51
|
+
var _handler$handlers$onE2, _handler$handlers5;
|
52
|
+
|
53
|
+
(_handler$handlers$onE2 = (_handler$handlers5 = handler.handlers).onEnd) === null || _handler$handlers$onE2 === void 0 ? void 0 : _handler$handlers$onE2.call(_handler$handlers5, event, false);
|
54
|
+
}
|
55
|
+
|
56
|
+
(_handler$handlers$onF2 = (_handler$handlers6 = handler.handlers).onFinalize) === null || _handler$handlers$onF2 === void 0 ? void 0 : _handler$handlers$onF2.call(_handler$handlers6, event, false);
|
57
|
+
gestureStateManagers.delete(event.handlerTag);
|
58
|
+
lastUpdateEvent[handler.handlers.handlerTag] = undefined;
|
59
|
+
}
|
60
|
+
} else if (isTouchEvent(event)) {
|
61
|
+
if (!gestureStateManagers.has(event.handlerTag)) {
|
62
|
+
gestureStateManagers.set(event.handlerTag, GestureStateManager.create(event.handlerTag));
|
63
|
+
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
64
|
+
|
65
|
+
|
66
|
+
const manager = gestureStateManagers.get(event.handlerTag);
|
67
|
+
|
68
|
+
switch (event.eventType) {
|
69
|
+
case TouchEventType.TOUCHES_DOWN:
|
70
|
+
(_handler$handlers7 = handler.handlers) === null || _handler$handlers7 === void 0 ? void 0 : (_handler$handlers7$on = _handler$handlers7.onTouchesDown) === null || _handler$handlers7$on === void 0 ? void 0 : _handler$handlers7$on.call(_handler$handlers7, event, manager);
|
71
|
+
break;
|
72
|
+
|
73
|
+
case TouchEventType.TOUCHES_MOVE:
|
74
|
+
(_handler$handlers8 = handler.handlers) === null || _handler$handlers8 === void 0 ? void 0 : (_handler$handlers8$on = _handler$handlers8.onTouchesMove) === null || _handler$handlers8$on === void 0 ? void 0 : _handler$handlers8$on.call(_handler$handlers8, event, manager);
|
75
|
+
break;
|
76
|
+
|
77
|
+
case TouchEventType.TOUCHES_UP:
|
78
|
+
(_handler$handlers9 = handler.handlers) === null || _handler$handlers9 === void 0 ? void 0 : (_handler$handlers9$on = _handler$handlers9.onTouchesUp) === null || _handler$handlers9$on === void 0 ? void 0 : _handler$handlers9$on.call(_handler$handlers9, event, manager);
|
79
|
+
break;
|
80
|
+
|
81
|
+
case TouchEventType.TOUCHES_CANCELLED:
|
82
|
+
(_handler$handlers10 = handler.handlers) === null || _handler$handlers10 === void 0 ? void 0 : (_handler$handlers10$o = _handler$handlers10.onTouchesCancelled) === null || _handler$handlers10$o === void 0 ? void 0 : _handler$handlers10$o.call(_handler$handlers10, event, manager);
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
} else {
|
86
|
+
var _handler$handlers$onU, _handler$handlers11;
|
87
|
+
|
88
|
+
(_handler$handlers$onU = (_handler$handlers11 = handler.handlers).onUpdate) === null || _handler$handlers$onU === void 0 ? void 0 : _handler$handlers$onU.call(_handler$handlers11, event);
|
89
|
+
|
90
|
+
if (handler.handlers.onChange && handler.handlers.changeEventCalculator) {
|
91
|
+
var _handler$handlers$onC, _handler$handlers12, _handler$handlers$cha, _handler$handlers13;
|
92
|
+
|
93
|
+
(_handler$handlers$onC = (_handler$handlers12 = handler.handlers).onChange) === null || _handler$handlers$onC === void 0 ? void 0 : _handler$handlers$onC.call(_handler$handlers12, (_handler$handlers$cha = (_handler$handlers13 = handler.handlers).changeEventCalculator) === null || _handler$handlers$cha === void 0 ? void 0 : _handler$handlers$cha.call(_handler$handlers13, event, lastUpdateEvent[handler.handlers.handlerTag]));
|
94
|
+
lastUpdateEvent[handler.handlers.handlerTag] = event;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
} else {
|
98
|
+
const oldHandler = findOldGestureHandler(event.handlerTag);
|
99
|
+
|
100
|
+
if (oldHandler) {
|
101
|
+
const nativeEvent = {
|
102
|
+
nativeEvent: event
|
103
|
+
};
|
104
|
+
|
105
|
+
if (isStateChangeEvent(event)) {
|
106
|
+
oldHandler.onGestureStateChange(nativeEvent);
|
107
|
+
} else {
|
108
|
+
oldHandler.onGestureEvent(nativeEvent);
|
109
|
+
}
|
110
|
+
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
export function startListening() {
|
116
|
+
stopListening();
|
117
|
+
gestureHandlerEventSubscription = DeviceEventEmitter.addListener('onGestureHandlerEvent', onGestureHandlerEvent);
|
118
|
+
gestureHandlerStateChangeEventSubscription = DeviceEventEmitter.addListener('onGestureHandlerStateChange', onGestureHandlerEvent);
|
119
|
+
}
|
120
|
+
export function stopListening() {
|
121
|
+
if (gestureHandlerEventSubscription) {
|
122
|
+
gestureHandlerEventSubscription.remove();
|
123
|
+
gestureHandlerEventSubscription = null;
|
124
|
+
}
|
125
|
+
|
126
|
+
if (gestureHandlerStateChangeEventSubscription) {
|
127
|
+
gestureHandlerStateChangeEventSubscription.remove();
|
128
|
+
gestureHandlerStateChangeEventSubscription = null;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
//# sourceMappingURL=eventReceiver.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["eventReceiver.ts"],"names":["DeviceEventEmitter","State","TouchEventType","findHandler","findOldGestureHandler","GestureStateManager","gestureHandlerEventSubscription","gestureHandlerStateChangeEventSubscription","gestureStateManagers","Map","lastUpdateEvent","isStateChangeEvent","event","oldState","isTouchEvent","eventType","onGestureHandlerEvent","handler","handlerTag","UNDETERMINED","state","BEGAN","handlers","onBegin","ACTIVE","onStart","END","onEnd","onFinalize","undefined","FAILED","CANCELLED","delete","has","set","create","manager","get","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","onUpdate","onChange","changeEventCalculator","oldHandler","nativeEvent","onGestureStateChange","onGestureEvent","startListening","stopListening","addListener","remove"],"mappings":"AAAA,SAASA,kBAAT,QAAwD,cAAxD;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,cAAT,QAA+B,sBAA/B;AAMA,SAASC,WAAT,EAAsBC,qBAAtB,QAAmD,qBAAnD;AAEA,SACEC,mBADF,QAGO,uBAHP;AAKA,IAAIC,+BAA2D,GAAG,IAAlE;AACA,IAAIC,0CAAsE,GACxE,IADF;AAGA,MAAMC,oBAA0D,GAAG,IAAIC,GAAJ,EAAnE;AAKA,MAAMC,eAAmD,GAAG,EAA5D;;AAEA,SAASC,kBAAT,CACEC,KADF,EAEoC;AAClC;AACA,SAAOA,KAAK,CAACC,QAAN,IAAkB,IAAzB;AACD;;AAED,SAASC,YAAT,CACEF,KADF,EAE8B;AAC5B,SAAOA,KAAK,CAACG,SAAN,IAAmB,IAA1B;AACD;;AAED,OAAO,SAASC,qBAAT,CACLJ,KADK,EAEL;AAAA;;AACA,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C,6BAD2C,EAE3CvC,qBAF2C,CAA7C;AAID;AAED,OAAO,SAASsC,aAAT,GAAyB;AAC9B,MAAIhD,+BAAJ,EAAqC;AACnCA,IAAAA,+BAA+B,CAACkD,MAAhC;AACAlD,IAAAA,+BAA+B,GAAG,IAAlC;AACD;;AAED,MAAIC,0CAAJ,EAAgD;AAC9CA,IAAAA,0CAA0C,CAACiD,MAA3C;AACAjD,IAAAA,0CAA0C,GAAG,IAA7C;AACD;AACF","sourcesContent":["import { DeviceEventEmitter, EmitterSubscription } from 'react-native';\r\nimport { State } from '../../State';\r\nimport { TouchEventType } from '../../TouchEventType';\r\nimport {\r\n GestureTouchEvent,\r\n GestureUpdateEvent,\r\n GestureStateChangeEvent,\r\n} from '../gestureHandlerCommon';\r\nimport { findHandler, findOldGestureHandler } from '../handlersRegistry';\r\nimport { BaseGesture } from './gesture';\r\nimport {\r\n GestureStateManager,\r\n GestureStateManagerType,\r\n} from './gestureStateManager';\r\n\r\nlet gestureHandlerEventSubscription: EmitterSubscription | null = null;\r\nlet gestureHandlerStateChangeEventSubscription: EmitterSubscription | null =\r\n null;\r\n\r\nconst gestureStateManagers: Map<number, GestureStateManagerType> = new Map<\r\n number,\r\n GestureStateManagerType\r\n>();\r\n\r\nconst lastUpdateEvent: (GestureUpdateEvent | undefined)[] = [];\r\n\r\nfunction isStateChangeEvent(\r\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\r\n): event is GestureStateChangeEvent {\r\n // @ts-ignore oldState doesn't exist on GestureTouchEvent and that's the point\r\n return event.oldState != null;\r\n}\r\n\r\nfunction isTouchEvent(\r\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\r\n): event is GestureTouchEvent {\r\n return event.eventType != null;\r\n}\r\n\r\nexport function onGestureHandlerEvent(\r\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\r\n) {\r\n const handler = findHandler(event.handlerTag) as BaseGesture<\r\n Record<string, unknown>\r\n >;\r\n\r\n if (handler) {\r\n if (isStateChangeEvent(event)) {\r\n if (\r\n event.oldState === State.UNDETERMINED &&\r\n event.state === State.BEGAN\r\n ) {\r\n handler.handlers.onBegin?.(event);\r\n } else if (\r\n (event.oldState === State.BEGAN ||\r\n event.oldState === State.UNDETERMINED) &&\r\n event.state === State.ACTIVE\r\n ) {\r\n handler.handlers.onStart?.(event);\r\n lastUpdateEvent[handler.handlers.handlerTag] = event;\r\n } else if (event.oldState !== event.state && event.state === State.END) {\r\n if (event.oldState === State.ACTIVE) {\r\n handler.handlers.onEnd?.(event, true);\r\n }\r\n handler.handlers.onFinalize?.(event, true);\r\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\r\n } else if (\r\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\r\n event.oldState !== event.state\r\n ) {\r\n if (event.oldState === State.ACTIVE) {\r\n handler.handlers.onEnd?.(event, false);\r\n }\r\n handler.handlers.onFinalize?.(event, false);\r\n gestureStateManagers.delete(event.handlerTag);\r\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\r\n }\r\n } else if (isTouchEvent(event)) {\r\n if (!gestureStateManagers.has(event.handlerTag)) {\r\n gestureStateManagers.set(\r\n event.handlerTag,\r\n GestureStateManager.create(event.handlerTag)\r\n );\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n const manager = gestureStateManagers.get(event.handlerTag)!;\r\n\r\n switch (event.eventType) {\r\n case TouchEventType.TOUCHES_DOWN:\r\n handler.handlers?.onTouchesDown?.(event, manager);\r\n break;\r\n case TouchEventType.TOUCHES_MOVE:\r\n handler.handlers?.onTouchesMove?.(event, manager);\r\n break;\r\n case TouchEventType.TOUCHES_UP:\r\n handler.handlers?.onTouchesUp?.(event, manager);\r\n break;\r\n case TouchEventType.TOUCHES_CANCELLED:\r\n handler.handlers?.onTouchesCancelled?.(event, manager);\r\n break;\r\n }\r\n } else {\r\n handler.handlers.onUpdate?.(event);\r\n\r\n if (handler.handlers.onChange && handler.handlers.changeEventCalculator) {\r\n handler.handlers.onChange?.(\r\n handler.handlers.changeEventCalculator?.(\r\n event,\r\n lastUpdateEvent[handler.handlers.handlerTag]\r\n )\r\n );\r\n\r\n lastUpdateEvent[handler.handlers.handlerTag] = event;\r\n }\r\n }\r\n } else {\r\n const oldHandler = findOldGestureHandler(event.handlerTag);\r\n if (oldHandler) {\r\n const nativeEvent = { nativeEvent: event };\r\n if (isStateChangeEvent(event)) {\r\n oldHandler.onGestureStateChange(nativeEvent);\r\n } else {\r\n oldHandler.onGestureEvent(nativeEvent);\r\n }\r\n return;\r\n }\r\n }\r\n}\r\n\r\nexport function startListening() {\r\n stopListening();\r\n\r\n gestureHandlerEventSubscription = DeviceEventEmitter.addListener(\r\n 'onGestureHandlerEvent',\r\n onGestureHandlerEvent\r\n );\r\n\r\n gestureHandlerStateChangeEventSubscription = DeviceEventEmitter.addListener(\r\n 'onGestureHandlerStateChange',\r\n onGestureHandlerEvent\r\n );\r\n}\r\n\r\nexport function stopListening() {\r\n if (gestureHandlerEventSubscription) {\r\n gestureHandlerEventSubscription.remove();\r\n gestureHandlerEventSubscription = null;\r\n }\r\n\r\n if (gestureHandlerStateChangeEventSubscription) {\r\n gestureHandlerStateChangeEventSubscription.remove();\r\n gestureHandlerStateChangeEventSubscription = null;\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,24 @@
|
|
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 FlingGesture extends BaseGesture {
|
5
|
+
constructor() {
|
6
|
+
super();
|
7
|
+
|
8
|
+
_defineProperty(this, "config", {});
|
9
|
+
|
10
|
+
this.handlerName = 'FlingGestureHandler';
|
11
|
+
}
|
12
|
+
|
13
|
+
numberOfPointers(pointers) {
|
14
|
+
this.config.numberOfPointers = pointers;
|
15
|
+
return this;
|
16
|
+
}
|
17
|
+
|
18
|
+
direction(direction) {
|
19
|
+
this.config.direction = direction;
|
20
|
+
return this;
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=flingGesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["flingGesture.ts"],"names":["BaseGesture","FlingGesture","constructor","handlerName","numberOfPointers","pointers","config","direction"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAMA,OAAO,MAAMC,YAAN,SAA2BD,WAA3B,CAAwE;AAG7EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD;;AAEDC,EAAAA,gBAAgB,CAACC,QAAD,EAAmB;AACjC,SAAKC,MAAL,CAAYF,gBAAZ,GAA+BC,QAA/B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,SAAS,CAACA,SAAD,EAAoB;AAC3B,SAAKD,MAAL,CAAYC,SAAZ,GAAwBA,SAAxB;AACA,WAAO,IAAP;AACD;;AAjB4E","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\r\nimport {\r\n FlingGestureConfig,\r\n FlingGestureHandlerEventPayload,\r\n} from '../FlingGestureHandler';\r\n\r\nexport class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {\r\n public config: BaseGestureConfig & FlingGestureConfig = {};\r\n\r\n constructor() {\r\n super();\r\n\r\n this.handlerName = 'FlingGestureHandler';\r\n }\r\n\r\n numberOfPointers(pointers: number) {\r\n this.config.numberOfPointers = pointers;\r\n return this;\r\n }\r\n\r\n direction(direction: number) {\r\n this.config.direction = direction;\r\n return this;\r\n }\r\n}\r\n\r\nexport type FlingGestureType = InstanceType<typeof FlingGesture>;\r\n"]}
|
@@ -0,0 +1,56 @@
|
|
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
|
+
forceChange: current.force
|
13
|
+
};
|
14
|
+
} else {
|
15
|
+
changePayload = {
|
16
|
+
forceChange: current.force - previous.force
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
return { ...current,
|
21
|
+
...changePayload
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
export class ForceTouchGesture extends ContinousBaseGesture {
|
26
|
+
constructor() {
|
27
|
+
super();
|
28
|
+
|
29
|
+
_defineProperty(this, "config", {});
|
30
|
+
|
31
|
+
this.handlerName = 'ForceTouchGestureHandler';
|
32
|
+
}
|
33
|
+
|
34
|
+
minForce(force) {
|
35
|
+
this.config.minForce = force;
|
36
|
+
return this;
|
37
|
+
}
|
38
|
+
|
39
|
+
maxForce(force) {
|
40
|
+
this.config.maxForce = force;
|
41
|
+
return this;
|
42
|
+
}
|
43
|
+
|
44
|
+
feedbackOnActivation(value) {
|
45
|
+
this.config.feedbackOnActivation = value;
|
46
|
+
return this;
|
47
|
+
}
|
48
|
+
|
49
|
+
onChange(callback) {
|
50
|
+
// @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record
|
51
|
+
this.handlers.changeEventCalculator = changeEventCalculator;
|
52
|
+
return super.onChange(callback);
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
//# sourceMappingURL=forceTouchGesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["forceTouchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","forceChange","force","ForceTouchGesture","constructor","handlerName","minForce","config","maxForce","feedbackOnActivation","value","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AAWA,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,iBAAN,SAAgCR,oBAAhC,CAGL;AAGAS,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;;AAEDC,EAAAA,QAAQ,CAACJ,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYD,QAAZ,GAAuBJ,KAAvB;AACA,WAAO,IAAP;AACD;;AAEDM,EAAAA,QAAQ,CAACN,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYC,QAAZ,GAAuBN,KAAvB;AACA,WAAO,IAAP;AACD;;AAEDO,EAAAA,oBAAoB,CAACC,KAAD,EAAiB;AACnC,SAAKH,MAAL,CAAYE,oBAAZ,GAAmCC,KAAnC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EASN;AACA;AACA,SAAKC,QAAL,CAAcjB,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMe,QAAN,CAAeC,QAAf,CAAP;AACD;;AArCD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\r\nimport {\r\n ForceTouchGestureConfig,\r\n ForceTouchGestureHandlerEventPayload,\r\n} from '../ForceTouchGestureHandler';\r\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\r\n\r\nexport type ForceTouchGestureChangeEventPayload = {\r\n forceChange: number;\r\n};\r\n\r\nfunction changeEventCalculator(\r\n current: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>,\r\n previous?: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>\r\n) {\r\n 'worklet';\r\n let changePayload: ForceTouchGestureChangeEventPayload;\r\n if (previous === undefined) {\r\n changePayload = {\r\n forceChange: current.force,\r\n };\r\n } else {\r\n changePayload = {\r\n forceChange: current.force - previous.force,\r\n };\r\n }\r\n\r\n return { ...current, ...changePayload };\r\n}\r\n\r\nexport class ForceTouchGesture extends ContinousBaseGesture<\r\n ForceTouchGestureHandlerEventPayload,\r\n ForceTouchGestureChangeEventPayload\r\n> {\r\n public config: BaseGestureConfig & ForceTouchGestureConfig = {};\r\n\r\n constructor() {\r\n super();\r\n\r\n this.handlerName = 'ForceTouchGestureHandler';\r\n }\r\n\r\n minForce(force: number) {\r\n this.config.minForce = force;\r\n return this;\r\n }\r\n\r\n maxForce(force: number) {\r\n this.config.maxForce = force;\r\n return this;\r\n }\r\n\r\n feedbackOnActivation(value: boolean) {\r\n this.config.feedbackOnActivation = value;\r\n return this;\r\n }\r\n\r\n onChange(\r\n callback: (\r\n event: GestureUpdateEvent<\r\n GestureUpdateEvent<\r\n ForceTouchGestureHandlerEventPayload &\r\n ForceTouchGestureChangeEventPayload\r\n >\r\n >\r\n ) => void\r\n ) {\r\n // @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record\r\n this.handlers.changeEventCalculator = changeEventCalculator;\r\n return super.onChange(callback);\r\n }\r\n}\r\n\r\nexport type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;\r\n"]}
|
@@ -0,0 +1,222 @@
|
|
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 { getNextHandlerTag } from '../handlersRegistry';
|
4
|
+
import { isRemoteDebuggingEnabled } from '../../utils';
|
5
|
+
export const CALLBACK_TYPE = {
|
6
|
+
UNDEFINED: 0,
|
7
|
+
BEGAN: 1,
|
8
|
+
START: 2,
|
9
|
+
UPDATE: 3,
|
10
|
+
CHANGE: 4,
|
11
|
+
END: 5,
|
12
|
+
FINALIZE: 6,
|
13
|
+
TOUCHES_DOWN: 7,
|
14
|
+
TOUCHES_MOVE: 8,
|
15
|
+
TOUCHES_UP: 9,
|
16
|
+
TOUCHES_CANCELLED: 10
|
17
|
+
}; // Allow using CALLBACK_TYPE as object and type
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
19
|
+
|
20
|
+
export class Gesture {}
|
21
|
+
let nextGestureId = 0;
|
22
|
+
export class BaseGesture extends Gesture {
|
23
|
+
constructor() {
|
24
|
+
super(); // Used to check whether the gesture config has been updated when wrapping it
|
25
|
+
// with `useMemo`. Since every config will have a unique id, when the dependencies
|
26
|
+
// don't change, the config won't be recreated and the id will stay the same.
|
27
|
+
// If the id is different, it means that the config has changed and the gesture
|
28
|
+
// needs to be updated.
|
29
|
+
|
30
|
+
_defineProperty(this, "gestureId", -1);
|
31
|
+
|
32
|
+
_defineProperty(this, "handlerTag", -1);
|
33
|
+
|
34
|
+
_defineProperty(this, "handlerName", '');
|
35
|
+
|
36
|
+
_defineProperty(this, "config", {});
|
37
|
+
|
38
|
+
_defineProperty(this, "handlers", {
|
39
|
+
gestureId: -1,
|
40
|
+
handlerTag: -1,
|
41
|
+
isWorklet: []
|
42
|
+
});
|
43
|
+
|
44
|
+
this.gestureId = nextGestureId++;
|
45
|
+
this.handlers.gestureId = this.gestureId;
|
46
|
+
}
|
47
|
+
|
48
|
+
addDependency(key, gesture) {
|
49
|
+
const value = this.config[key];
|
50
|
+
this.config[key] = value ? Array().concat(value, gesture) : [gesture];
|
51
|
+
}
|
52
|
+
|
53
|
+
withRef(ref) {
|
54
|
+
this.config.ref = ref;
|
55
|
+
return this;
|
56
|
+
} // eslint-disable-next-line @typescript-eslint/ban-types
|
57
|
+
|
58
|
+
|
59
|
+
isWorklet(callback) {
|
60
|
+
//@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
|
61
|
+
return callback.__workletHash !== undefined;
|
62
|
+
}
|
63
|
+
|
64
|
+
onBegin(callback) {
|
65
|
+
this.handlers.onBegin = callback;
|
66
|
+
this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);
|
67
|
+
return this;
|
68
|
+
}
|
69
|
+
|
70
|
+
onStart(callback) {
|
71
|
+
this.handlers.onStart = callback;
|
72
|
+
this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);
|
73
|
+
return this;
|
74
|
+
}
|
75
|
+
|
76
|
+
onEnd(callback) {
|
77
|
+
this.handlers.onEnd = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
|
78
|
+
|
79
|
+
this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);
|
80
|
+
return this;
|
81
|
+
}
|
82
|
+
|
83
|
+
onFinalize(callback) {
|
84
|
+
this.handlers.onFinalize = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
|
85
|
+
|
86
|
+
this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);
|
87
|
+
return this;
|
88
|
+
}
|
89
|
+
|
90
|
+
onTouchesDown(callback) {
|
91
|
+
this.config.needsPointerData = true;
|
92
|
+
this.handlers.onTouchesDown = callback;
|
93
|
+
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] = this.isWorklet(callback);
|
94
|
+
return this;
|
95
|
+
}
|
96
|
+
|
97
|
+
onTouchesMove(callback) {
|
98
|
+
this.config.needsPointerData = true;
|
99
|
+
this.handlers.onTouchesMove = callback;
|
100
|
+
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] = this.isWorklet(callback);
|
101
|
+
return this;
|
102
|
+
}
|
103
|
+
|
104
|
+
onTouchesUp(callback) {
|
105
|
+
this.config.needsPointerData = true;
|
106
|
+
this.handlers.onTouchesUp = callback;
|
107
|
+
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] = this.isWorklet(callback);
|
108
|
+
return this;
|
109
|
+
}
|
110
|
+
|
111
|
+
onTouchesCancelled(callback) {
|
112
|
+
this.config.needsPointerData = true;
|
113
|
+
this.handlers.onTouchesCancelled = callback;
|
114
|
+
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] = this.isWorklet(callback);
|
115
|
+
return this;
|
116
|
+
}
|
117
|
+
|
118
|
+
enabled(enabled) {
|
119
|
+
this.config.enabled = enabled;
|
120
|
+
return this;
|
121
|
+
}
|
122
|
+
|
123
|
+
shouldCancelWhenOutside(value) {
|
124
|
+
this.config.shouldCancelWhenOutside = value;
|
125
|
+
return this;
|
126
|
+
}
|
127
|
+
|
128
|
+
hitSlop(hitSlop) {
|
129
|
+
this.config.hitSlop = hitSlop;
|
130
|
+
return this;
|
131
|
+
}
|
132
|
+
|
133
|
+
activeCursor(activeCursor) {
|
134
|
+
this.config.activeCursor = activeCursor;
|
135
|
+
return this;
|
136
|
+
}
|
137
|
+
|
138
|
+
runOnJS(runOnJS) {
|
139
|
+
this.config.runOnJS = runOnJS;
|
140
|
+
return this;
|
141
|
+
}
|
142
|
+
|
143
|
+
simultaneousWithExternalGesture(...gestures) {
|
144
|
+
for (const gesture of gestures) {
|
145
|
+
this.addDependency('simultaneousWith', gesture);
|
146
|
+
}
|
147
|
+
|
148
|
+
return this;
|
149
|
+
}
|
150
|
+
|
151
|
+
requireExternalGestureToFail(...gestures) {
|
152
|
+
for (const gesture of gestures) {
|
153
|
+
this.addDependency('requireToFail', gesture);
|
154
|
+
}
|
155
|
+
|
156
|
+
return this;
|
157
|
+
}
|
158
|
+
|
159
|
+
blocksExternalGesture(...gestures) {
|
160
|
+
for (const gesture of gestures) {
|
161
|
+
this.addDependency('blocksHandlers', gesture);
|
162
|
+
}
|
163
|
+
|
164
|
+
return this;
|
165
|
+
}
|
166
|
+
|
167
|
+
withTestId(id) {
|
168
|
+
this.config.testId = id;
|
169
|
+
return this;
|
170
|
+
}
|
171
|
+
|
172
|
+
cancelsTouchesInView(value) {
|
173
|
+
this.config.cancelsTouchesInView = value;
|
174
|
+
return this;
|
175
|
+
}
|
176
|
+
|
177
|
+
initialize() {
|
178
|
+
this.handlerTag = getNextHandlerTag();
|
179
|
+
this.handlers = { ...this.handlers,
|
180
|
+
handlerTag: this.handlerTag
|
181
|
+
};
|
182
|
+
|
183
|
+
if (this.config.ref) {
|
184
|
+
this.config.ref.current = this;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
toGestureArray() {
|
189
|
+
return [this];
|
190
|
+
} // eslint-disable-next-line @typescript-eslint/no-empty-function
|
191
|
+
|
192
|
+
|
193
|
+
prepare() {}
|
194
|
+
|
195
|
+
get shouldUseReanimated() {
|
196
|
+
// use Reanimated when runOnJS isn't set explicitly,
|
197
|
+
// and all defined callbacks are worklets,
|
198
|
+
// and remote debugging is disabled
|
199
|
+
return this.config.runOnJS !== true && !this.handlers.isWorklet.includes(false) && !isRemoteDebuggingEnabled();
|
200
|
+
}
|
201
|
+
|
202
|
+
}
|
203
|
+
export class ContinousBaseGesture extends BaseGesture {
|
204
|
+
onUpdate(callback) {
|
205
|
+
this.handlers.onUpdate = callback;
|
206
|
+
this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);
|
207
|
+
return this;
|
208
|
+
}
|
209
|
+
|
210
|
+
onChange(callback) {
|
211
|
+
this.handlers.onChange = callback;
|
212
|
+
this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);
|
213
|
+
return this;
|
214
|
+
}
|
215
|
+
|
216
|
+
manualActivation(manualActivation) {
|
217
|
+
this.config.manualActivation = manualActivation;
|
218
|
+
return this;
|
219
|
+
}
|
220
|
+
|
221
|
+
}
|
222
|
+
//# sourceMappingURL=gesture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["gesture.ts"],"names":["getNextHandlerTag","isRemoteDebuggingEnabled","CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","nextGestureId","BaseGesture","constructor","gestureId","handlerTag","isWorklet","handlers","addDependency","key","gesture","value","config","Array","concat","withRef","ref","callback","__workletHash","undefined","onBegin","onStart","onEnd","onFinalize","onTouchesDown","needsPointerData","onTouchesMove","onTouchesUp","onTouchesCancelled","enabled","shouldCancelWhenOutside","hitSlop","activeCursor","runOnJS","simultaneousWithExternalGesture","gestures","requireExternalGestureToFail","blocksExternalGesture","withTestId","id","testId","cancelsTouchesInView","initialize","current","toGestureArray","prepare","shouldUseReanimated","includes","ContinousBaseGesture","onUpdate","onChange","manualActivation"],"mappings":";;AAUA,SAASA,iBAAT,QAAkC,qBAAlC;AAQA,SAASC,wBAAT,QAAyC,aAAzC;AAgEA,OAAO,MAAMC,aAAa,GAAG;AAC3BC,EAAAA,SAAS,EAAE,CADgB;AAE3BC,EAAAA,KAAK,EAAE,CAFoB;AAG3BC,EAAAA,KAAK,EAAE,CAHoB;AAI3BC,EAAAA,MAAM,EAAE,CAJmB;AAK3BC,EAAAA,MAAM,EAAE,CALmB;AAM3BC,EAAAA,GAAG,EAAE,CANsB;AAO3BC,EAAAA,QAAQ,EAAE,CAPiB;AAQ3BC,EAAAA,YAAY,EAAE,CARa;AAS3BC,EAAAA,YAAY,EAAE,CATa;AAU3BC,EAAAA,UAAU,EAAE,CAVe;AAW3BC,EAAAA,iBAAiB,EAAE;AAXQ,CAAtB,C,CAcP;AACA;;AAGA,OAAO,MAAeC,OAAf,CAAuB;AAoB9B,IAAIC,aAAa,GAAG,CAApB;AACA,OAAO,MAAeC,WAAf,SAEGF,OAFH,CAEW;AAWhBG,EAAAA,WAAW,GAAG;AACZ,YADY,CAGZ;AACA;AACA;AACA;AACA;;AAPY,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AAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;;AAEDiC,EAAAA,QAAQ,CACNjC,QADM,EAIN;AACA,SAAKV,QAAL,CAAc2C,QAAd,GAAyBjC,QAAzB;AACA,SAAKV,QAAL,CAAcD,SAAd,CAAwBlB,aAAa,CAACK,MAAtC,IAAgD,KAAKa,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;;AAEDkC,EAAAA,gBAAgB,CAACA,gBAAD,EAA4B;AAC1C,SAAKvC,MAAL,CAAYuC,gBAAZ,GAA+BA,gBAA/B;AACA,WAAO,IAAP;AACD;;AApBkC","sourcesContent":["import { FlingGestureHandlerEventPayload } from '../FlingGestureHandler';\r\nimport { ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';\r\nimport {\r\n HitSlop,\r\n CommonGestureConfig,\r\n GestureTouchEvent,\r\n GestureStateChangeEvent,\r\n GestureUpdateEvent,\r\n ActiveCursor,\r\n} from '../gestureHandlerCommon';\r\nimport { getNextHandlerTag } from '../handlersRegistry';\r\nimport { GestureStateManagerType } from './gestureStateManager';\r\nimport { LongPressGestureHandlerEventPayload } from '../LongPressGestureHandler';\r\nimport { PanGestureHandlerEventPayload } from '../PanGestureHandler';\r\nimport { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';\r\nimport { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';\r\nimport { TapGestureHandlerEventPayload } from '../TapGestureHandler';\r\nimport { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';\r\nimport { isRemoteDebuggingEnabled } from '../../utils';\r\n\r\nexport type GestureType =\r\n | BaseGesture<Record<string, unknown>>\r\n | BaseGesture<Record<string, never>>\r\n | BaseGesture<TapGestureHandlerEventPayload>\r\n | BaseGesture<PanGestureHandlerEventPayload>\r\n | BaseGesture<LongPressGestureHandlerEventPayload>\r\n | BaseGesture<RotationGestureHandlerEventPayload>\r\n | BaseGesture<PinchGestureHandlerEventPayload>\r\n | BaseGesture<FlingGestureHandlerEventPayload>\r\n | BaseGesture<ForceTouchGestureHandlerEventPayload>\r\n | BaseGesture<NativeViewGestureHandlerPayload>;\r\n\r\nexport type GestureRef =\r\n | number\r\n | GestureType\r\n | React.RefObject<GestureType | undefined>\r\n | React.RefObject<React.ComponentType | undefined>; // allow adding a ref to a gesture handler\r\nexport interface BaseGestureConfig\r\n extends CommonGestureConfig,\r\n Record<string, unknown> {\r\n ref?: React.MutableRefObject<GestureType | undefined>;\r\n requireToFail?: GestureRef[];\r\n simultaneousWith?: GestureRef[];\r\n blocksHandlers?: GestureRef[];\r\n needsPointerData?: boolean;\r\n manualActivation?: boolean;\r\n runOnJS?: boolean;\r\n testId?: string;\r\n cancelsTouchesInView?: boolean;\r\n}\r\n\r\ntype TouchEventHandlerType = (\r\n event: GestureTouchEvent,\r\n stateManager: GestureStateManagerType\r\n) => void;\r\n\r\nexport type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {\r\n gestureId: number;\r\n handlerTag: number;\r\n onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\r\n onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\r\n onEnd?: (\r\n event: GestureStateChangeEvent<EventPayloadT>,\r\n success: boolean\r\n ) => void;\r\n onFinalize?: (\r\n event: GestureStateChangeEvent<EventPayloadT>,\r\n success: boolean\r\n ) => void;\r\n onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;\r\n onChange?: (event: any) => void;\r\n onTouchesDown?: TouchEventHandlerType;\r\n onTouchesMove?: TouchEventHandlerType;\r\n onTouchesUp?: TouchEventHandlerType;\r\n onTouchesCancelled?: TouchEventHandlerType;\r\n changeEventCalculator?: (\r\n current: GestureUpdateEvent<Record<string, unknown>>,\r\n previous?: GestureUpdateEvent<Record<string, unknown>>\r\n ) => GestureUpdateEvent<Record<string, unknown>>;\r\n isWorklet: boolean[];\r\n};\r\n\r\nexport const CALLBACK_TYPE = {\r\n UNDEFINED: 0,\r\n BEGAN: 1,\r\n START: 2,\r\n UPDATE: 3,\r\n CHANGE: 4,\r\n END: 5,\r\n FINALIZE: 6,\r\n TOUCHES_DOWN: 7,\r\n TOUCHES_MOVE: 8,\r\n TOUCHES_UP: 9,\r\n TOUCHES_CANCELLED: 10,\r\n} as const;\r\n\r\n// Allow using CALLBACK_TYPE as object and type\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];\r\n\r\nexport abstract class Gesture {\r\n /**\r\n * Return array of gestures, providing the same interface for creating and updating\r\n * handlers, no matter which object was used to create gesture instance.\r\n */\r\n abstract toGestureArray(): GestureType[];\r\n\r\n /**\r\n * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)\r\n */\r\n abstract initialize(): void;\r\n\r\n /**\r\n * Make sure that values of properties defining relations are arrays. Do any necessary\r\n * preprocessing required to configure relations between handlers. Called just before\r\n * updating the handler on the native side.\r\n */\r\n abstract prepare(): void;\r\n}\r\n\r\nlet nextGestureId = 0;\r\nexport abstract class BaseGesture<\r\n EventPayloadT extends Record<string, unknown>\r\n> extends Gesture {\r\n private gestureId = -1;\r\n public handlerTag = -1;\r\n public handlerName = '';\r\n public config: BaseGestureConfig = {};\r\n public handlers: HandlerCallbacks<EventPayloadT> = {\r\n gestureId: -1,\r\n handlerTag: -1,\r\n isWorklet: [],\r\n };\r\n\r\n constructor() {\r\n super();\r\n\r\n // Used to check whether the gesture config has been updated when wrapping it\r\n // with `useMemo`. Since every config will have a unique id, when the dependencies\r\n // don't change, the config won't be recreated and the id will stay the same.\r\n // If the id is different, it means that the config has changed and the gesture\r\n // needs to be updated.\r\n this.gestureId = nextGestureId++;\r\n this.handlers.gestureId = this.gestureId;\r\n }\r\n\r\n private addDependency(\r\n key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',\r\n gesture: Exclude<GestureRef, number>\r\n ) {\r\n const value = this.config[key];\r\n this.config[key] = value\r\n ? Array<GestureRef>().concat(value, gesture)\r\n : [gesture];\r\n }\r\n\r\n withRef(ref: React.MutableRefObject<GestureType | undefined>) {\r\n this.config.ref = ref;\r\n return this;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/ban-types\r\n protected isWorklet(callback: Function) {\r\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\r\n return callback.__workletHash !== undefined;\r\n }\r\n\r\n onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\r\n this.handlers.onBegin = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);\r\n return this;\r\n }\r\n\r\n onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\r\n this.handlers.onStart = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);\r\n return this;\r\n }\r\n\r\n onEnd(\r\n callback: (\r\n event: GestureStateChangeEvent<EventPayloadT>,\r\n success: boolean\r\n ) => void\r\n ) {\r\n this.handlers.onEnd = callback;\r\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\r\n this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);\r\n return this;\r\n }\r\n\r\n onFinalize(\r\n callback: (\r\n event: GestureStateChangeEvent<EventPayloadT>,\r\n success: boolean\r\n ) => void\r\n ) {\r\n this.handlers.onFinalize = callback;\r\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\r\n this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);\r\n return this;\r\n }\r\n\r\n onTouchesDown(callback: TouchEventHandlerType) {\r\n this.config.needsPointerData = true;\r\n this.handlers.onTouchesDown = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] =\r\n this.isWorklet(callback);\r\n\r\n return this;\r\n }\r\n\r\n onTouchesMove(callback: TouchEventHandlerType) {\r\n this.config.needsPointerData = true;\r\n this.handlers.onTouchesMove = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] =\r\n this.isWorklet(callback);\r\n\r\n return this;\r\n }\r\n\r\n onTouchesUp(callback: TouchEventHandlerType) {\r\n this.config.needsPointerData = true;\r\n this.handlers.onTouchesUp = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] =\r\n this.isWorklet(callback);\r\n\r\n return this;\r\n }\r\n\r\n onTouchesCancelled(callback: TouchEventHandlerType) {\r\n this.config.needsPointerData = true;\r\n this.handlers.onTouchesCancelled = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] =\r\n this.isWorklet(callback);\r\n\r\n return this;\r\n }\r\n\r\n enabled(enabled: boolean) {\r\n this.config.enabled = enabled;\r\n return this;\r\n }\r\n\r\n shouldCancelWhenOutside(value: boolean) {\r\n this.config.shouldCancelWhenOutside = value;\r\n return this;\r\n }\r\n\r\n hitSlop(hitSlop: HitSlop) {\r\n this.config.hitSlop = hitSlop;\r\n return this;\r\n }\r\n\r\n activeCursor(activeCursor: ActiveCursor) {\r\n this.config.activeCursor = activeCursor;\r\n return this;\r\n }\r\n\r\n runOnJS(runOnJS: boolean) {\r\n this.config.runOnJS = runOnJS;\r\n return this;\r\n }\r\n\r\n simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\r\n for (const gesture of gestures) {\r\n this.addDependency('simultaneousWith', gesture);\r\n }\r\n return this;\r\n }\r\n\r\n requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]) {\r\n for (const gesture of gestures) {\r\n this.addDependency('requireToFail', gesture);\r\n }\r\n return this;\r\n }\r\n\r\n blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\r\n for (const gesture of gestures) {\r\n this.addDependency('blocksHandlers', gesture);\r\n }\r\n return this;\r\n }\r\n\r\n withTestId(id: string) {\r\n this.config.testId = id;\r\n return this;\r\n }\r\n\r\n cancelsTouchesInView(value: boolean) {\r\n this.config.cancelsTouchesInView = value;\r\n return this;\r\n }\r\n\r\n initialize() {\r\n this.handlerTag = getNextHandlerTag();\r\n\r\n this.handlers = { ...this.handlers, handlerTag: this.handlerTag };\r\n\r\n if (this.config.ref) {\r\n this.config.ref.current = this as GestureType;\r\n }\r\n }\r\n\r\n toGestureArray(): GestureType[] {\r\n return [this as GestureType];\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n prepare() {}\r\n\r\n get shouldUseReanimated(): boolean {\r\n // use Reanimated when runOnJS isn't set explicitly,\r\n // and all defined callbacks are worklets,\r\n // and remote debugging is disabled\r\n return (\r\n this.config.runOnJS !== true &&\r\n !this.handlers.isWorklet.includes(false) &&\r\n !isRemoteDebuggingEnabled()\r\n );\r\n }\r\n}\r\n\r\nexport abstract class ContinousBaseGesture<\r\n EventPayloadT extends Record<string, unknown>,\r\n EventChangePayloadT extends Record<string, unknown>\r\n> extends BaseGesture<EventPayloadT> {\r\n onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void) {\r\n this.handlers.onUpdate = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);\r\n return this;\r\n }\r\n\r\n onChange(\r\n callback: (\r\n event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>\r\n ) => void\r\n ) {\r\n this.handlers.onChange = callback;\r\n this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);\r\n return this;\r\n }\r\n\r\n manualActivation(manualActivation: boolean) {\r\n this.config.manualActivation = manualActivation;\r\n return this;\r\n }\r\n}\r\n"]}
|