@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,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.RotationGestureHandler = exports.rotationHandlerName = void 0;
|
7
|
+
|
8
|
+
var _createHandler = _interopRequireDefault(require("./createHandler"));
|
9
|
+
|
10
|
+
var _gestureHandlerCommon = require("./gestureHandlerCommon");
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
const rotationHandlerName = 'RotationGestureHandler';
|
15
|
+
exports.rotationHandlerName = rotationHandlerName;
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
17
|
+
const RotationGestureHandler = (0, _createHandler.default)({
|
18
|
+
name: rotationHandlerName,
|
19
|
+
allowedProps: _gestureHandlerCommon.baseGestureHandlerProps,
|
20
|
+
config: {}
|
21
|
+
});
|
22
|
+
exports.RotationGestureHandler = RotationGestureHandler;
|
23
|
+
//# sourceMappingURL=RotationGestureHandler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["RotationGestureHandler.ts"],"names":["rotationHandlerName","RotationGestureHandler","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAmCO,MAAMA,mBAAmB,GAAG,wBAA5B;;AAGP;AACO,MAAMC,sBAAsB,GAAG,4BAGpC;AACAC,EAAAA,IAAI,EAAEF,mBADN;AAEAG,EAAAA,YAAY,EAAEC,6CAFd;AAGAC,EAAAA,MAAM,EAAE;AAHR,CAHoC,CAA/B","sourcesContent":["import createHandler from './createHandler';\r\nimport {\r\n BaseGestureHandlerProps,\r\n baseGestureHandlerProps,\r\n} from './gestureHandlerCommon';\r\n\r\nexport type RotationGestureHandlerEventPayload = {\r\n /**\r\n * Amount rotated, expressed in radians, from the gesture's focal point\r\n * (anchor).\r\n */\r\n rotation: number;\r\n\r\n /**\r\n * X coordinate, expressed in points, of the gesture's central focal point\r\n * (anchor).\r\n */\r\n anchorX: number;\r\n\r\n /**\r\n * Y coordinate, expressed in points, of the gesture's central focal point\r\n * (anchor).\r\n */\r\n anchorY: number;\r\n\r\n /**\r\n *\r\n * Instantaneous velocity, expressed in point units per second, of the\r\n * gesture.\r\n */\r\n velocity: number;\r\n};\r\n\r\nexport interface RotationGestureHandlerProps\r\n extends BaseGestureHandlerProps<RotationGestureHandlerEventPayload> {}\r\n\r\nexport const rotationHandlerName = 'RotationGestureHandler';\r\n\r\nexport type RotationGestureHandler = typeof RotationGestureHandler;\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\r\nexport const RotationGestureHandler = createHandler<\r\n RotationGestureHandlerProps,\r\n RotationGestureHandlerEventPayload\r\n>({\r\n name: rotationHandlerName,\r\n allowedProps: baseGestureHandlerProps,\r\n config: {},\r\n});\r\n"]}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.TapGestureHandler = exports.tapHandlerName = exports.tapGestureHandlerProps = void 0;
|
7
|
+
|
8
|
+
var _createHandler = _interopRequireDefault(require("./createHandler"));
|
9
|
+
|
10
|
+
var _gestureHandlerCommon = require("./gestureHandlerCommon");
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
const tapGestureHandlerProps = ['maxDurationMs', 'maxDelayMs', 'numberOfTaps', 'maxDeltaX', 'maxDeltaY', 'maxDist', 'minPointers'];
|
15
|
+
exports.tapGestureHandlerProps = tapGestureHandlerProps;
|
16
|
+
const tapHandlerName = 'TapGestureHandler';
|
17
|
+
exports.tapHandlerName = tapHandlerName;
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
19
|
+
const TapGestureHandler = (0, _createHandler.default)({
|
20
|
+
name: tapHandlerName,
|
21
|
+
allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...tapGestureHandlerProps],
|
22
|
+
config: {
|
23
|
+
shouldCancelWhenOutside: true
|
24
|
+
}
|
25
|
+
});
|
26
|
+
exports.TapGestureHandler = TapGestureHandler;
|
27
|
+
//# sourceMappingURL=TapGestureHandler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["TapGestureHandler.ts"],"names":["tapGestureHandlerProps","tapHandlerName","TapGestureHandler","name","allowedProps","baseGestureHandlerProps","config","shouldCancelWhenOutside"],"mappings":";;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,sBAAsB,GAAG,CACpC,eADoC,EAEpC,YAFoC,EAGpC,cAHoC,EAIpC,WAJoC,EAKpC,WALoC,EAMpC,SANoC,EAOpC,aAPoC,CAA/B;;AAuEA,MAAMC,cAAc,GAAG,mBAAvB;;AAGP;AACO,MAAMC,iBAAiB,GAAG,4BAG/B;AACAC,EAAAA,IAAI,EAAEF,cADN;AAEAG,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGL,sBAFS,CAFd;AAMAM,EAAAA,MAAM,EAAE;AACNC,IAAAA,uBAAuB,EAAE;AADnB;AANR,CAH+B,CAA1B","sourcesContent":["import createHandler from './createHandler';\r\nimport {\r\n BaseGestureHandlerProps,\r\n baseGestureHandlerProps,\r\n} from './gestureHandlerCommon';\r\n\r\nexport const tapGestureHandlerProps = [\r\n 'maxDurationMs',\r\n 'maxDelayMs',\r\n 'numberOfTaps',\r\n 'maxDeltaX',\r\n 'maxDeltaY',\r\n 'maxDist',\r\n 'minPointers',\r\n] as const;\r\n\r\nexport type TapGestureHandlerEventPayload = {\r\n x: number;\r\n y: number;\r\n absoluteX: number;\r\n absoluteY: number;\r\n};\r\nexport interface TapGestureConfig {\r\n /**\r\n * Minimum number of pointers (fingers) required to be placed before the\r\n * handler activates. Should be a positive integer.\r\n * The default value is 1.\r\n */\r\n minPointers?: number;\r\n\r\n /**\r\n * Maximum time, expressed in milliseconds, that defines how fast a finger\r\n * must be released after a touch. The default value is 500.\r\n */\r\n maxDurationMs?: number;\r\n\r\n /**\r\n * Maximum time, expressed in milliseconds, that can pass before the next tap\r\n * if many taps are required. The default value is 500.\r\n */\r\n maxDelayMs?: number;\r\n\r\n /**\r\n * Number of tap gestures required to activate the handler. The default value\r\n * is 1.\r\n */\r\n numberOfTaps?: number;\r\n\r\n /**\r\n * Maximum distance, expressed in points, that defines how far the finger is\r\n * allowed to travel along the X axis during a tap gesture. If the finger\r\n * travels further than the defined distance along the X axis and the handler\r\n * hasn't yet activated, it will fail to recognize the gesture.\r\n */\r\n maxDeltaX?: number;\r\n\r\n /**\r\n * Maximum distance, expressed in points, that defines how far the finger is\r\n * allowed to travel along the Y axis during a tap gesture. If the finger\r\n * travels further than the defined distance along the Y axis and the handler\r\n * hasn't yet activated, it will fail to recognize the gesture.\r\n */\r\n maxDeltaY?: number;\r\n\r\n /**\r\n * Maximum distance, expressed in points, that defines how far the finger is\r\n * allowed to travel during a tap gesture. If the finger travels further than\r\n * the defined distance and the handler hasn't yet\r\n * activated, it will fail to recognize the gesture.\r\n */\r\n maxDist?: number;\r\n}\r\n\r\nexport interface TapGestureHandlerProps\r\n extends BaseGestureHandlerProps<TapGestureHandlerEventPayload>,\r\n TapGestureConfig {}\r\n\r\nexport const tapHandlerName = 'TapGestureHandler';\r\n\r\nexport type TapGestureHandler = typeof TapGestureHandler;\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\r\nexport const TapGestureHandler = createHandler<\r\n TapGestureHandlerProps,\r\n TapGestureHandlerEventPayload\r\n>({\r\n name: tapHandlerName,\r\n allowedProps: [\r\n ...baseGestureHandlerProps,\r\n ...tapGestureHandlerProps,\r\n ] as const,\r\n config: {\r\n shouldCancelWhenOutside: true,\r\n },\r\n});\r\n"]}
|
@@ -0,0 +1,464 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = createHandler;
|
7
|
+
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _reactNative = require("react-native");
|
11
|
+
|
12
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
13
|
+
|
14
|
+
var _RNGestureHandlerModule = _interopRequireDefault(require("../RNGestureHandlerModule"));
|
15
|
+
|
16
|
+
var _State = require("../State");
|
17
|
+
|
18
|
+
var _handlersRegistry = require("./handlersRegistry");
|
19
|
+
|
20
|
+
var _gestureHandlerCommon = require("./gestureHandlerCommon");
|
21
|
+
|
22
|
+
var _utils = require("../utils");
|
23
|
+
|
24
|
+
var _ActionType = require("../ActionType");
|
25
|
+
|
26
|
+
var _PressabilityDebugView = require("./PressabilityDebugView");
|
27
|
+
|
28
|
+
var _GestureHandlerRootViewContext = _interopRequireDefault(require("../GestureHandlerRootViewContext"));
|
29
|
+
|
30
|
+
var _ghQueueMicrotask = require("../ghQueueMicrotask");
|
31
|
+
|
32
|
+
var _UIManagerAny$getView, _UIManagerAny$getView2, _UIManagerAny$getCons;
|
33
|
+
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35
|
+
|
36
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
37
|
+
|
38
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
39
|
+
|
40
|
+
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; }
|
41
|
+
|
42
|
+
const UIManagerAny = _reactNative.UIManager;
|
43
|
+
const customGHEventsConfigFabricAndroid = {
|
44
|
+
topOnGestureHandlerEvent: {
|
45
|
+
registrationName: 'onGestureHandlerEvent'
|
46
|
+
},
|
47
|
+
topOnGestureHandlerStateChange: {
|
48
|
+
registrationName: 'onGestureHandlerStateChange'
|
49
|
+
}
|
50
|
+
};
|
51
|
+
const customGHEventsConfig = {
|
52
|
+
onGestureHandlerEvent: {
|
53
|
+
registrationName: 'onGestureHandlerEvent'
|
54
|
+
},
|
55
|
+
onGestureHandlerStateChange: {
|
56
|
+
registrationName: 'onGestureHandlerStateChange'
|
57
|
+
},
|
58
|
+
// When using React Native Gesture Handler for Animated.event with useNativeDriver: true
|
59
|
+
// on Android with Fabric enabled, the native part still sends the native events to JS
|
60
|
+
// but prefixed with "top". We cannot simply rename the events above so they are prefixed
|
61
|
+
// with "top" instead of "on" because in such case Animated.events would not be registered.
|
62
|
+
// That's why we need to register another pair of event names.
|
63
|
+
// The incoming events will be queued but never handled.
|
64
|
+
// Without this piece of code below, you'll get the following JS error:
|
65
|
+
// Unsupported top level event type "topOnGestureHandlerEvent" dispatched
|
66
|
+
...((0, _utils.isFabric)() && _reactNative.Platform.OS === 'android' && customGHEventsConfigFabricAndroid)
|
67
|
+
}; // Add gesture specific events to genericDirectEventTypes object exported from UIManager
|
68
|
+
// native module.
|
69
|
+
// Once new event types are registered with react it is possible to dispatch these
|
70
|
+
// events to all kind of native views.
|
71
|
+
|
72
|
+
UIManagerAny.genericDirectEventTypes = { ...UIManagerAny.genericDirectEventTypes,
|
73
|
+
...customGHEventsConfig
|
74
|
+
}; // In newer versions of RN the `genericDirectEventTypes` is located in the object
|
75
|
+
// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make
|
76
|
+
// it compatible with RN 61+
|
77
|
+
|
78
|
+
const UIManagerConstants = (_UIManagerAny$getView = (_UIManagerAny$getView2 = UIManagerAny.getViewManagerConfig) === null || _UIManagerAny$getView2 === void 0 ? void 0 : _UIManagerAny$getView2.call(UIManagerAny, 'getConstants')) !== null && _UIManagerAny$getView !== void 0 ? _UIManagerAny$getView : (_UIManagerAny$getCons = UIManagerAny.getConstants) === null || _UIManagerAny$getCons === void 0 ? void 0 : _UIManagerAny$getCons.call(UIManagerAny);
|
79
|
+
|
80
|
+
if (UIManagerConstants) {
|
81
|
+
UIManagerConstants.genericDirectEventTypes = { ...UIManagerConstants.genericDirectEventTypes,
|
82
|
+
...customGHEventsConfig
|
83
|
+
};
|
84
|
+
} // Wrap JS responder calls and notify gesture handler manager
|
85
|
+
|
86
|
+
|
87
|
+
const {
|
88
|
+
setJSResponder: oldSetJSResponder = () => {//no operation
|
89
|
+
},
|
90
|
+
clearJSResponder: oldClearJSResponder = () => {//no operation
|
91
|
+
}
|
92
|
+
} = UIManagerAny;
|
93
|
+
|
94
|
+
UIManagerAny.setJSResponder = (tag, blockNativeResponder) => {
|
95
|
+
_RNGestureHandlerModule.default.handleSetJSResponder(tag, blockNativeResponder);
|
96
|
+
|
97
|
+
oldSetJSResponder(tag, blockNativeResponder);
|
98
|
+
};
|
99
|
+
|
100
|
+
UIManagerAny.clearJSResponder = () => {
|
101
|
+
_RNGestureHandlerModule.default.handleClearJSResponder();
|
102
|
+
|
103
|
+
oldClearJSResponder();
|
104
|
+
};
|
105
|
+
|
106
|
+
let allowTouches = true;
|
107
|
+
const DEV_ON_ANDROID = __DEV__ && _reactNative.Platform.OS === 'android'; // Toggled inspector blocks touch events in order to allow inspecting on Android
|
108
|
+
// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component
|
109
|
+
|
110
|
+
if (DEV_ON_ANDROID) {
|
111
|
+
_reactNative.DeviceEventEmitter.addListener('toggleElementInspector', () => {
|
112
|
+
allowTouches = !allowTouches;
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
function hasUnresolvedRefs(props) {
|
117
|
+
// TODO(TS) - add type for extract arg
|
118
|
+
const extract = refs => {
|
119
|
+
if (!Array.isArray(refs)) {
|
120
|
+
return refs && refs.current === null;
|
121
|
+
}
|
122
|
+
|
123
|
+
return refs.some(r => r && r.current === null);
|
124
|
+
};
|
125
|
+
|
126
|
+
return extract(props['simultaneousHandlers']) || extract(props['waitFor']);
|
127
|
+
}
|
128
|
+
|
129
|
+
const stateToPropMappings = {
|
130
|
+
[_State.State.UNDETERMINED]: undefined,
|
131
|
+
[_State.State.BEGAN]: 'onBegan',
|
132
|
+
[_State.State.FAILED]: 'onFailed',
|
133
|
+
[_State.State.CANCELLED]: 'onCancelled',
|
134
|
+
[_State.State.ACTIVE]: 'onActivated',
|
135
|
+
[_State.State.END]: 'onEnded'
|
136
|
+
};
|
137
|
+
const UNRESOLVED_REFS_RETRY_LIMIT = 1; // TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
138
|
+
|
139
|
+
function createHandler({
|
140
|
+
name,
|
141
|
+
allowedProps = [],
|
142
|
+
config = {},
|
143
|
+
transformProps,
|
144
|
+
customNativeProps = []
|
145
|
+
}) {
|
146
|
+
class Handler extends React.Component {
|
147
|
+
constructor(props) {
|
148
|
+
super(props);
|
149
|
+
|
150
|
+
_defineProperty(this, "handlerTag", void 0);
|
151
|
+
|
152
|
+
_defineProperty(this, "config", void 0);
|
153
|
+
|
154
|
+
_defineProperty(this, "propsRef", void 0);
|
155
|
+
|
156
|
+
_defineProperty(this, "isMountedRef", void 0);
|
157
|
+
|
158
|
+
_defineProperty(this, "viewNode", void 0);
|
159
|
+
|
160
|
+
_defineProperty(this, "viewTag", void 0);
|
161
|
+
|
162
|
+
_defineProperty(this, "inspectorToggleListener", void 0);
|
163
|
+
|
164
|
+
_defineProperty(this, "onGestureHandlerEvent", event => {
|
165
|
+
if (event.nativeEvent.handlerTag === this.handlerTag) {
|
166
|
+
if (typeof this.props.onGestureEvent === 'function') {
|
167
|
+
var _this$props$onGesture, _this$props;
|
168
|
+
|
169
|
+
(_this$props$onGesture = (_this$props = this.props).onGestureEvent) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props, event);
|
170
|
+
}
|
171
|
+
} else {
|
172
|
+
var _this$props$onGesture2, _this$props2;
|
173
|
+
|
174
|
+
(_this$props$onGesture2 = (_this$props2 = this.props).onGestureHandlerEvent) === null || _this$props$onGesture2 === void 0 ? void 0 : _this$props$onGesture2.call(_this$props2, event);
|
175
|
+
}
|
176
|
+
});
|
177
|
+
|
178
|
+
_defineProperty(this, "onGestureHandlerStateChange", event => {
|
179
|
+
if (event.nativeEvent.handlerTag === this.handlerTag) {
|
180
|
+
if (typeof this.props.onHandlerStateChange === 'function') {
|
181
|
+
var _this$props$onHandler, _this$props3;
|
182
|
+
|
183
|
+
(_this$props$onHandler = (_this$props3 = this.props).onHandlerStateChange) === null || _this$props$onHandler === void 0 ? void 0 : _this$props$onHandler.call(_this$props3, event);
|
184
|
+
}
|
185
|
+
|
186
|
+
const state = event.nativeEvent.state;
|
187
|
+
const stateEventName = stateToPropMappings[state];
|
188
|
+
const eventHandler = stateEventName && this.props[stateEventName];
|
189
|
+
|
190
|
+
if (eventHandler && typeof eventHandler === 'function') {
|
191
|
+
eventHandler(event);
|
192
|
+
}
|
193
|
+
} else {
|
194
|
+
var _this$props$onGesture3, _this$props4;
|
195
|
+
|
196
|
+
(_this$props$onGesture3 = (_this$props4 = this.props).onGestureHandlerStateChange) === null || _this$props$onGesture3 === void 0 ? void 0 : _this$props$onGesture3.call(_this$props4, event);
|
197
|
+
}
|
198
|
+
});
|
199
|
+
|
200
|
+
_defineProperty(this, "refHandler", node => {
|
201
|
+
this.viewNode = node;
|
202
|
+
const child = React.Children.only(this.props.children); // TODO(TS) fix ref type
|
203
|
+
|
204
|
+
const {
|
205
|
+
ref
|
206
|
+
} = child;
|
207
|
+
|
208
|
+
if (ref !== null) {
|
209
|
+
if (typeof ref === 'function') {
|
210
|
+
ref(node);
|
211
|
+
} else {
|
212
|
+
ref.current = node;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
});
|
216
|
+
|
217
|
+
_defineProperty(this, "createGestureHandler", newConfig => {
|
218
|
+
this.config = newConfig;
|
219
|
+
|
220
|
+
_RNGestureHandlerModule.default.createGestureHandler(name, this.handlerTag, newConfig);
|
221
|
+
});
|
222
|
+
|
223
|
+
_defineProperty(this, "attachGestureHandler", newViewTag => {
|
224
|
+
this.viewTag = newViewTag;
|
225
|
+
|
226
|
+
if (_reactNative.Platform.OS === 'web') {
|
227
|
+
// typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
|
228
|
+
_RNGestureHandlerModule.default.attachGestureHandler(this.handlerTag, newViewTag, _ActionType.ActionType.JS_FUNCTION_OLD_API, // ignored on web
|
229
|
+
this.propsRef);
|
230
|
+
} else {
|
231
|
+
(0, _handlersRegistry.registerOldGestureHandler)(this.handlerTag, {
|
232
|
+
onGestureEvent: this.onGestureHandlerEvent,
|
233
|
+
onGestureStateChange: this.onGestureHandlerStateChange
|
234
|
+
});
|
235
|
+
|
236
|
+
const actionType = (() => {
|
237
|
+
var _this$props5, _this$props6, _this$props7;
|
238
|
+
|
239
|
+
if ((_this$props5 = this.props) !== null && _this$props5 !== void 0 && _this$props5.onGestureEvent && 'current' in this.props.onGestureEvent || (_this$props6 = this.props) !== null && _this$props6 !== void 0 && _this$props6.onHandlerStateChange && 'current' in this.props.onHandlerStateChange) {
|
240
|
+
// Reanimated worklet
|
241
|
+
return _ActionType.ActionType.REANIMATED_WORKLET;
|
242
|
+
} else if ((_this$props7 = this.props) !== null && _this$props7 !== void 0 && _this$props7.onGestureEvent && '__isNative' in this.props.onGestureEvent) {
|
243
|
+
// Animated.event with useNativeDriver: true
|
244
|
+
return _ActionType.ActionType.NATIVE_ANIMATED_EVENT;
|
245
|
+
} else {
|
246
|
+
// JS callback or Animated.event with useNativeDriver: false
|
247
|
+
return _ActionType.ActionType.JS_FUNCTION_OLD_API;
|
248
|
+
}
|
249
|
+
})();
|
250
|
+
|
251
|
+
_RNGestureHandlerModule.default.attachGestureHandler(this.handlerTag, newViewTag, actionType);
|
252
|
+
}
|
253
|
+
|
254
|
+
(0, _gestureHandlerCommon.scheduleFlushOperations)();
|
255
|
+
});
|
256
|
+
|
257
|
+
_defineProperty(this, "updateGestureHandler", newConfig => {
|
258
|
+
this.config = newConfig;
|
259
|
+
|
260
|
+
_RNGestureHandlerModule.default.updateGestureHandler(this.handlerTag, newConfig);
|
261
|
+
|
262
|
+
(0, _gestureHandlerCommon.scheduleFlushOperations)();
|
263
|
+
});
|
264
|
+
|
265
|
+
this.handlerTag = (0, _handlersRegistry.getNextHandlerTag)();
|
266
|
+
this.config = {};
|
267
|
+
this.propsRef = /*#__PURE__*/React.createRef();
|
268
|
+
this.isMountedRef = /*#__PURE__*/React.createRef();
|
269
|
+
this.state = {
|
270
|
+
allowTouches
|
271
|
+
};
|
272
|
+
|
273
|
+
if (props.id) {
|
274
|
+
if (_handlersRegistry.handlerIDToTag[props.id] !== undefined) {
|
275
|
+
throw new Error(`Handler with ID "${props.id}" already registered`);
|
276
|
+
}
|
277
|
+
|
278
|
+
_handlersRegistry.handlerIDToTag[props.id] = this.handlerTag;
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
componentDidMount() {
|
283
|
+
const props = this.props;
|
284
|
+
this.isMountedRef.current = true;
|
285
|
+
|
286
|
+
if (DEV_ON_ANDROID) {
|
287
|
+
this.inspectorToggleListener = _reactNative.DeviceEventEmitter.addListener('toggleElementInspector', () => {
|
288
|
+
this.setState(_ => ({
|
289
|
+
allowTouches
|
290
|
+
}));
|
291
|
+
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
292
|
+
});
|
293
|
+
}
|
294
|
+
|
295
|
+
if (hasUnresolvedRefs(props)) {
|
296
|
+
// If there are unresolved refs (e.g. ".current" has not yet been set)
|
297
|
+
// passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to
|
298
|
+
// _update method that will try to update native handler props using
|
299
|
+
// queueMicrotask. This makes it so update() function gets called after all
|
300
|
+
// react components are mounted and we expect the missing ref object to
|
301
|
+
// be resolved by then.
|
302
|
+
(0, _ghQueueMicrotask.ghQueueMicrotask)(() => {
|
303
|
+
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
304
|
+
});
|
305
|
+
}
|
306
|
+
|
307
|
+
this.createGestureHandler((0, _gestureHandlerCommon.filterConfig)(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config));
|
308
|
+
this.attachGestureHandler((0, _gestureHandlerCommon.findNodeHandle)(this.viewNode)); // TODO(TS) - check if this can be null
|
309
|
+
}
|
310
|
+
|
311
|
+
componentDidUpdate() {
|
312
|
+
const viewTag = (0, _gestureHandlerCommon.findNodeHandle)(this.viewNode);
|
313
|
+
|
314
|
+
if (this.viewTag !== viewTag) {
|
315
|
+
this.attachGestureHandler(viewTag); // TODO(TS) - check interaction between _viewTag & findNodeHandle
|
316
|
+
}
|
317
|
+
|
318
|
+
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
319
|
+
}
|
320
|
+
|
321
|
+
componentWillUnmount() {
|
322
|
+
var _this$inspectorToggle;
|
323
|
+
|
324
|
+
(_this$inspectorToggle = this.inspectorToggleListener) === null || _this$inspectorToggle === void 0 ? void 0 : _this$inspectorToggle.remove();
|
325
|
+
this.isMountedRef.current = false;
|
326
|
+
|
327
|
+
_RNGestureHandlerModule.default.dropGestureHandler(this.handlerTag);
|
328
|
+
|
329
|
+
(0, _gestureHandlerCommon.scheduleFlushOperations)(); // We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context
|
330
|
+
|
331
|
+
const handlerID = this.props.id;
|
332
|
+
|
333
|
+
if (handlerID) {
|
334
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
335
|
+
delete _handlersRegistry.handlerIDToTag[handlerID];
|
336
|
+
}
|
337
|
+
}
|
338
|
+
|
339
|
+
update(remainingTries) {
|
340
|
+
if (!this.isMountedRef.current) {
|
341
|
+
return;
|
342
|
+
}
|
343
|
+
|
344
|
+
const props = this.props; // When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of
|
345
|
+
// `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying
|
346
|
+
// again is easy enough fix.
|
347
|
+
|
348
|
+
if (hasUnresolvedRefs(props) && remainingTries > 0) {
|
349
|
+
(0, _ghQueueMicrotask.ghQueueMicrotask)(() => {
|
350
|
+
this.update(remainingTries - 1);
|
351
|
+
});
|
352
|
+
} else {
|
353
|
+
const newConfig = (0, _gestureHandlerCommon.filterConfig)(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config);
|
354
|
+
|
355
|
+
if (!(0, _isEqual.default)(this.config, newConfig)) {
|
356
|
+
this.updateGestureHandler(newConfig);
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
|
361
|
+
setNativeProps(updates) {
|
362
|
+
const mergedProps = { ...this.props,
|
363
|
+
...updates
|
364
|
+
};
|
365
|
+
const newConfig = (0, _gestureHandlerCommon.filterConfig)(transformProps ? transformProps(mergedProps) : mergedProps, [...allowedProps, ...customNativeProps], config);
|
366
|
+
this.updateGestureHandler(newConfig);
|
367
|
+
}
|
368
|
+
|
369
|
+
render() {
|
370
|
+
var _this$props$testID;
|
371
|
+
|
372
|
+
if (__DEV__ && !this.context && !(0, _utils.isJestEnv)() && _reactNative.Platform.OS !== 'web') {
|
373
|
+
throw new Error(name + ' 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.');
|
374
|
+
}
|
375
|
+
|
376
|
+
let gestureEventHandler = this.onGestureHandlerEvent; // Another instance of https://github.com/microsoft/TypeScript/issues/13995
|
377
|
+
|
378
|
+
const {
|
379
|
+
onGestureEvent,
|
380
|
+
onGestureHandlerEvent
|
381
|
+
} = this.props;
|
382
|
+
|
383
|
+
if (onGestureEvent && typeof onGestureEvent !== 'function') {
|
384
|
+
// If it's not a method it should be an native Animated.event
|
385
|
+
// object. We set it directly as the handler for the view
|
386
|
+
// In this case nested handlers are not going to be supported
|
387
|
+
if (onGestureHandlerEvent) {
|
388
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
389
|
+
}
|
390
|
+
|
391
|
+
gestureEventHandler = onGestureEvent;
|
392
|
+
} else {
|
393
|
+
if (onGestureHandlerEvent && typeof onGestureHandlerEvent !== 'function') {
|
394
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
let gestureStateEventHandler = this.onGestureHandlerStateChange; // Another instance of https://github.com/microsoft/TypeScript/issues/13995
|
399
|
+
|
400
|
+
const {
|
401
|
+
onHandlerStateChange,
|
402
|
+
onGestureHandlerStateChange
|
403
|
+
} = this.props;
|
404
|
+
|
405
|
+
if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {
|
406
|
+
// If it's not a method it should be an native Animated.event
|
407
|
+
// object. We set it directly as the handler for the view
|
408
|
+
// In this case nested handlers are not going to be supported
|
409
|
+
if (onGestureHandlerStateChange) {
|
410
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
411
|
+
}
|
412
|
+
|
413
|
+
gestureStateEventHandler = onHandlerStateChange;
|
414
|
+
} else {
|
415
|
+
if (onGestureHandlerStateChange && typeof onGestureHandlerStateChange !== 'function') {
|
416
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
417
|
+
}
|
418
|
+
}
|
419
|
+
|
420
|
+
const events = {
|
421
|
+
onGestureHandlerEvent: this.state.allowTouches ? gestureEventHandler : undefined,
|
422
|
+
onGestureHandlerStateChange: this.state.allowTouches ? gestureStateEventHandler : undefined
|
423
|
+
};
|
424
|
+
this.propsRef.current = events;
|
425
|
+
let child = null;
|
426
|
+
|
427
|
+
try {
|
428
|
+
child = React.Children.only(this.props.children);
|
429
|
+
} catch (e) {
|
430
|
+
throw new Error((0, _utils.tagMessage)(`${name} 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.`));
|
431
|
+
}
|
432
|
+
|
433
|
+
let grandChildren = child.props.children;
|
434
|
+
|
435
|
+
if (__DEV__ && child.type && (child.type === 'RNGestureHandlerButton' || child.type.name === 'View' || child.type.displayName === 'View')) {
|
436
|
+
grandChildren = React.Children.toArray(grandChildren);
|
437
|
+
grandChildren.push( /*#__PURE__*/React.createElement(_PressabilityDebugView.PressabilityDebugView, {
|
438
|
+
key: "pressabilityDebugView",
|
439
|
+
color: "mediumspringgreen",
|
440
|
+
hitSlop: child.props.hitSlop
|
441
|
+
}));
|
442
|
+
}
|
443
|
+
|
444
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
445
|
+
ref: this.refHandler,
|
446
|
+
collapsable: false,
|
447
|
+
...((0, _utils.isJestEnv)() ? {
|
448
|
+
handlerType: name,
|
449
|
+
handlerTag: this.handlerTag
|
450
|
+
} : {}),
|
451
|
+
testID: (_this$props$testID = this.props.testID) !== null && _this$props$testID !== void 0 ? _this$props$testID : child.props.testID,
|
452
|
+
...events
|
453
|
+
}, grandChildren);
|
454
|
+
}
|
455
|
+
|
456
|
+
}
|
457
|
+
|
458
|
+
_defineProperty(Handler, "displayName", name);
|
459
|
+
|
460
|
+
_defineProperty(Handler, "contextType", _GestureHandlerRootViewContext.default);
|
461
|
+
|
462
|
+
return Handler;
|
463
|
+
}
|
464
|
+
//# sourceMappingURL=createHandler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["createHandler.tsx"],"names":["UIManagerAny","UIManager","customGHEventsConfigFabricAndroid","topOnGestureHandlerEvent","registrationName","topOnGestureHandlerStateChange","customGHEventsConfig","onGestureHandlerEvent","onGestureHandlerStateChange","Platform","OS","genericDirectEventTypes","UIManagerConstants","getViewManagerConfig","getConstants","setJSResponder","oldSetJSResponder","clearJSResponder","oldClearJSResponder","tag","blockNativeResponder","RNGestureHandlerModule","handleSetJSResponder","handleClearJSResponder","allowTouches","DEV_ON_ANDROID","__DEV__","DeviceEventEmitter","addListener","hasUnresolvedRefs","props","extract","refs","Array","isArray","current","some","r","stateToPropMappings","State","UNDETERMINED","undefined","BEGAN","FAILED","CANCELLED","ACTIVE","END","UNRESOLVED_REFS_RETRY_LIMIT","createHandler","name","allowedProps","config","transformProps","customNativeProps","Handler","React","Component","constructor","event","nativeEvent","handlerTag","onGestureEvent","onHandlerStateChange","state","stateEventName","eventHandler","node","viewNode","child","Children","only","children","ref","newConfig","createGestureHandler","newViewTag","viewTag","attachGestureHandler","ActionType","JS_FUNCTION_OLD_API","propsRef","onGestureStateChange","actionType","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","updateGestureHandler","createRef","isMountedRef","id","handlerIDToTag","Error","componentDidMount","inspectorToggleListener","setState","_","update","componentDidUpdate","componentWillUnmount","remove","dropGestureHandler","handlerID","remainingTries","setNativeProps","updates","mergedProps","render","context","gestureEventHandler","gestureStateEventHandler","events","e","grandChildren","type","displayName","toArray","push","hitSlop","cloneElement","refHandler","collapsable","handlerType","testID","GestureHandlerRootViewContext"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AACA;;AAEA;;AACA;;AAMA;;AASA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,sBAArB;AAEA,MAAMC,iCAAiC,GAAG;AACxCC,EAAAA,wBAAwB,EAAE;AAAEC,IAAAA,gBAAgB,EAAE;AAApB,GADc;AAEx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,KAAK,CAAC4C,IAAN,KAAe,wBAAf,IACC5C,KAAK,CAAC4C,IAAN,CAAW/D,IAAX,KAAoB,MADrB,IAECmB,KAAK,CAAC4C,IAAN,CAAWC,WAAX,KAA2B,MAJ7B,CADF,EAME;AACAF,QAAAA,aAAa,GAAGxD,KAAK,CAACc,QAAN,CAAe6C,OAAf,CAAuBH,aAAvB,CAAhB;AACAA,QAAAA,aAAa,CAACI,IAAd,eACE,oBAAC,4CAAD;AACE,UAAA,GAAG,EAAC,uBADN;AAEE,UAAA,KAAK,EAAC,mBAFR;AAGE,UAAA,OAAO,EAAE/C,KAAK,CAACtC,KAAN,CAAYsF;AAHvB,UADF;AAOD;;AAED,0BAAO7D,KAAK,CAAC8D,YAAN,CACLjD,KADK,EAEL;AACEI,QAAAA,GAAG,EAAE,KAAK8C,UADZ;AAEEC,QAAAA,WAAW,EAAE,KAFf;AAGE,YAAI,0BACA;AACEC,UAAAA,WAAW,EAAEvE,IADf;AAEEW,UAAAA,UAAU,EAAE,KAAKA;AAFnB,SADA,GAKA,EALJ,CAHF;AASE6D,QAAAA,MAAM,wBAAE,KAAK3F,KAAL,CAAW2F,MAAb,mEAAuBrD,KAAK,CAACtC,KAAN,CAAY2F,MAT3C;AAUE,WAAGZ;AAVL,OAFK,EAcLE,aAdK,CAAP;AAgBD;;AAvWD;;AAPwE,kBAIpEzD,OAJoE,iBAQnDL,IARmD;;AAAA,kBAIpEK,OAJoE,iBASnDoE,sCATmD;;AAgX1E,SAAOpE,OAAP;AACD","sourcesContent":["import * as React from 'react';\r\nimport {\r\n Platform,\r\n UIManager,\r\n DeviceEventEmitter,\r\n EmitterSubscription,\r\n} from 'react-native';\r\n// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types\r\nimport deepEqual from 'lodash/isEqual';\r\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\r\nimport type RNGestureHandlerModuleWeb from '../RNGestureHandlerModule.web';\r\nimport { State } from '../State';\r\nimport {\r\n handlerIDToTag,\r\n getNextHandlerTag,\r\n registerOldGestureHandler,\r\n} from './handlersRegistry';\r\n\r\nimport {\r\n BaseGestureHandlerProps,\r\n filterConfig,\r\n GestureEvent,\r\n HandlerStateChangeEvent,\r\n findNodeHandle,\r\n scheduleFlushOperations,\r\n} from './gestureHandlerCommon';\r\nimport { ValueOf } from '../typeUtils';\r\nimport { isFabric, isJestEnv, tagMessage } from '../utils';\r\nimport { ActionType } from '../ActionType';\r\nimport { PressabilityDebugView } from './PressabilityDebugView';\r\nimport GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';\r\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\r\n\r\nconst UIManagerAny = UIManager as any;\r\n\r\nconst customGHEventsConfigFabricAndroid = {\r\n topOnGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\r\n topOnGestureHandlerStateChange: {\r\n registrationName: 'onGestureHandlerStateChange',\r\n },\r\n};\r\n\r\nconst customGHEventsConfig = {\r\n onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\r\n onGestureHandlerStateChange: {\r\n registrationName: 'onGestureHandlerStateChange',\r\n },\r\n\r\n // When using React Native Gesture Handler for Animated.event with useNativeDriver: true\r\n // on Android with Fabric enabled, the native part still sends the native events to JS\r\n // but prefixed with \"top\". We cannot simply rename the events above so they are prefixed\r\n // with \"top\" instead of \"on\" because in such case Animated.events would not be registered.\r\n // That's why we need to register another pair of event names.\r\n // The incoming events will be queued but never handled.\r\n // Without this piece of code below, you'll get the following JS error:\r\n // Unsupported top level event type \"topOnGestureHandlerEvent\" dispatched\r\n ...(isFabric() &&\r\n Platform.OS === 'android' &&\r\n customGHEventsConfigFabricAndroid),\r\n};\r\n\r\n// Add gesture specific events to genericDirectEventTypes object exported from UIManager\r\n// native module.\r\n// Once new event types are registered with react it is possible to dispatch these\r\n// events to all kind of native views.\r\nUIManagerAny.genericDirectEventTypes = {\r\n ...UIManagerAny.genericDirectEventTypes,\r\n ...customGHEventsConfig,\r\n};\r\n// In newer versions of RN the `genericDirectEventTypes` is located in the object\r\n// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make\r\n// it compatible with RN 61+\r\nconst UIManagerConstants =\r\n UIManagerAny.getViewManagerConfig?.('getConstants') ??\r\n UIManagerAny.getConstants?.();\r\n\r\nif (UIManagerConstants) {\r\n UIManagerConstants.genericDirectEventTypes = {\r\n ...UIManagerConstants.genericDirectEventTypes,\r\n ...customGHEventsConfig,\r\n };\r\n}\r\n\r\n// Wrap JS responder calls and notify gesture handler manager\r\nconst {\r\n setJSResponder: oldSetJSResponder = () => {\r\n //no operation\r\n },\r\n clearJSResponder: oldClearJSResponder = () => {\r\n //no operation\r\n },\r\n} = UIManagerAny;\r\nUIManagerAny.setJSResponder = (tag: number, blockNativeResponder: boolean) => {\r\n RNGestureHandlerModule.handleSetJSResponder(tag, blockNativeResponder);\r\n oldSetJSResponder(tag, blockNativeResponder);\r\n};\r\nUIManagerAny.clearJSResponder = () => {\r\n RNGestureHandlerModule.handleClearJSResponder();\r\n oldClearJSResponder();\r\n};\r\n\r\nlet allowTouches = true;\r\nconst DEV_ON_ANDROID = __DEV__ && Platform.OS === 'android';\r\n// Toggled inspector blocks touch events in order to allow inspecting on Android\r\n// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component\r\nif (DEV_ON_ANDROID) {\r\n DeviceEventEmitter.addListener('toggleElementInspector', () => {\r\n allowTouches = !allowTouches;\r\n });\r\n}\r\n\r\ntype HandlerProps<T extends Record<string, unknown>> = Readonly<\r\n React.PropsWithChildren<BaseGestureHandlerProps<T>>\r\n>;\r\nfunction hasUnresolvedRefs<T extends Record<string, unknown>>(\r\n props: HandlerProps<T>\r\n) {\r\n // TODO(TS) - add type for extract arg\r\n const extract = (refs: any | any[]) => {\r\n if (!Array.isArray(refs)) {\r\n return refs && refs.current === null;\r\n }\r\n return refs.some((r) => r && r.current === null);\r\n };\r\n return extract(props['simultaneousHandlers']) || extract(props['waitFor']);\r\n}\r\n\r\nconst stateToPropMappings = {\r\n [State.UNDETERMINED]: undefined,\r\n [State.BEGAN]: 'onBegan',\r\n [State.FAILED]: 'onFailed',\r\n [State.CANCELLED]: 'onCancelled',\r\n [State.ACTIVE]: 'onActivated',\r\n [State.END]: 'onEnded',\r\n} as const;\r\n\r\ntype CreateHandlerArgs<HandlerPropsT extends Record<string, unknown>> =\r\n Readonly<{\r\n name: string;\r\n allowedProps: Readonly<Extract<keyof HandlerPropsT, string>[]>;\r\n config: Readonly<Record<string, unknown>>;\r\n transformProps?: (props: HandlerPropsT) => HandlerPropsT;\r\n customNativeProps?: Readonly<string[]>;\r\n }>;\r\n\r\n// TODO(TS) fix event types\r\ntype InternalEventHandlers = {\r\n onGestureHandlerEvent?: (event: any) => void;\r\n onGestureHandlerStateChange?: (event: any) => void;\r\n};\r\n\r\nconst UNRESOLVED_REFS_RETRY_LIMIT = 1;\r\n\r\n// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.\r\nexport default function createHandler<\r\n T extends BaseGestureHandlerProps<U>,\r\n U extends Record<string, unknown>\r\n>({\r\n name,\r\n allowedProps = [],\r\n config = {},\r\n transformProps,\r\n customNativeProps = [],\r\n}: CreateHandlerArgs<T>): React.ComponentType<T & React.RefAttributes<any>> {\r\n interface HandlerState {\r\n allowTouches: boolean;\r\n }\r\n class Handler extends React.Component<\r\n T & InternalEventHandlers,\r\n HandlerState\r\n > {\r\n static displayName = name;\r\n static contextType = GestureHandlerRootViewContext;\r\n\r\n private handlerTag: number;\r\n private config: Record<string, unknown>;\r\n private propsRef: React.MutableRefObject<unknown>;\r\n private isMountedRef: React.MutableRefObject<boolean | null>;\r\n private viewNode: any;\r\n private viewTag?: number;\r\n private inspectorToggleListener?: EmitterSubscription;\r\n\r\n constructor(props: T & InternalEventHandlers) {\r\n super(props);\r\n this.handlerTag = getNextHandlerTag();\r\n this.config = {};\r\n this.propsRef = React.createRef();\r\n this.isMountedRef = React.createRef();\r\n this.state = { allowTouches };\r\n if (props.id) {\r\n if (handlerIDToTag[props.id] !== undefined) {\r\n throw new Error(`Handler with ID \"${props.id}\" already registered`);\r\n }\r\n handlerIDToTag[props.id] = this.handlerTag;\r\n }\r\n }\r\n\r\n componentDidMount() {\r\n const props: HandlerProps<U> = this.props;\r\n this.isMountedRef.current = true;\r\n\r\n if (DEV_ON_ANDROID) {\r\n this.inspectorToggleListener = DeviceEventEmitter.addListener(\r\n 'toggleElementInspector',\r\n () => {\r\n this.setState((_) => ({ allowTouches }));\r\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\r\n }\r\n );\r\n }\r\n if (hasUnresolvedRefs(props)) {\r\n // If there are unresolved refs (e.g. \".current\" has not yet been set)\r\n // passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to\r\n // _update method that will try to update native handler props using\r\n // queueMicrotask. This makes it so update() function gets called after all\r\n // react components are mounted and we expect the missing ref object to\r\n // be resolved by then.\r\n ghQueueMicrotask(() => {\r\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\r\n });\r\n }\r\n\r\n this.createGestureHandler(\r\n filterConfig(\r\n transformProps ? transformProps(this.props) : this.props,\r\n [...allowedProps, ...customNativeProps],\r\n config\r\n )\r\n );\r\n\r\n this.attachGestureHandler(findNodeHandle(this.viewNode) as number); // TODO(TS) - check if this can be null\r\n }\r\n\r\n componentDidUpdate() {\r\n const viewTag = findNodeHandle(this.viewNode);\r\n if (this.viewTag !== viewTag) {\r\n this.attachGestureHandler(viewTag as number); // TODO(TS) - check interaction between _viewTag & findNodeHandle\r\n }\r\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\r\n }\r\n\r\n componentWillUnmount() {\r\n this.inspectorToggleListener?.remove();\r\n this.isMountedRef.current = false;\r\n RNGestureHandlerModule.dropGestureHandler(this.handlerTag);\r\n scheduleFlushOperations();\r\n // We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context\r\n const handlerID: string | undefined = this.props.id;\r\n if (handlerID) {\r\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\r\n delete handlerIDToTag[handlerID];\r\n }\r\n }\r\n\r\n private onGestureHandlerEvent = (event: GestureEvent<U>) => {\r\n if (event.nativeEvent.handlerTag === this.handlerTag) {\r\n if (typeof this.props.onGestureEvent === 'function') {\r\n this.props.onGestureEvent?.(event);\r\n }\r\n } else {\r\n this.props.onGestureHandlerEvent?.(event);\r\n }\r\n };\r\n\r\n // TODO(TS) - make sure this is right type for event\r\n private onGestureHandlerStateChange = (\r\n event: HandlerStateChangeEvent<U>\r\n ) => {\r\n if (event.nativeEvent.handlerTag === this.handlerTag) {\r\n if (typeof this.props.onHandlerStateChange === 'function') {\r\n this.props.onHandlerStateChange?.(event);\r\n }\r\n\r\n const state: ValueOf<typeof State> = event.nativeEvent.state;\r\n const stateEventName = stateToPropMappings[state];\r\n const eventHandler = stateEventName && this.props[stateEventName];\r\n if (eventHandler && typeof eventHandler === 'function') {\r\n eventHandler(event);\r\n }\r\n } else {\r\n this.props.onGestureHandlerStateChange?.(event);\r\n }\r\n };\r\n\r\n private refHandler = (node: any) => {\r\n this.viewNode = node;\r\n\r\n const child = React.Children.only(this.props.children);\r\n // TODO(TS) fix ref type\r\n const { ref }: any = child;\r\n if (ref !== null) {\r\n if (typeof ref === 'function') {\r\n ref(node);\r\n } else {\r\n ref.current = node;\r\n }\r\n }\r\n };\r\n\r\n private createGestureHandler = (\r\n newConfig: Readonly<Record<string, unknown>>\r\n ) => {\r\n this.config = newConfig;\r\n\r\n RNGestureHandlerModule.createGestureHandler(\r\n name,\r\n this.handlerTag,\r\n newConfig\r\n );\r\n };\r\n\r\n private attachGestureHandler = (newViewTag: number) => {\r\n this.viewTag = newViewTag;\r\n\r\n if (Platform.OS === 'web') {\r\n // typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch\r\n (\r\n RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler\r\n )(\r\n this.handlerTag,\r\n newViewTag,\r\n ActionType.JS_FUNCTION_OLD_API, // ignored on web\r\n this.propsRef\r\n );\r\n } else {\r\n registerOldGestureHandler(this.handlerTag, {\r\n onGestureEvent: this.onGestureHandlerEvent,\r\n onGestureStateChange: this.onGestureHandlerStateChange,\r\n });\r\n\r\n const actionType = (() => {\r\n if (\r\n (this.props?.onGestureEvent &&\r\n 'current' in this.props.onGestureEvent) ||\r\n (this.props?.onHandlerStateChange &&\r\n 'current' in this.props.onHandlerStateChange)\r\n ) {\r\n // Reanimated worklet\r\n return ActionType.REANIMATED_WORKLET;\r\n } else if (\r\n this.props?.onGestureEvent &&\r\n '__isNative' in this.props.onGestureEvent\r\n ) {\r\n // Animated.event with useNativeDriver: true\r\n return ActionType.NATIVE_ANIMATED_EVENT;\r\n } else {\r\n // JS callback or Animated.event with useNativeDriver: false\r\n return ActionType.JS_FUNCTION_OLD_API;\r\n }\r\n })();\r\n\r\n RNGestureHandlerModule.attachGestureHandler(\r\n this.handlerTag,\r\n newViewTag,\r\n actionType\r\n );\r\n }\r\n\r\n scheduleFlushOperations();\r\n };\r\n\r\n private updateGestureHandler = (\r\n newConfig: Readonly<Record<string, unknown>>\r\n ) => {\r\n this.config = newConfig;\r\n\r\n RNGestureHandlerModule.updateGestureHandler(this.handlerTag, newConfig);\r\n scheduleFlushOperations();\r\n };\r\n\r\n private update(remainingTries: number) {\r\n if (!this.isMountedRef.current) {\r\n return;\r\n }\r\n\r\n const props: HandlerProps<U> = this.props;\r\n\r\n // When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of\r\n // `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying\r\n // again is easy enough fix.\r\n if (hasUnresolvedRefs(props) && remainingTries > 0) {\r\n ghQueueMicrotask(() => {\r\n this.update(remainingTries - 1);\r\n });\r\n } else {\r\n const newConfig = filterConfig(\r\n transformProps ? transformProps(this.props) : this.props,\r\n [...allowedProps, ...customNativeProps],\r\n config\r\n );\r\n if (!deepEqual(this.config, newConfig)) {\r\n this.updateGestureHandler(newConfig);\r\n }\r\n }\r\n }\r\n\r\n setNativeProps(updates: any) {\r\n const mergedProps = { ...this.props, ...updates };\r\n const newConfig = filterConfig(\r\n transformProps ? transformProps(mergedProps) : mergedProps,\r\n [...allowedProps, ...customNativeProps],\r\n config\r\n );\r\n this.updateGestureHandler(newConfig);\r\n }\r\n\r\n render() {\r\n if (__DEV__ && !this.context && !isJestEnv() && Platform.OS !== 'web') {\r\n throw new Error(\r\n name +\r\n ' 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 let gestureEventHandler = this.onGestureHandlerEvent;\r\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\r\n type OnGestureEventHandlers = {\r\n onGestureEvent?: BaseGestureHandlerProps<U>['onGestureEvent'];\r\n onGestureHandlerEvent?: InternalEventHandlers['onGestureHandlerEvent'];\r\n };\r\n const { onGestureEvent, onGestureHandlerEvent }: OnGestureEventHandlers =\r\n this.props;\r\n if (onGestureEvent && typeof onGestureEvent !== 'function') {\r\n // If it's not a method it should be an native Animated.event\r\n // object. We set it directly as the handler for the view\r\n // In this case nested handlers are not going to be supported\r\n if (onGestureHandlerEvent) {\r\n throw new Error(\r\n 'Nesting touch handlers with native animated driver is not supported yet'\r\n );\r\n }\r\n gestureEventHandler = onGestureEvent;\r\n } else {\r\n if (\r\n onGestureHandlerEvent &&\r\n typeof onGestureHandlerEvent !== 'function'\r\n ) {\r\n throw new Error(\r\n 'Nesting touch handlers with native animated driver is not supported yet'\r\n );\r\n }\r\n }\r\n\r\n let gestureStateEventHandler = this.onGestureHandlerStateChange;\r\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\r\n type OnGestureStateChangeHandlers = {\r\n onHandlerStateChange?: BaseGestureHandlerProps<U>['onHandlerStateChange'];\r\n onGestureHandlerStateChange?: InternalEventHandlers['onGestureHandlerStateChange'];\r\n };\r\n const {\r\n onHandlerStateChange,\r\n onGestureHandlerStateChange,\r\n }: OnGestureStateChangeHandlers = this.props;\r\n if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {\r\n // If it's not a method it should be an native Animated.event\r\n // object. We set it directly as the handler for the view\r\n // In this case nested handlers are not going to be supported\r\n if (onGestureHandlerStateChange) {\r\n throw new Error(\r\n 'Nesting touch handlers with native animated driver is not supported yet'\r\n );\r\n }\r\n gestureStateEventHandler = onHandlerStateChange;\r\n } else {\r\n if (\r\n onGestureHandlerStateChange &&\r\n typeof onGestureHandlerStateChange !== 'function'\r\n ) {\r\n throw new Error(\r\n 'Nesting touch handlers with native animated driver is not supported yet'\r\n );\r\n }\r\n }\r\n const events = {\r\n onGestureHandlerEvent: this.state.allowTouches\r\n ? gestureEventHandler\r\n : undefined,\r\n onGestureHandlerStateChange: this.state.allowTouches\r\n ? gestureStateEventHandler\r\n : undefined,\r\n };\r\n\r\n this.propsRef.current = events;\r\n\r\n let child: any = null;\r\n try {\r\n child = React.Children.only(this.props.children);\r\n } catch (e) {\r\n throw new Error(\r\n tagMessage(\r\n `${name} 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 let grandChildren = child.props.children;\r\n if (\r\n __DEV__ &&\r\n child.type &&\r\n (child.type === 'RNGestureHandlerButton' ||\r\n child.type.name === 'View' ||\r\n child.type.displayName === 'View')\r\n ) {\r\n grandChildren = React.Children.toArray(grandChildren);\r\n grandChildren.push(\r\n <PressabilityDebugView\r\n key=\"pressabilityDebugView\"\r\n color=\"mediumspringgreen\"\r\n hitSlop={child.props.hitSlop}\r\n />\r\n );\r\n }\r\n\r\n return React.cloneElement(\r\n child,\r\n {\r\n ref: this.refHandler,\r\n collapsable: false,\r\n ...(isJestEnv()\r\n ? {\r\n handlerType: name,\r\n handlerTag: this.handlerTag,\r\n }\r\n : {}),\r\n testID: this.props.testID ?? child.props.testID,\r\n ...events,\r\n },\r\n grandChildren\r\n );\r\n }\r\n }\r\n return Handler;\r\n}\r\n"]}
|