@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,433 @@
|
|
1
|
+
var _UIManagerAny$getView, _UIManagerAny$getView2, _UIManagerAny$getCons;
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
import * as React from 'react';
|
6
|
+
import { Platform, UIManager, DeviceEventEmitter } from 'react-native'; // @ts-ignore - it isn't typed by TS & don't have definitelyTyped types
|
7
|
+
|
8
|
+
import deepEqual from 'lodash/isEqual';
|
9
|
+
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
10
|
+
import { State } from '../State';
|
11
|
+
import { handlerIDToTag, getNextHandlerTag, registerOldGestureHandler } from './handlersRegistry';
|
12
|
+
import { filterConfig, findNodeHandle, scheduleFlushOperations } from './gestureHandlerCommon';
|
13
|
+
import { isFabric, isJestEnv, tagMessage } from '../utils';
|
14
|
+
import { ActionType } from '../ActionType';
|
15
|
+
import { PressabilityDebugView } from './PressabilityDebugView';
|
16
|
+
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
17
|
+
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
18
|
+
const UIManagerAny = UIManager;
|
19
|
+
const customGHEventsConfigFabricAndroid = {
|
20
|
+
topOnGestureHandlerEvent: {
|
21
|
+
registrationName: 'onGestureHandlerEvent'
|
22
|
+
},
|
23
|
+
topOnGestureHandlerStateChange: {
|
24
|
+
registrationName: 'onGestureHandlerStateChange'
|
25
|
+
}
|
26
|
+
};
|
27
|
+
const customGHEventsConfig = {
|
28
|
+
onGestureHandlerEvent: {
|
29
|
+
registrationName: 'onGestureHandlerEvent'
|
30
|
+
},
|
31
|
+
onGestureHandlerStateChange: {
|
32
|
+
registrationName: 'onGestureHandlerStateChange'
|
33
|
+
},
|
34
|
+
// When using React Native Gesture Handler for Animated.event with useNativeDriver: true
|
35
|
+
// on Android with Fabric enabled, the native part still sends the native events to JS
|
36
|
+
// but prefixed with "top". We cannot simply rename the events above so they are prefixed
|
37
|
+
// with "top" instead of "on" because in such case Animated.events would not be registered.
|
38
|
+
// That's why we need to register another pair of event names.
|
39
|
+
// The incoming events will be queued but never handled.
|
40
|
+
// Without this piece of code below, you'll get the following JS error:
|
41
|
+
// Unsupported top level event type "topOnGestureHandlerEvent" dispatched
|
42
|
+
...(isFabric() && Platform.OS === 'android' && customGHEventsConfigFabricAndroid)
|
43
|
+
}; // Add gesture specific events to genericDirectEventTypes object exported from UIManager
|
44
|
+
// native module.
|
45
|
+
// Once new event types are registered with react it is possible to dispatch these
|
46
|
+
// events to all kind of native views.
|
47
|
+
|
48
|
+
UIManagerAny.genericDirectEventTypes = { ...UIManagerAny.genericDirectEventTypes,
|
49
|
+
...customGHEventsConfig
|
50
|
+
}; // In newer versions of RN the `genericDirectEventTypes` is located in the object
|
51
|
+
// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make
|
52
|
+
// it compatible with RN 61+
|
53
|
+
|
54
|
+
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);
|
55
|
+
|
56
|
+
if (UIManagerConstants) {
|
57
|
+
UIManagerConstants.genericDirectEventTypes = { ...UIManagerConstants.genericDirectEventTypes,
|
58
|
+
...customGHEventsConfig
|
59
|
+
};
|
60
|
+
} // Wrap JS responder calls and notify gesture handler manager
|
61
|
+
|
62
|
+
|
63
|
+
const {
|
64
|
+
setJSResponder: oldSetJSResponder = () => {//no operation
|
65
|
+
},
|
66
|
+
clearJSResponder: oldClearJSResponder = () => {//no operation
|
67
|
+
}
|
68
|
+
} = UIManagerAny;
|
69
|
+
|
70
|
+
UIManagerAny.setJSResponder = (tag, blockNativeResponder) => {
|
71
|
+
RNGestureHandlerModule.handleSetJSResponder(tag, blockNativeResponder);
|
72
|
+
oldSetJSResponder(tag, blockNativeResponder);
|
73
|
+
};
|
74
|
+
|
75
|
+
UIManagerAny.clearJSResponder = () => {
|
76
|
+
RNGestureHandlerModule.handleClearJSResponder();
|
77
|
+
oldClearJSResponder();
|
78
|
+
};
|
79
|
+
|
80
|
+
let allowTouches = true;
|
81
|
+
const DEV_ON_ANDROID = __DEV__ && Platform.OS === 'android'; // Toggled inspector blocks touch events in order to allow inspecting on Android
|
82
|
+
// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component
|
83
|
+
|
84
|
+
if (DEV_ON_ANDROID) {
|
85
|
+
DeviceEventEmitter.addListener('toggleElementInspector', () => {
|
86
|
+
allowTouches = !allowTouches;
|
87
|
+
});
|
88
|
+
}
|
89
|
+
|
90
|
+
function hasUnresolvedRefs(props) {
|
91
|
+
// TODO(TS) - add type for extract arg
|
92
|
+
const extract = refs => {
|
93
|
+
if (!Array.isArray(refs)) {
|
94
|
+
return refs && refs.current === null;
|
95
|
+
}
|
96
|
+
|
97
|
+
return refs.some(r => r && r.current === null);
|
98
|
+
};
|
99
|
+
|
100
|
+
return extract(props['simultaneousHandlers']) || extract(props['waitFor']);
|
101
|
+
}
|
102
|
+
|
103
|
+
const stateToPropMappings = {
|
104
|
+
[State.UNDETERMINED]: undefined,
|
105
|
+
[State.BEGAN]: 'onBegan',
|
106
|
+
[State.FAILED]: 'onFailed',
|
107
|
+
[State.CANCELLED]: 'onCancelled',
|
108
|
+
[State.ACTIVE]: 'onActivated',
|
109
|
+
[State.END]: 'onEnded'
|
110
|
+
};
|
111
|
+
const UNRESOLVED_REFS_RETRY_LIMIT = 1; // TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
112
|
+
|
113
|
+
export default function createHandler({
|
114
|
+
name,
|
115
|
+
allowedProps = [],
|
116
|
+
config = {},
|
117
|
+
transformProps,
|
118
|
+
customNativeProps = []
|
119
|
+
}) {
|
120
|
+
class Handler extends React.Component {
|
121
|
+
constructor(props) {
|
122
|
+
super(props);
|
123
|
+
|
124
|
+
_defineProperty(this, "handlerTag", void 0);
|
125
|
+
|
126
|
+
_defineProperty(this, "config", void 0);
|
127
|
+
|
128
|
+
_defineProperty(this, "propsRef", void 0);
|
129
|
+
|
130
|
+
_defineProperty(this, "isMountedRef", void 0);
|
131
|
+
|
132
|
+
_defineProperty(this, "viewNode", void 0);
|
133
|
+
|
134
|
+
_defineProperty(this, "viewTag", void 0);
|
135
|
+
|
136
|
+
_defineProperty(this, "inspectorToggleListener", void 0);
|
137
|
+
|
138
|
+
_defineProperty(this, "onGestureHandlerEvent", event => {
|
139
|
+
if (event.nativeEvent.handlerTag === this.handlerTag) {
|
140
|
+
if (typeof this.props.onGestureEvent === 'function') {
|
141
|
+
var _this$props$onGesture, _this$props;
|
142
|
+
|
143
|
+
(_this$props$onGesture = (_this$props = this.props).onGestureEvent) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props, event);
|
144
|
+
}
|
145
|
+
} else {
|
146
|
+
var _this$props$onGesture2, _this$props2;
|
147
|
+
|
148
|
+
(_this$props$onGesture2 = (_this$props2 = this.props).onGestureHandlerEvent) === null || _this$props$onGesture2 === void 0 ? void 0 : _this$props$onGesture2.call(_this$props2, event);
|
149
|
+
}
|
150
|
+
});
|
151
|
+
|
152
|
+
_defineProperty(this, "onGestureHandlerStateChange", event => {
|
153
|
+
if (event.nativeEvent.handlerTag === this.handlerTag) {
|
154
|
+
if (typeof this.props.onHandlerStateChange === 'function') {
|
155
|
+
var _this$props$onHandler, _this$props3;
|
156
|
+
|
157
|
+
(_this$props$onHandler = (_this$props3 = this.props).onHandlerStateChange) === null || _this$props$onHandler === void 0 ? void 0 : _this$props$onHandler.call(_this$props3, event);
|
158
|
+
}
|
159
|
+
|
160
|
+
const state = event.nativeEvent.state;
|
161
|
+
const stateEventName = stateToPropMappings[state];
|
162
|
+
const eventHandler = stateEventName && this.props[stateEventName];
|
163
|
+
|
164
|
+
if (eventHandler && typeof eventHandler === 'function') {
|
165
|
+
eventHandler(event);
|
166
|
+
}
|
167
|
+
} else {
|
168
|
+
var _this$props$onGesture3, _this$props4;
|
169
|
+
|
170
|
+
(_this$props$onGesture3 = (_this$props4 = this.props).onGestureHandlerStateChange) === null || _this$props$onGesture3 === void 0 ? void 0 : _this$props$onGesture3.call(_this$props4, event);
|
171
|
+
}
|
172
|
+
});
|
173
|
+
|
174
|
+
_defineProperty(this, "refHandler", node => {
|
175
|
+
this.viewNode = node;
|
176
|
+
const child = React.Children.only(this.props.children); // TODO(TS) fix ref type
|
177
|
+
|
178
|
+
const {
|
179
|
+
ref
|
180
|
+
} = child;
|
181
|
+
|
182
|
+
if (ref !== null) {
|
183
|
+
if (typeof ref === 'function') {
|
184
|
+
ref(node);
|
185
|
+
} else {
|
186
|
+
ref.current = node;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
});
|
190
|
+
|
191
|
+
_defineProperty(this, "createGestureHandler", newConfig => {
|
192
|
+
this.config = newConfig;
|
193
|
+
RNGestureHandlerModule.createGestureHandler(name, this.handlerTag, newConfig);
|
194
|
+
});
|
195
|
+
|
196
|
+
_defineProperty(this, "attachGestureHandler", newViewTag => {
|
197
|
+
this.viewTag = newViewTag;
|
198
|
+
|
199
|
+
if (Platform.OS === 'web') {
|
200
|
+
// typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
|
201
|
+
RNGestureHandlerModule.attachGestureHandler(this.handlerTag, newViewTag, ActionType.JS_FUNCTION_OLD_API, // ignored on web
|
202
|
+
this.propsRef);
|
203
|
+
} else {
|
204
|
+
registerOldGestureHandler(this.handlerTag, {
|
205
|
+
onGestureEvent: this.onGestureHandlerEvent,
|
206
|
+
onGestureStateChange: this.onGestureHandlerStateChange
|
207
|
+
});
|
208
|
+
|
209
|
+
const actionType = (() => {
|
210
|
+
var _this$props5, _this$props6, _this$props7;
|
211
|
+
|
212
|
+
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) {
|
213
|
+
// Reanimated worklet
|
214
|
+
return ActionType.REANIMATED_WORKLET;
|
215
|
+
} else if ((_this$props7 = this.props) !== null && _this$props7 !== void 0 && _this$props7.onGestureEvent && '__isNative' in this.props.onGestureEvent) {
|
216
|
+
// Animated.event with useNativeDriver: true
|
217
|
+
return ActionType.NATIVE_ANIMATED_EVENT;
|
218
|
+
} else {
|
219
|
+
// JS callback or Animated.event with useNativeDriver: false
|
220
|
+
return ActionType.JS_FUNCTION_OLD_API;
|
221
|
+
}
|
222
|
+
})();
|
223
|
+
|
224
|
+
RNGestureHandlerModule.attachGestureHandler(this.handlerTag, newViewTag, actionType);
|
225
|
+
}
|
226
|
+
|
227
|
+
scheduleFlushOperations();
|
228
|
+
});
|
229
|
+
|
230
|
+
_defineProperty(this, "updateGestureHandler", newConfig => {
|
231
|
+
this.config = newConfig;
|
232
|
+
RNGestureHandlerModule.updateGestureHandler(this.handlerTag, newConfig);
|
233
|
+
scheduleFlushOperations();
|
234
|
+
});
|
235
|
+
|
236
|
+
this.handlerTag = getNextHandlerTag();
|
237
|
+
this.config = {};
|
238
|
+
this.propsRef = /*#__PURE__*/React.createRef();
|
239
|
+
this.isMountedRef = /*#__PURE__*/React.createRef();
|
240
|
+
this.state = {
|
241
|
+
allowTouches
|
242
|
+
};
|
243
|
+
|
244
|
+
if (props.id) {
|
245
|
+
if (handlerIDToTag[props.id] !== undefined) {
|
246
|
+
throw new Error(`Handler with ID "${props.id}" already registered`);
|
247
|
+
}
|
248
|
+
|
249
|
+
handlerIDToTag[props.id] = this.handlerTag;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
componentDidMount() {
|
254
|
+
const props = this.props;
|
255
|
+
this.isMountedRef.current = true;
|
256
|
+
|
257
|
+
if (DEV_ON_ANDROID) {
|
258
|
+
this.inspectorToggleListener = DeviceEventEmitter.addListener('toggleElementInspector', () => {
|
259
|
+
this.setState(_ => ({
|
260
|
+
allowTouches
|
261
|
+
}));
|
262
|
+
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
263
|
+
});
|
264
|
+
}
|
265
|
+
|
266
|
+
if (hasUnresolvedRefs(props)) {
|
267
|
+
// If there are unresolved refs (e.g. ".current" has not yet been set)
|
268
|
+
// passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to
|
269
|
+
// _update method that will try to update native handler props using
|
270
|
+
// queueMicrotask. This makes it so update() function gets called after all
|
271
|
+
// react components are mounted and we expect the missing ref object to
|
272
|
+
// be resolved by then.
|
273
|
+
ghQueueMicrotask(() => {
|
274
|
+
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
275
|
+
});
|
276
|
+
}
|
277
|
+
|
278
|
+
this.createGestureHandler(filterConfig(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config));
|
279
|
+
this.attachGestureHandler(findNodeHandle(this.viewNode)); // TODO(TS) - check if this can be null
|
280
|
+
}
|
281
|
+
|
282
|
+
componentDidUpdate() {
|
283
|
+
const viewTag = findNodeHandle(this.viewNode);
|
284
|
+
|
285
|
+
if (this.viewTag !== viewTag) {
|
286
|
+
this.attachGestureHandler(viewTag); // TODO(TS) - check interaction between _viewTag & findNodeHandle
|
287
|
+
}
|
288
|
+
|
289
|
+
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
290
|
+
}
|
291
|
+
|
292
|
+
componentWillUnmount() {
|
293
|
+
var _this$inspectorToggle;
|
294
|
+
|
295
|
+
(_this$inspectorToggle = this.inspectorToggleListener) === null || _this$inspectorToggle === void 0 ? void 0 : _this$inspectorToggle.remove();
|
296
|
+
this.isMountedRef.current = false;
|
297
|
+
RNGestureHandlerModule.dropGestureHandler(this.handlerTag);
|
298
|
+
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
|
299
|
+
|
300
|
+
const handlerID = this.props.id;
|
301
|
+
|
302
|
+
if (handlerID) {
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
304
|
+
delete handlerIDToTag[handlerID];
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
update(remainingTries) {
|
309
|
+
if (!this.isMountedRef.current) {
|
310
|
+
return;
|
311
|
+
}
|
312
|
+
|
313
|
+
const props = this.props; // When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of
|
314
|
+
// `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying
|
315
|
+
// again is easy enough fix.
|
316
|
+
|
317
|
+
if (hasUnresolvedRefs(props) && remainingTries > 0) {
|
318
|
+
ghQueueMicrotask(() => {
|
319
|
+
this.update(remainingTries - 1);
|
320
|
+
});
|
321
|
+
} else {
|
322
|
+
const newConfig = filterConfig(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config);
|
323
|
+
|
324
|
+
if (!deepEqual(this.config, newConfig)) {
|
325
|
+
this.updateGestureHandler(newConfig);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
setNativeProps(updates) {
|
331
|
+
const mergedProps = { ...this.props,
|
332
|
+
...updates
|
333
|
+
};
|
334
|
+
const newConfig = filterConfig(transformProps ? transformProps(mergedProps) : mergedProps, [...allowedProps, ...customNativeProps], config);
|
335
|
+
this.updateGestureHandler(newConfig);
|
336
|
+
}
|
337
|
+
|
338
|
+
render() {
|
339
|
+
var _this$props$testID;
|
340
|
+
|
341
|
+
if (__DEV__ && !this.context && !isJestEnv() && Platform.OS !== 'web') {
|
342
|
+
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.');
|
343
|
+
}
|
344
|
+
|
345
|
+
let gestureEventHandler = this.onGestureHandlerEvent; // Another instance of https://github.com/microsoft/TypeScript/issues/13995
|
346
|
+
|
347
|
+
const {
|
348
|
+
onGestureEvent,
|
349
|
+
onGestureHandlerEvent
|
350
|
+
} = this.props;
|
351
|
+
|
352
|
+
if (onGestureEvent && typeof onGestureEvent !== 'function') {
|
353
|
+
// If it's not a method it should be an native Animated.event
|
354
|
+
// object. We set it directly as the handler for the view
|
355
|
+
// In this case nested handlers are not going to be supported
|
356
|
+
if (onGestureHandlerEvent) {
|
357
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
358
|
+
}
|
359
|
+
|
360
|
+
gestureEventHandler = onGestureEvent;
|
361
|
+
} else {
|
362
|
+
if (onGestureHandlerEvent && typeof onGestureHandlerEvent !== 'function') {
|
363
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
let gestureStateEventHandler = this.onGestureHandlerStateChange; // Another instance of https://github.com/microsoft/TypeScript/issues/13995
|
368
|
+
|
369
|
+
const {
|
370
|
+
onHandlerStateChange,
|
371
|
+
onGestureHandlerStateChange
|
372
|
+
} = this.props;
|
373
|
+
|
374
|
+
if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {
|
375
|
+
// If it's not a method it should be an native Animated.event
|
376
|
+
// object. We set it directly as the handler for the view
|
377
|
+
// In this case nested handlers are not going to be supported
|
378
|
+
if (onGestureHandlerStateChange) {
|
379
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
380
|
+
}
|
381
|
+
|
382
|
+
gestureStateEventHandler = onHandlerStateChange;
|
383
|
+
} else {
|
384
|
+
if (onGestureHandlerStateChange && typeof onGestureHandlerStateChange !== 'function') {
|
385
|
+
throw new Error('Nesting touch handlers with native animated driver is not supported yet');
|
386
|
+
}
|
387
|
+
}
|
388
|
+
|
389
|
+
const events = {
|
390
|
+
onGestureHandlerEvent: this.state.allowTouches ? gestureEventHandler : undefined,
|
391
|
+
onGestureHandlerStateChange: this.state.allowTouches ? gestureStateEventHandler : undefined
|
392
|
+
};
|
393
|
+
this.propsRef.current = events;
|
394
|
+
let child = null;
|
395
|
+
|
396
|
+
try {
|
397
|
+
child = React.Children.only(this.props.children);
|
398
|
+
} catch (e) {
|
399
|
+
throw new Error(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.`));
|
400
|
+
}
|
401
|
+
|
402
|
+
let grandChildren = child.props.children;
|
403
|
+
|
404
|
+
if (__DEV__ && child.type && (child.type === 'RNGestureHandlerButton' || child.type.name === 'View' || child.type.displayName === 'View')) {
|
405
|
+
grandChildren = React.Children.toArray(grandChildren);
|
406
|
+
grandChildren.push( /*#__PURE__*/React.createElement(PressabilityDebugView, {
|
407
|
+
key: "pressabilityDebugView",
|
408
|
+
color: "mediumspringgreen",
|
409
|
+
hitSlop: child.props.hitSlop
|
410
|
+
}));
|
411
|
+
}
|
412
|
+
|
413
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
414
|
+
ref: this.refHandler,
|
415
|
+
collapsable: false,
|
416
|
+
...(isJestEnv() ? {
|
417
|
+
handlerType: name,
|
418
|
+
handlerTag: this.handlerTag
|
419
|
+
} : {}),
|
420
|
+
testID: (_this$props$testID = this.props.testID) !== null && _this$props$testID !== void 0 ? _this$props$testID : child.props.testID,
|
421
|
+
...events
|
422
|
+
}, grandChildren);
|
423
|
+
}
|
424
|
+
|
425
|
+
}
|
426
|
+
|
427
|
+
_defineProperty(Handler, "displayName", name);
|
428
|
+
|
429
|
+
_defineProperty(Handler, "contextType", GestureHandlerRootViewContext);
|
430
|
+
|
431
|
+
return Handler;
|
432
|
+
}
|
433
|
+
//# sourceMappingURL=createHandler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["createHandler.tsx"],"names":["React","Platform","UIManager","DeviceEventEmitter","deepEqual","RNGestureHandlerModule","State","handlerIDToTag","getNextHandlerTag","registerOldGestureHandler","filterConfig","findNodeHandle","scheduleFlushOperations","isFabric","isJestEnv","tagMessage","ActionType","PressabilityDebugView","GestureHandlerRootViewContext","ghQueueMicrotask","UIManagerAny","customGHEventsConfigFabricAndroid","topOnGestureHandlerEvent","registrationName","topOnGestureHandlerStateChange","customGHEventsConfig","onGestureHandlerEvent","onGestureHandlerStateChange","OS","genericDirectEventTypes","UIManagerConstants","getViewManagerConfig","getConstants","setJSResponder","oldSetJSResponder","clearJSResponder","oldClearJSResponder","tag","blockNativeResponder","handleSetJSResponder","handleClearJSResponder","allowTouches","DEV_ON_ANDROID","__DEV__","addListener","hasUnresolvedRefs","props","extract","refs","Array","isArray","current","some","r","stateToPropMappings","UNDETERMINED","undefined","BEGAN","FAILED","CANCELLED","ACTIVE","END","UNRESOLVED_REFS_RETRY_LIMIT","createHandler","name","allowedProps","config","transformProps","customNativeProps","Handler","Component","constructor","event","nativeEvent","handlerTag","onGestureEvent","onHandlerStateChange","state","stateEventName","eventHandler","node","viewNode","child","Children","only","children","ref","newConfig","createGestureHandler","newViewTag","viewTag","attachGestureHandler","JS_FUNCTION_OLD_API","propsRef","onGestureStateChange","actionType","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","updateGestureHandler","createRef","isMountedRef","id","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"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,QADF,EAEEC,SAFF,EAGEC,kBAHF,QAKO,cALP,C,CAMA;;AACA,OAAOC,SAAP,MAAsB,gBAAtB;AACA,OAAOC,sBAAP,MAAmC,2BAAnC;AAEA,SAASC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AAC,uBADN;AAEE,UAAA,KAAK,EAAC,mBAFR;AAGE,UAAA,OAAO,EAAE7C,KAAK,CAACpC,KAAN,CAAYkF;AAHvB,UADF;AAOD;;AAED,0BAAOhI,KAAK,CAACiI,YAAN,CACL/C,KADK,EAEL;AACEI,QAAAA,GAAG,EAAE,KAAK4C,UADZ;AAEEC,QAAAA,WAAW,EAAE,KAFf;AAGE,YAAIrH,SAAS,KACT;AACEsH,UAAAA,WAAW,EAAEpE,IADf;AAEEU,UAAAA,UAAU,EAAE,KAAKA;AAFnB,SADS,GAKT,EALJ,CAHF;AASE2D,QAAAA,MAAM,wBAAE,KAAKvF,KAAL,CAAWuF,MAAb,mEAAuBnD,KAAK,CAACpC,KAAN,CAAYuF,MAT3C;AAUE,WAAGZ;AAVL,OAFK,EAcLE,aAdK,CAAP;AAgBD;;AAvWD;;AAPwE,kBAIpEtD,OAJoE,iBAQnDL,IARmD;;AAAA,kBAIpEK,OAJoE,iBASnDnD,6BATmD;;AAgX1E,SAAOmD,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"]}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
+
|
3
|
+
import * as React from 'react';
|
4
|
+
import { useImperativeHandle, useRef } from 'react';
|
5
|
+
import { NativeViewGestureHandler, nativeViewProps } from './NativeViewGestureHandler';
|
6
|
+
/*
|
7
|
+
* This array should consist of:
|
8
|
+
* - All keys in propTypes from NativeGestureHandler
|
9
|
+
* (and all keys in GestureHandlerPropTypes)
|
10
|
+
* - 'onGestureHandlerEvent'
|
11
|
+
* - 'onGestureHandlerStateChange'
|
12
|
+
*/
|
13
|
+
|
14
|
+
const NATIVE_WRAPPER_PROPS_FILTER = [...nativeViewProps, 'onGestureHandlerEvent', 'onGestureHandlerStateChange'];
|
15
|
+
export default function createNativeWrapper(Component, config = {}) {
|
16
|
+
var _Component$render;
|
17
|
+
|
18
|
+
const ComponentWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
|
19
|
+
// filter out props that should be passed to gesture handler wrapper
|
20
|
+
const gestureHandlerProps = Object.keys(props).reduce((res, key) => {
|
21
|
+
// TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
|
22
|
+
const allowedKeys = NATIVE_WRAPPER_PROPS_FILTER;
|
23
|
+
|
24
|
+
if (allowedKeys.includes(key)) {
|
25
|
+
// @ts-ignore FIXME(TS)
|
26
|
+
res[key] = props[key];
|
27
|
+
}
|
28
|
+
|
29
|
+
return res;
|
30
|
+
}, { ...config
|
31
|
+
} // watch out not to modify config
|
32
|
+
);
|
33
|
+
|
34
|
+
const _ref = useRef();
|
35
|
+
|
36
|
+
const _gestureHandlerRef = useRef();
|
37
|
+
|
38
|
+
useImperativeHandle(ref, // @ts-ignore TODO(TS) decide how nulls work in this context
|
39
|
+
() => {
|
40
|
+
const node = _gestureHandlerRef.current; // add handlerTag for relations config
|
41
|
+
|
42
|
+
if (_ref.current && node) {
|
43
|
+
// @ts-ignore FIXME(TS) think about createHandler return type
|
44
|
+
_ref.current.handlerTag = node.handlerTag;
|
45
|
+
return _ref.current;
|
46
|
+
}
|
47
|
+
|
48
|
+
return null;
|
49
|
+
}, [_ref, _gestureHandlerRef]);
|
50
|
+
return /*#__PURE__*/React.createElement(NativeViewGestureHandler, _extends({}, gestureHandlerProps, {
|
51
|
+
// @ts-ignore TODO(TS)
|
52
|
+
ref: _gestureHandlerRef
|
53
|
+
}), /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
54
|
+
ref: _ref
|
55
|
+
})));
|
56
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
57
|
+
|
58
|
+
ComponentWrapper.displayName = (Component === null || Component === void 0 ? void 0 : Component.displayName) || ( // @ts-ignore if render doesn't exist it will return undefined and go further
|
59
|
+
Component === null || Component === void 0 ? void 0 : (_Component$render = Component.render) === null || _Component$render === void 0 ? void 0 : _Component$render.name) || typeof Component === 'string' && Component || 'ComponentWrapper';
|
60
|
+
return ComponentWrapper;
|
61
|
+
}
|
62
|
+
//# sourceMappingURL=createNativeWrapper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["createNativeWrapper.tsx"],"names":["React","useImperativeHandle","useRef","NativeViewGestureHandler","nativeViewProps","NATIVE_WRAPPER_PROPS_FILTER","createNativeWrapper","Component","config","ComponentWrapper","forwardRef","props","ref","gestureHandlerProps","Object","keys","reduce","res","key","allowedKeys","includes","_ref","_gestureHandlerRef","node","current","handlerTag","displayName","render","name"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,mBAAT,EAA8BC,MAA9B,QAA4C,OAA5C;AAEA,SACEC,wBADF,EAGEC,eAHF,QAIO,4BAJP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG,CAClC,GAAGD,eAD+B,EAElC,uBAFkC,EAGlC,6BAHkC,CAApC;AAMA,eAAe,SAASE,mBAAT,CACbC,SADa,EAEbC,MAA+C,GAAG,EAFrC,EAGb;AAAA;;AACA,QAAMC,gBAAgB,gBAAGT,KAAK,CAACU,UAAN,CAGvB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAChB;AACA,UAAMC,mBAAmB,GAAGC,MA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HlC,IAIA,kBALF;AAOA,SAAOE,gBAAP;AACD","sourcesContent":["import * as React from 'react';\r\nimport { useImperativeHandle, useRef } from 'react';\r\n\r\nimport {\r\n NativeViewGestureHandler,\r\n NativeViewGestureHandlerProps,\r\n nativeViewProps,\r\n} from './NativeViewGestureHandler';\r\n\r\n/*\r\n * This array should consist of:\r\n * - All keys in propTypes from NativeGestureHandler\r\n * (and all keys in GestureHandlerPropTypes)\r\n * - 'onGestureHandlerEvent'\r\n * - 'onGestureHandlerStateChange'\r\n */\r\nconst NATIVE_WRAPPER_PROPS_FILTER = [\r\n ...nativeViewProps,\r\n 'onGestureHandlerEvent',\r\n 'onGestureHandlerStateChange',\r\n] as const;\r\n\r\nexport default function createNativeWrapper<P>(\r\n Component: React.ComponentType<P>,\r\n config: Readonly<NativeViewGestureHandlerProps> = {}\r\n) {\r\n const ComponentWrapper = React.forwardRef<\r\n React.ComponentType<any>,\r\n P & NativeViewGestureHandlerProps\r\n >((props, ref) => {\r\n // filter out props that should be passed to gesture handler wrapper\r\n const gestureHandlerProps = Object.keys(props).reduce(\r\n (res, key) => {\r\n // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info\r\n const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;\r\n if (allowedKeys.includes(key)) {\r\n // @ts-ignore FIXME(TS)\r\n res[key] = props[key];\r\n }\r\n return res;\r\n },\r\n { ...config } // watch out not to modify config\r\n );\r\n const _ref = useRef<React.ComponentType<P>>();\r\n const _gestureHandlerRef = useRef<React.ComponentType<P>>();\r\n useImperativeHandle(\r\n ref,\r\n // @ts-ignore TODO(TS) decide how nulls work in this context\r\n () => {\r\n const node = _gestureHandlerRef.current;\r\n // add handlerTag for relations config\r\n if (_ref.current && node) {\r\n // @ts-ignore FIXME(TS) think about createHandler return type\r\n _ref.current.handlerTag = node.handlerTag;\r\n return _ref.current;\r\n }\r\n return null;\r\n },\r\n [_ref, _gestureHandlerRef]\r\n );\r\n return (\r\n <NativeViewGestureHandler\r\n {...gestureHandlerProps}\r\n // @ts-ignore TODO(TS)\r\n ref={_gestureHandlerRef}>\r\n <Component {...props} ref={_ref} />\r\n </NativeViewGestureHandler>\r\n );\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n ComponentWrapper.displayName =\r\n Component?.displayName ||\r\n // @ts-ignore if render doesn't exist it will return undefined and go further\r\n Component?.render?.name ||\r\n (typeof Component === 'string' && Component) ||\r\n 'ComponentWrapper';\r\n\r\n return ComponentWrapper;\r\n}\r\n"]}
|