react-native-gesture-handler 2.16.1 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +9 -3
- package/android/build.gradle +105 -0
- package/android/gradle.properties +7 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +7 -7
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +16 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +9 -5
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +4 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +1 -0
- package/apple/RNGestureHandlerButtonComponentView.mm +10 -0
- package/apple/RNGestureHandlerModule.mm +2 -3
- package/lib/commonjs/RNGestureHandlerModule.js +4 -97
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +109 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +10 -5
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.web.js +11 -0
- package/lib/commonjs/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/components/GestureButtons.js +27 -12
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +82 -19
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- 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 +3 -13
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +6 -0
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/{GestureHandlerRootView.native.js → GestureHandlerRootView.web.js} +1 -7
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.js +12 -1
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.web.js +11 -0
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +34 -5
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +15 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js +7 -5
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +1 -3
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +8 -5
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +11 -0
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +3 -3
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +42 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +83 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +25 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +143 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +25 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js +6 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +80 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +180 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +55 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +47 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +176 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js +3 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +8 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/utils.js +36 -0
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +6 -8
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +5 -6
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +56 -64
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +7 -4
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +28 -18
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +18 -12
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +1 -6
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +7 -2
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +89 -57
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +6 -2
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +2 -1
- package/lib/commonjs/web/tools/Vector.js.map +1 -1
- package/lib/commonjs/web/utils.js +31 -0
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +4 -84
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +85 -0
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/module/RNRenderer.js +3 -3
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.web.js +4 -0
- package/lib/module/RNRenderer.web.js.map +1 -0
- package/lib/module/components/GestureButtons.js +24 -6
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureComponents.js +80 -18
- package/lib/module/components/GestureComponents.js.map +1 -1
- 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 +2 -8
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.web.js +9 -0
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +5 -0
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/{GestureHandlerRootView.native.js → GestureHandlerRootView.web.js} +1 -6
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/getReactNativeVersion.js +7 -1
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.web.js +4 -0
- package/lib/module/getReactNativeVersion.web.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +33 -4
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.web.js +8 -0
- package/lib/module/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.js +2 -4
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/module/handlers/createHandler.js +2 -4
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +2 -4
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.web.js +5 -0
- package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js +26 -0
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +65 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +12 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js +115 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +18 -0
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/types.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +64 -0
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +165 -0
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +41 -0
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +36 -0
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/utils.js +142 -0
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -0
- package/lib/module/handlers/gestures/gestureComposition.js +3 -1
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +8 -0
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/utils.js +34 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +6 -8
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +5 -6
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +56 -64
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +1 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +1 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +7 -4
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +28 -18
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +1 -0
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +1 -0
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +18 -12
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +1 -6
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +8 -3
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +89 -57
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +7 -3
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/tools/Vector.js +2 -1
- package/lib/module/web/tools/Vector.js.map +1 -1
- package/lib/module/web/utils.js +29 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -15
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +15 -0
- package/lib/typescript/RNRenderer.d.ts +1 -3
- package/lib/typescript/RNRenderer.web.d.ts +3 -0
- package/lib/typescript/components/GestureButtons.d.ts +3 -34
- package/lib/typescript/components/GestureComponents.d.ts +21 -7
- package/lib/typescript/components/GestureComponents.web.d.ts +8 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.d.ts +4 -1
- package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -2
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +2 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +3 -2
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +13 -0
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +13 -0
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +2 -0
- package/lib/typescript/handlers/gestures/{GestureDetector.d.ts → GestureDetector/index.d.ts} +4 -12
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +3 -0
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +20 -0
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +4 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +2 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +5 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +3 -0
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +12 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +1 -1
- package/lib/typescript/utils.d.ts +10 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
- package/lib/typescript/web/interfaces.d.ts +1 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +34 -31
- package/lib/typescript/web/utils.d.ts +4 -0
- package/package.json +5 -5
- package/src/RNGestureHandlerModule.ts +4 -104
- package/src/RNGestureHandlerModule.web.ts +105 -0
- package/src/RNRenderer.ts +3 -3
- package/src/RNRenderer.web.ts +3 -0
- package/src/components/GestureButtons.tsx +36 -4
- package/src/components/GestureComponents.tsx +131 -24
- package/src/components/GestureComponents.web.tsx +41 -0
- package/src/components/GestureHandlerButton.tsx +4 -5
- package/src/components/GestureHandlerButton.web.tsx +6 -0
- package/src/components/GestureHandlerRootView.tsx +6 -0
- package/src/components/{GestureHandlerRootView.native.tsx → GestureHandlerRootView.web.tsx} +0 -6
- package/src/getReactNativeVersion.ts +9 -1
- package/src/getReactNativeVersion.web.ts +3 -0
- package/src/getShadowNodeFromRef.ts +41 -4
- package/src/getShadowNodeFromRef.web.ts +7 -0
- package/src/handlers/PressabilityDebugView.tsx +2 -4
- package/src/handlers/PressabilityDebugView.web.tsx +4 -0
- package/src/handlers/createHandler.tsx +1 -3
- package/src/handlers/customDirectEventTypes.ts +2 -5
- package/src/handlers/customDirectEventTypes.web.ts +5 -0
- package/src/handlers/gestureHandlerCommon.ts +4 -1
- package/src/handlers/gestures/GestureDetector/Wrap.tsx +35 -0
- package/src/handlers/gestures/GestureDetector/attachHandlers.ts +112 -0
- package/src/handlers/gestures/GestureDetector/dropHandlers.ts +14 -0
- package/src/handlers/gestures/GestureDetector/index.tsx +187 -0
- package/src/handlers/gestures/GestureDetector/needsToReattach.ts +27 -0
- package/src/handlers/gestures/GestureDetector/types.ts +32 -0
- package/src/handlers/gestures/GestureDetector/updateHandlers.ts +94 -0
- package/src/handlers/gestures/GestureDetector/useAnimatedGesture.ts +206 -0
- package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +69 -0
- package/src/handlers/gestures/GestureDetector/useViewRefHandler.ts +54 -0
- package/src/handlers/gestures/GestureDetector/utils.ts +185 -0
- package/src/handlers/gestures/gestureComposition.ts +2 -0
- package/src/handlers/gestures/gestureStateManager.ts +12 -4
- package/src/handlers/gestures/reanimatedWrapper.ts +19 -17
- package/src/utils.ts +39 -0
- package/src/web/detectors/RotationGestureDetector.ts +6 -8
- package/src/web/detectors/ScaleGestureDetector.ts +5 -6
- package/src/web/handlers/FlingGestureHandler.ts +2 -0
- package/src/web/handlers/GestureHandler.ts +53 -62
- package/src/web/handlers/LongPressGestureHandler.ts +2 -0
- package/src/web/handlers/ManualGestureHandler.ts +2 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +8 -4
- package/src/web/handlers/PanGestureHandler.ts +32 -19
- package/src/web/handlers/PinchGestureHandler.ts +2 -0
- package/src/web/handlers/RotationGestureHandler.ts +2 -0
- package/src/web/handlers/TapGestureHandler.ts +20 -12
- package/src/web/interfaces.ts +1 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +1 -7
- package/src/web/tools/PointerEventManager.ts +10 -3
- package/src/web/tools/PointerTracker.ts +81 -74
- package/src/web/tools/TouchEventManager.ts +5 -3
- package/src/web/tools/Vector.ts +2 -4
- package/src/web/utils.ts +34 -0
- package/lib/commonjs/RNGestureHandlerModule.native.js +0 -16
- package/lib/commonjs/RNGestureHandlerModule.native.js.map +0 -1
- package/lib/commonjs/RNRenderer.native.js +0 -16
- package/lib/commonjs/RNRenderer.native.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.native.js +0 -115
- package/lib/commonjs/components/GestureComponents.native.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.native.js +0 -14
- package/lib/commonjs/components/GestureHandlerButton.native.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.native.js.map +0 -1
- package/lib/commonjs/getReactNativeVersion.native.js +0 -22
- package/lib/commonjs/getReactNativeVersion.native.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.native.js +0 -44
- package/lib/commonjs/getShadowNodeFromRef.native.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.native.js +0 -14
- package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.native.js +0 -14
- package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -704
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.native.js +0 -5
- package/lib/module/RNGestureHandlerModule.native.js.map +0 -1
- package/lib/module/RNRenderer.native.js +0 -4
- package/lib/module/RNRenderer.native.js.map +0 -1
- package/lib/module/components/GestureComponents.native.js +0 -90
- package/lib/module/components/GestureComponents.native.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.native.js +0 -3
- package/lib/module/components/GestureHandlerButton.native.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.native.js.map +0 -1
- package/lib/module/getReactNativeVersion.native.js +0 -10
- package/lib/module/getReactNativeVersion.native.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.native.js +0 -37
- package/lib/module/getShadowNodeFromRef.native.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.native.js +0 -3
- package/lib/module/handlers/PressabilityDebugView.native.js.map +0 -1
- package/lib/module/handlers/customDirectEventTypes.native.js +0 -3
- package/lib/module/handlers/customDirectEventTypes.native.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector.js +0 -654
- package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.native.d.ts +0 -2
- package/lib/typescript/RNRenderer.native.d.ts +0 -1
- package/lib/typescript/components/GestureComponents.native.d.ts +0 -22
- package/lib/typescript/components/GestureHandlerButton.native.d.ts +0 -4
- package/lib/typescript/getReactNativeVersion.native.d.ts +0 -4
- package/lib/typescript/getShadowNodeFromRef.native.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +0 -1
- package/src/RNGestureHandlerModule.native.ts +0 -5
- package/src/RNRenderer.native.ts +0 -3
- package/src/components/GestureComponents.native.tsx +0 -148
- package/src/components/GestureHandlerButton.native.tsx +0 -5
- package/src/getReactNativeVersion.native.ts +0 -11
- package/src/getShadowNodeFromRef.native.ts +0 -44
- package/src/handlers/PressabilityDebugView.native.tsx +0 -2
- package/src/handlers/customDirectEventTypes.native.ts +0 -2
- package/src/handlers/gestures/GestureDetector.tsx +0 -894
- /package/lib/typescript/components/{GestureHandlerRootView.native.d.ts → GestureHandlerRootView.web.d.ts} +0 -0
@@ -1,105 +1,5 @@
|
|
1
|
-
|
1
|
+
// Reexport the native module spec used by codegen. The relevant files are inluded on Android
|
2
|
+
// to ensure the compatibility with the old arch, while iOS doesn't require those at all.
|
2
3
|
|
3
|
-
import
|
4
|
-
|
5
|
-
import { Gestures, HammerGestures } from './web/Gestures';
|
6
|
-
import type { Config } from './web/interfaces';
|
7
|
-
import InteractionManager from './web/tools/InteractionManager';
|
8
|
-
import NodeManager from './web/tools/NodeManager';
|
9
|
-
import * as HammerNodeManager from './web_hammer/NodeManager';
|
10
|
-
import { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';
|
11
|
-
|
12
|
-
export default {
|
13
|
-
handleSetJSResponder(tag: number, blockNativeResponder: boolean) {
|
14
|
-
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
|
15
|
-
},
|
16
|
-
handleClearJSResponder() {
|
17
|
-
console.warn('handleClearJSResponder: ');
|
18
|
-
},
|
19
|
-
createGestureHandler<T>(
|
20
|
-
handlerName: keyof typeof Gestures,
|
21
|
-
handlerTag: number,
|
22
|
-
config: T
|
23
|
-
) {
|
24
|
-
if (isNewWebImplementationEnabled()) {
|
25
|
-
if (!(handlerName in Gestures)) {
|
26
|
-
throw new Error(
|
27
|
-
`react-native-gesture-handler: ${handlerName} is not supported on web.`
|
28
|
-
);
|
29
|
-
}
|
30
|
-
|
31
|
-
const GestureClass = Gestures[handlerName];
|
32
|
-
NodeManager.createGestureHandler(
|
33
|
-
handlerTag,
|
34
|
-
new GestureClass(new GestureHandlerWebDelegate())
|
35
|
-
);
|
36
|
-
InteractionManager.getInstance().configureInteractions(
|
37
|
-
NodeManager.getHandler(handlerTag),
|
38
|
-
config as unknown as Config
|
39
|
-
);
|
40
|
-
} else {
|
41
|
-
if (!(handlerName in HammerGestures)) {
|
42
|
-
throw new Error(
|
43
|
-
`react-native-gesture-handler: ${handlerName} is not supported on web.`
|
44
|
-
);
|
45
|
-
}
|
46
|
-
|
47
|
-
// @ts-ignore If it doesn't exist, the error is thrown
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
49
|
-
const GestureClass = HammerGestures[handlerName];
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
51
|
-
HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
|
52
|
-
}
|
53
|
-
|
54
|
-
this.updateGestureHandler(handlerTag, config as unknown as Config);
|
55
|
-
},
|
56
|
-
attachGestureHandler(
|
57
|
-
handlerTag: number,
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
59
|
-
newView: any,
|
60
|
-
_actionType: ActionType,
|
61
|
-
propsRef: React.RefObject<unknown>
|
62
|
-
) {
|
63
|
-
if (
|
64
|
-
!(newView instanceof HTMLElement || newView instanceof React.Component)
|
65
|
-
) {
|
66
|
-
return;
|
67
|
-
}
|
68
|
-
|
69
|
-
if (isNewWebImplementationEnabled()) {
|
70
|
-
//@ts-ignore Types should be HTMLElement or React.Component
|
71
|
-
NodeManager.getHandler(handlerTag).init(newView, propsRef);
|
72
|
-
} else {
|
73
|
-
//@ts-ignore Types should be HTMLElement or React.Component
|
74
|
-
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
75
|
-
}
|
76
|
-
},
|
77
|
-
updateGestureHandler(handlerTag: number, newConfig: Config) {
|
78
|
-
if (isNewWebImplementationEnabled()) {
|
79
|
-
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
80
|
-
|
81
|
-
InteractionManager.getInstance().configureInteractions(
|
82
|
-
NodeManager.getHandler(handlerTag),
|
83
|
-
newConfig
|
84
|
-
);
|
85
|
-
} else {
|
86
|
-
HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
87
|
-
}
|
88
|
-
},
|
89
|
-
getGestureHandlerNode(handlerTag: number) {
|
90
|
-
if (isNewWebImplementationEnabled()) {
|
91
|
-
return NodeManager.getHandler(handlerTag);
|
92
|
-
} else {
|
93
|
-
return HammerNodeManager.getHandler(handlerTag);
|
94
|
-
}
|
95
|
-
},
|
96
|
-
dropGestureHandler(handlerTag: number) {
|
97
|
-
if (isNewWebImplementationEnabled()) {
|
98
|
-
NodeManager.dropGestureHandler(handlerTag);
|
99
|
-
} else {
|
100
|
-
HammerNodeManager.dropGestureHandler(handlerTag);
|
101
|
-
}
|
102
|
-
},
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
104
|
-
flushOperations() {},
|
105
|
-
};
|
4
|
+
import Module from './specs/NativeRNGestureHandlerModule';
|
5
|
+
export default Module;
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
import type { ActionType } from './ActionType';
|
4
|
+
import { isNewWebImplementationEnabled } from './EnableNewWebImplementation';
|
5
|
+
import { Gestures, HammerGestures } from './web/Gestures';
|
6
|
+
import type { Config } from './web/interfaces';
|
7
|
+
import InteractionManager from './web/tools/InteractionManager';
|
8
|
+
import NodeManager from './web/tools/NodeManager';
|
9
|
+
import * as HammerNodeManager from './web_hammer/NodeManager';
|
10
|
+
import { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';
|
11
|
+
|
12
|
+
export default {
|
13
|
+
handleSetJSResponder(tag: number, blockNativeResponder: boolean) {
|
14
|
+
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
|
15
|
+
},
|
16
|
+
handleClearJSResponder() {
|
17
|
+
console.warn('handleClearJSResponder: ');
|
18
|
+
},
|
19
|
+
createGestureHandler<T>(
|
20
|
+
handlerName: keyof typeof Gestures,
|
21
|
+
handlerTag: number,
|
22
|
+
config: T
|
23
|
+
) {
|
24
|
+
if (isNewWebImplementationEnabled()) {
|
25
|
+
if (!(handlerName in Gestures)) {
|
26
|
+
throw new Error(
|
27
|
+
`react-native-gesture-handler: ${handlerName} is not supported on web.`
|
28
|
+
);
|
29
|
+
}
|
30
|
+
|
31
|
+
const GestureClass = Gestures[handlerName];
|
32
|
+
NodeManager.createGestureHandler(
|
33
|
+
handlerTag,
|
34
|
+
new GestureClass(new GestureHandlerWebDelegate())
|
35
|
+
);
|
36
|
+
InteractionManager.getInstance().configureInteractions(
|
37
|
+
NodeManager.getHandler(handlerTag),
|
38
|
+
config as unknown as Config
|
39
|
+
);
|
40
|
+
} else {
|
41
|
+
if (!(handlerName in HammerGestures)) {
|
42
|
+
throw new Error(
|
43
|
+
`react-native-gesture-handler: ${handlerName} is not supported on web.`
|
44
|
+
);
|
45
|
+
}
|
46
|
+
|
47
|
+
// @ts-ignore If it doesn't exist, the error is thrown
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
49
|
+
const GestureClass = HammerGestures[handlerName];
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
51
|
+
HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
|
52
|
+
}
|
53
|
+
|
54
|
+
this.updateGestureHandler(handlerTag, config as unknown as Config);
|
55
|
+
},
|
56
|
+
attachGestureHandler(
|
57
|
+
handlerTag: number,
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
59
|
+
newView: any,
|
60
|
+
_actionType: ActionType,
|
61
|
+
propsRef: React.RefObject<unknown>
|
62
|
+
) {
|
63
|
+
if (
|
64
|
+
!(newView instanceof HTMLElement || newView instanceof React.Component)
|
65
|
+
) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
|
69
|
+
if (isNewWebImplementationEnabled()) {
|
70
|
+
//@ts-ignore Types should be HTMLElement or React.Component
|
71
|
+
NodeManager.getHandler(handlerTag).init(newView, propsRef);
|
72
|
+
} else {
|
73
|
+
//@ts-ignore Types should be HTMLElement or React.Component
|
74
|
+
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
75
|
+
}
|
76
|
+
},
|
77
|
+
updateGestureHandler(handlerTag: number, newConfig: Config) {
|
78
|
+
if (isNewWebImplementationEnabled()) {
|
79
|
+
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
80
|
+
|
81
|
+
InteractionManager.getInstance().configureInteractions(
|
82
|
+
NodeManager.getHandler(handlerTag),
|
83
|
+
newConfig
|
84
|
+
);
|
85
|
+
} else {
|
86
|
+
HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
87
|
+
}
|
88
|
+
},
|
89
|
+
getGestureHandlerNode(handlerTag: number) {
|
90
|
+
if (isNewWebImplementationEnabled()) {
|
91
|
+
return NodeManager.getHandler(handlerTag);
|
92
|
+
} else {
|
93
|
+
return HammerNodeManager.getHandler(handlerTag);
|
94
|
+
}
|
95
|
+
},
|
96
|
+
dropGestureHandler(handlerTag: number) {
|
97
|
+
if (isNewWebImplementationEnabled()) {
|
98
|
+
NodeManager.dropGestureHandler(handlerTag);
|
99
|
+
} else {
|
100
|
+
HammerNodeManager.dropGestureHandler(handlerTag);
|
101
|
+
}
|
102
|
+
},
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
104
|
+
flushOperations() {},
|
105
|
+
};
|
package/src/RNRenderer.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
};
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
2
|
+
// @ts-nocheck
|
3
|
+
export { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';
|
@@ -65,6 +65,10 @@ export interface RawButtonProps extends NativeViewGestureHandlerProps {
|
|
65
65
|
touchSoundDisabled?: boolean;
|
66
66
|
}
|
67
67
|
|
68
|
+
interface ButtonWithRefProps {
|
69
|
+
innerRef?: React.ForwardedRef<React.ComponentType<any>>;
|
70
|
+
}
|
71
|
+
|
68
72
|
export interface BaseButtonProps extends RawButtonProps {
|
69
73
|
/**
|
70
74
|
* Called when the button gets pressed (analogous to `onPress` in
|
@@ -94,6 +98,8 @@ export interface BaseButtonProps extends RawButtonProps {
|
|
94
98
|
delayLongPress?: number;
|
95
99
|
}
|
96
100
|
|
101
|
+
interface BaseButtonWithRefProps extends BaseButtonProps, ButtonWithRefProps {}
|
102
|
+
|
97
103
|
export interface RectButtonProps extends BaseButtonProps {
|
98
104
|
/**
|
99
105
|
* Background color that will be dimmed when button is in active state.
|
@@ -108,6 +114,8 @@ export interface RectButtonProps extends BaseButtonProps {
|
|
108
114
|
activeOpacity?: number;
|
109
115
|
}
|
110
116
|
|
117
|
+
interface RectButtonWithRefProps extends RectButtonProps, ButtonWithRefProps {}
|
118
|
+
|
111
119
|
export interface BorderlessButtonProps extends BaseButtonProps {
|
112
120
|
/**
|
113
121
|
* iOS only.
|
@@ -117,12 +125,16 @@ export interface BorderlessButtonProps extends BaseButtonProps {
|
|
117
125
|
activeOpacity?: number;
|
118
126
|
}
|
119
127
|
|
128
|
+
interface BorderlessButtonWithRefProps
|
129
|
+
extends BorderlessButtonProps,
|
130
|
+
ButtonWithRefProps {}
|
131
|
+
|
120
132
|
export const RawButton = createNativeWrapper(GestureHandlerButton, {
|
121
133
|
shouldCancelWhenOutside: false,
|
122
134
|
shouldActivateOnStart: false,
|
123
135
|
});
|
124
136
|
|
125
|
-
|
137
|
+
class InnerBaseButton extends React.Component<BaseButtonWithRefProps> {
|
126
138
|
static defaultProps = {
|
127
139
|
delayLongPress: 600,
|
128
140
|
};
|
@@ -222,6 +234,7 @@ export class BaseButton extends React.Component<BaseButtonProps> {
|
|
222
234
|
|
223
235
|
return (
|
224
236
|
<RawButton
|
237
|
+
ref={this.props.innerRef}
|
225
238
|
rippleColor={processColor(rippleColor)}
|
226
239
|
{...rest}
|
227
240
|
onGestureEvent={this.onGestureEvent}
|
@@ -231,6 +244,11 @@ export class BaseButton extends React.Component<BaseButtonProps> {
|
|
231
244
|
}
|
232
245
|
}
|
233
246
|
|
247
|
+
export const BaseButton = React.forwardRef<
|
248
|
+
any,
|
249
|
+
Omit<BaseButtonProps, 'innerRef'>
|
250
|
+
>((props, ref) => <InnerBaseButton innerRef={ref} {...props} />);
|
251
|
+
|
234
252
|
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
235
253
|
|
236
254
|
const btnStyles = StyleSheet.create({
|
@@ -243,7 +261,7 @@ const btnStyles = StyleSheet.create({
|
|
243
261
|
},
|
244
262
|
});
|
245
263
|
|
246
|
-
|
264
|
+
class InnerRectButton extends React.Component<RectButtonWithRefProps> {
|
247
265
|
static defaultProps = {
|
248
266
|
activeOpacity: 0.105,
|
249
267
|
underlayColor: 'black',
|
@@ -272,6 +290,7 @@ export class RectButton extends React.Component<RectButtonProps> {
|
|
272
290
|
return (
|
273
291
|
<BaseButton
|
274
292
|
{...rest}
|
293
|
+
ref={this.props.innerRef}
|
275
294
|
style={resolvedStyle}
|
276
295
|
onActiveStateChange={this.onActiveStateChange}>
|
277
296
|
<Animated.View
|
@@ -294,7 +313,12 @@ export class RectButton extends React.Component<RectButtonProps> {
|
|
294
313
|
}
|
295
314
|
}
|
296
315
|
|
297
|
-
export
|
316
|
+
export const RectButton = React.forwardRef<
|
317
|
+
any,
|
318
|
+
Omit<RectButtonProps, 'innerRef'>
|
319
|
+
>((props, ref) => <InnerRectButton innerRef={ref} {...props} />);
|
320
|
+
|
321
|
+
class InnerBorderlessButton extends React.Component<BorderlessButtonWithRefProps> {
|
298
322
|
static defaultProps = {
|
299
323
|
activeOpacity: 0.3,
|
300
324
|
borderless: true,
|
@@ -316,11 +340,14 @@ export class BorderlessButton extends React.Component<BorderlessButtonProps> {
|
|
316
340
|
};
|
317
341
|
|
318
342
|
render() {
|
319
|
-
const { children, style, ...rest } = this.props;
|
343
|
+
const { children, style, innerRef, ...rest } = this.props;
|
320
344
|
|
321
345
|
return (
|
322
346
|
<AnimatedBaseButton
|
323
347
|
{...rest}
|
348
|
+
// @ts-ignore We don't want `innerRef` to be accessible from public API.
|
349
|
+
// However in this case we need to set it indirectly on `BaseButton`, hence we use ts-ignore
|
350
|
+
innerRef={innerRef}
|
324
351
|
onActiveStateChange={this.onActiveStateChange}
|
325
352
|
style={[style, Platform.OS === 'ios' && { opacity: this.opacity }]}>
|
326
353
|
{children}
|
@@ -329,4 +356,9 @@ export class BorderlessButton extends React.Component<BorderlessButtonProps> {
|
|
329
356
|
}
|
330
357
|
}
|
331
358
|
|
359
|
+
export const BorderlessButton = React.forwardRef<
|
360
|
+
any,
|
361
|
+
Omit<BorderlessButtonProps, 'innerRef'>
|
362
|
+
>((props, ref) => <InnerBorderlessButton innerRef={ref} {...props} />);
|
363
|
+
|
332
364
|
export { default as PureNativeButton } from './GestureHandlerButton';
|
@@ -1,41 +1,148 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import {
|
3
|
-
|
3
|
+
PropsWithChildren,
|
4
|
+
ForwardedRef,
|
5
|
+
RefAttributes,
|
6
|
+
ReactElement,
|
7
|
+
} from 'react';
|
8
|
+
import {
|
9
|
+
ScrollView as RNScrollView,
|
10
|
+
ScrollViewProps as RNScrollViewProps,
|
4
11
|
Switch as RNSwitch,
|
12
|
+
SwitchProps as RNSwitchProps,
|
5
13
|
TextInput as RNTextInput,
|
6
|
-
|
7
|
-
|
8
|
-
|
14
|
+
TextInputProps as RNTextInputProps,
|
15
|
+
DrawerLayoutAndroid as RNDrawerLayoutAndroid,
|
16
|
+
DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps,
|
17
|
+
FlatList as RNFlatList,
|
18
|
+
FlatListProps as RNFlatListProps,
|
19
|
+
RefreshControl as RNRefreshControl,
|
9
20
|
} from 'react-native';
|
10
21
|
|
11
22
|
import createNativeWrapper from '../handlers/createNativeWrapper';
|
12
23
|
|
13
|
-
|
14
|
-
|
24
|
+
import {
|
25
|
+
NativeViewGestureHandlerProps,
|
26
|
+
nativeViewProps,
|
27
|
+
} from '../handlers/NativeViewGestureHandler';
|
28
|
+
|
29
|
+
import { toArray } from '../utils';
|
30
|
+
|
31
|
+
export const RefreshControl = createNativeWrapper(RNRefreshControl, {
|
32
|
+
disallowInterruption: true,
|
33
|
+
shouldCancelWhenOutside: false,
|
15
34
|
});
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
36
|
+
export type RefreshControl = typeof RefreshControl & RNRefreshControl;
|
37
|
+
|
38
|
+
const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
|
39
|
+
RNScrollView,
|
40
|
+
{
|
41
|
+
disallowInterruption: true,
|
42
|
+
shouldCancelWhenOutside: false,
|
43
|
+
}
|
44
|
+
);
|
45
|
+
export const ScrollView = React.forwardRef<
|
46
|
+
RNScrollView,
|
47
|
+
RNScrollViewProps & NativeViewGestureHandlerProps
|
48
|
+
>((props, ref) => {
|
49
|
+
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
50
|
+
const { refreshControl, waitFor, ...rest } = props;
|
16
51
|
|
17
|
-
|
52
|
+
return (
|
53
|
+
<GHScrollView
|
54
|
+
{...rest}
|
55
|
+
// @ts-ignore `ref` exists on `GHScrollView`
|
56
|
+
ref={ref}
|
57
|
+
waitFor={[...toArray(waitFor ?? []), refreshControlGestureRef]}
|
58
|
+
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
59
|
+
refreshControl={
|
60
|
+
refreshControl
|
61
|
+
? React.cloneElement(refreshControl, {
|
62
|
+
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
63
|
+
ref: refreshControlGestureRef,
|
64
|
+
})
|
65
|
+
: undefined
|
66
|
+
}
|
67
|
+
/>
|
68
|
+
);
|
69
|
+
});
|
70
|
+
// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
71
|
+
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
73
|
+
export type ScrollView = typeof GHScrollView & RNScrollView;
|
74
|
+
|
75
|
+
export const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {
|
18
76
|
shouldCancelWhenOutside: false,
|
19
77
|
shouldActivateOnStart: true,
|
20
78
|
disallowInterruption: true,
|
21
79
|
});
|
22
|
-
|
23
|
-
export
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
export
|
34
|
-
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
81
|
+
export type Switch = typeof Switch & RNSwitch;
|
82
|
+
|
83
|
+
export const TextInput = createNativeWrapper<RNTextInputProps>(RNTextInput);
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
85
|
+
export type TextInput = typeof TextInput & RNTextInput;
|
86
|
+
|
87
|
+
export const DrawerLayoutAndroid = createNativeWrapper<
|
88
|
+
PropsWithChildren<RNDrawerLayoutAndroidProps>
|
89
|
+
>(RNDrawerLayoutAndroid, { disallowInterruption: true });
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
91
|
+
export type DrawerLayoutAndroid = typeof DrawerLayoutAndroid &
|
92
|
+
RNDrawerLayoutAndroid;
|
93
|
+
|
94
|
+
export const FlatList = React.forwardRef((props, ref) => {
|
95
|
+
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
96
|
+
|
97
|
+
const { waitFor, refreshControl, ...rest } = props;
|
98
|
+
|
99
|
+
const flatListProps = {};
|
100
|
+
const scrollViewProps = {};
|
101
|
+
for (const [propName, value] of Object.entries(rest)) {
|
102
|
+
// https://github.com/microsoft/TypeScript/issues/26255
|
103
|
+
if ((nativeViewProps as readonly string[]).includes(propName)) {
|
104
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
106
|
+
scrollViewProps[propName] = value;
|
107
|
+
} else {
|
108
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
110
|
+
flatListProps[propName] = value;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
return (
|
115
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
35
116
|
<RNFlatList
|
36
117
|
ref={ref}
|
37
|
-
{...
|
38
|
-
renderScrollComponent={(scrollProps) =>
|
118
|
+
{...flatListProps}
|
119
|
+
renderScrollComponent={(scrollProps) => (
|
120
|
+
<ScrollView
|
121
|
+
{...{
|
122
|
+
...scrollProps,
|
123
|
+
...scrollViewProps,
|
124
|
+
waitFor: [...toArray(waitFor ?? []), refreshControlGestureRef],
|
125
|
+
}}
|
126
|
+
/>
|
127
|
+
)}
|
128
|
+
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
129
|
+
refreshControl={
|
130
|
+
refreshControl
|
131
|
+
? React.cloneElement(refreshControl, {
|
132
|
+
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
133
|
+
ref: refreshControlGestureRef,
|
134
|
+
})
|
135
|
+
: undefined
|
136
|
+
}
|
39
137
|
/>
|
40
|
-
)
|
41
|
-
)
|
138
|
+
);
|
139
|
+
}) as <ItemT = any>(
|
140
|
+
props: PropsWithChildren<
|
141
|
+
RNFlatListProps<ItemT> &
|
142
|
+
RefAttributes<FlatList<ItemT>> &
|
143
|
+
NativeViewGestureHandlerProps
|
144
|
+
>,
|
145
|
+
ref: ForwardedRef<FlatList<ItemT>>
|
146
|
+
) => ReactElement | null;
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
148
|
+
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import {
|
3
|
+
FlatList as RNFlatList,
|
4
|
+
Switch as RNSwitch,
|
5
|
+
TextInput as RNTextInput,
|
6
|
+
ScrollView as RNScrollView,
|
7
|
+
FlatListProps,
|
8
|
+
View,
|
9
|
+
} from 'react-native';
|
10
|
+
|
11
|
+
import createNativeWrapper from '../handlers/createNativeWrapper';
|
12
|
+
|
13
|
+
export const ScrollView = createNativeWrapper(RNScrollView, {
|
14
|
+
disallowInterruption: false,
|
15
|
+
});
|
16
|
+
|
17
|
+
export const Switch = createNativeWrapper(RNSwitch, {
|
18
|
+
shouldCancelWhenOutside: false,
|
19
|
+
shouldActivateOnStart: true,
|
20
|
+
disallowInterruption: true,
|
21
|
+
});
|
22
|
+
export const TextInput = createNativeWrapper(RNTextInput);
|
23
|
+
export const DrawerLayoutAndroid = () => {
|
24
|
+
console.warn('DrawerLayoutAndroid is not supported on web!');
|
25
|
+
return <View />;
|
26
|
+
};
|
27
|
+
|
28
|
+
// RefreshControl is implemented as a functional component, rendering a View
|
29
|
+
// NativeViewGestureHandler needs to set a ref on its child, which cannot be done
|
30
|
+
// on functional components
|
31
|
+
export const RefreshControl = createNativeWrapper(View);
|
32
|
+
|
33
|
+
export const FlatList = React.forwardRef(
|
34
|
+
<ItemT extends any>(props: FlatListProps<ItemT>, ref: any) => (
|
35
|
+
<RNFlatList
|
36
|
+
ref={ref}
|
37
|
+
{...props}
|
38
|
+
renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps} />}
|
39
|
+
/>
|
40
|
+
)
|
41
|
+
);
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import { HostComponent } from 'react-native';
|
2
|
+
import { RawButtonProps } from './GestureButtons';
|
3
|
+
import RNGestureHandlerButtonNativeComponent from '../specs/RNGestureHandlerButtonNativeComponent';
|
3
4
|
|
4
|
-
export default
|
5
|
-
<View ref={ref} accessibilityRole="button" {...props} />
|
6
|
-
));
|
5
|
+
export default RNGestureHandlerButtonNativeComponent as HostComponent<RawButtonProps>;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { PropsWithChildren } from 'react';
|
3
3
|
import { View, ViewProps, StyleSheet } from 'react-native';
|
4
|
+
import { maybeInitializeFabric } from '../init';
|
4
5
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
5
6
|
|
6
7
|
export interface GestureHandlerRootViewProps
|
@@ -10,6 +11,11 @@ export default function GestureHandlerRootView({
|
|
10
11
|
style,
|
11
12
|
...rest
|
12
13
|
}: GestureHandlerRootViewProps) {
|
14
|
+
// try initialize fabric on the first render, at this point we can
|
15
|
+
// reliably check if fabric is enabled (the function contains a flag
|
16
|
+
// to make sure it's called only once)
|
17
|
+
maybeInitializeFabric();
|
18
|
+
|
13
19
|
return (
|
14
20
|
<GestureHandlerRootViewContext.Provider value>
|
15
21
|
<View style={style ?? styles.container} {...rest} />
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { PropsWithChildren } from 'react';
|
3
3
|
import { View, ViewProps, StyleSheet } from 'react-native';
|
4
|
-
import { maybeInitializeFabric } from '../init';
|
5
4
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
6
5
|
|
7
6
|
export interface GestureHandlerRootViewProps
|
@@ -11,11 +10,6 @@ export default function GestureHandlerRootView({
|
|
11
10
|
style,
|
12
11
|
...rest
|
13
12
|
}: GestureHandlerRootViewProps) {
|
14
|
-
// try initialize fabric on the first render, at this point we can
|
15
|
-
// reliably check if fabric is enabled (the function contains a flag
|
16
|
-
// to make sure it's called only once)
|
17
|
-
maybeInitializeFabric();
|
18
|
-
|
19
13
|
return (
|
20
14
|
<GestureHandlerRootViewContext.Provider value>
|
21
15
|
<View style={style ?? styles.container} {...rest} />
|
@@ -1,3 +1,11 @@
|
|
1
|
+
import pack from 'react-native/package.json';
|
2
|
+
|
3
|
+
const [majorStr, minorStr] = pack.version.split('.');
|
4
|
+
const REACT_NATIVE_VERSION = {
|
5
|
+
major: parseInt(majorStr, 10),
|
6
|
+
minor: parseInt(minorStr, 10),
|
7
|
+
};
|
8
|
+
|
1
9
|
export function getReactNativeVersion() {
|
2
|
-
|
10
|
+
return REACT_NATIVE_VERSION;
|
3
11
|
}
|