react-native-gesture-handler 2.8.0 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/RNGestureHandler.podspec +2 -2
- package/android/build.gradle +107 -65
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +2 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +39 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +9 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +14 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +5 -1
- package/android/src/main/jni/CMakeLists.txt +10 -44
- package/android/src/main/jni/cpp-adapter.cpp +16 -13
- package/ios/Handlers/RNFlingHandler.m +39 -37
- package/ios/Handlers/RNForceTouchHandler.m +19 -17
- package/ios/Handlers/RNLongPressHandler.m +20 -22
- package/ios/Handlers/RNManualHandler.m +2 -3
- package/ios/Handlers/RNNativeViewHandler.mm +96 -92
- package/ios/Handlers/RNPanHandler.m +28 -32
- package/ios/Handlers/RNPinchHandler.m +9 -10
- package/ios/Handlers/RNRotationHandler.m +11 -14
- package/ios/Handlers/RNTapHandler.m +26 -26
- package/ios/RNGestureHandler.h +31 -24
- package/ios/RNGestureHandler.m +278 -273
- package/ios/RNGestureHandlerActionType.h +6 -4
- package/ios/RNGestureHandlerButton.m +11 -12
- package/ios/RNGestureHandlerButtonComponentView.h +2 -2
- package/ios/RNGestureHandlerButtonComponentView.mm +2 -2
- package/ios/RNGestureHandlerButtonManager.m +6 -5
- package/ios/RNGestureHandlerDirection.h +4 -4
- package/ios/RNGestureHandlerEvents.h +3 -4
- package/ios/RNGestureHandlerEvents.m +114 -119
- package/ios/RNGestureHandlerManager.h +1 -2
- package/ios/RNGestureHandlerManager.mm +9 -9
- package/ios/RNGestureHandlerModule.h +1 -2
- package/ios/RNGestureHandlerModule.mm +142 -138
- package/ios/RNGestureHandlerPointerTracker.h +1 -1
- package/ios/RNGestureHandlerPointerTracker.m +40 -37
- package/ios/RNGestureHandlerRegistry.h +3 -1
- package/ios/RNGestureHandlerRegistry.m +24 -22
- package/ios/RNGestureHandlerRootViewComponentView.mm +2 -2
- package/ios/RNGestureHandlerState.h +6 -6
- package/ios/RNGestureHandlerStateManager.h +1 -1
- package/ios/RNManualActivationRecognizer.m +9 -9
- package/ios/RNRootViewGestureRecognizer.m +39 -42
- 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/RNGestureHandlerModule.macos.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +6 -5
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js +3 -5
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/{GestureHandlerRootView.android.js → components/GestureHandlerRootView.android.js} +8 -7
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +8 -2
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/{GestureHandlerRootView.web.js → components/GestureHandlerRootView.web.js} +7 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +17 -3
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +2 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +3 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +3 -1
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +21 -13
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +5 -4
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +89 -37
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +22 -19
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +1 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/index.js +16 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +0 -6
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +3 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +0 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +2 -12
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -6
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -7
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +59 -0
- package/lib/commonjs/web/tools/CircularBuffer.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/PointerEventManager.js +27 -0
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +11 -7
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +111 -0
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
- package/lib/commonjs/web_hammer/GestureHandler.js +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- 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/RNGestureHandlerModule.macos.js +6 -6
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +6 -6
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +6 -6
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +5 -6
- package/lib/module/components/GestureComponents.web.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js +1 -4
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +14 -0
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/module/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +5 -2
- 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 +17 -3
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +2 -1
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js +3 -1
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js +3 -1
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +20 -13
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +5 -4
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +89 -38
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -16
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +1 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +0 -4
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -5
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +3 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +0 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -5
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +2 -9
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -5
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -6
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -7
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/CircularBuffer.js +50 -0
- package/lib/module/web/tools/CircularBuffer.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/PointerEventManager.js +27 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +8 -7
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +98 -0
- package/lib/module/web/tools/VelocityTracker.js.map +1 -0
- package/lib/module/web_hammer/GestureHandler.js +1 -1
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/typescript/EnableNewWebImplementation.d.ts +3 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +3 -0
- package/lib/typescript/components/DrawerLayout.d.ts +3 -1
- package/lib/typescript/components/GestureComponents.web.d.ts +1 -1
- package/lib/typescript/components/Swipeable.d.ts +14 -2
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +3 -0
- package/lib/typescript/index.d.ts +4 -4
- package/lib/typescript/{fabric → specs}/RNGestureHandlerButtonNativeComponent.d.ts +1 -1
- package/lib/typescript/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.d.ts +1 -1
- package/lib/typescript/utils.d.ts +0 -1
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -1
- package/lib/typescript/web/tools/CircularBuffer.d.ts +11 -0
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +12 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +13 -0
- package/package.json +6 -7
- package/src/EnableNewWebImplementation.ts +35 -0
- package/src/GestureHandlerRootViewContext.ts +3 -0
- package/src/RNGestureHandlerModule.macos.ts +6 -6
- package/src/RNGestureHandlerModule.web.ts +6 -6
- package/src/RNGestureHandlerModule.windows.ts +6 -6
- package/src/components/DrawerLayout.tsx +8 -4
- package/src/components/GestureComponents.web.tsx +5 -6
- package/src/components/GestureHandlerButton.tsx +2 -7
- package/src/components/GestureHandlerRootView.android.tsx +24 -0
- package/src/{GestureHandlerRootView.tsx → components/GestureHandlerRootView.tsx} +7 -2
- package/src/{GestureHandlerRootView.web.tsx → components/GestureHandlerRootView.web.tsx} +6 -1
- package/src/components/Swipeable.tsx +43 -12
- package/src/{gestureHandlerRootHOC.tsx → components/gestureHandlerRootHOC.tsx} +4 -1
- package/src/handlers/LongPressGestureHandler.ts +3 -1
- package/src/handlers/TapGestureHandler.ts +3 -1
- package/src/handlers/createHandler.tsx +20 -9
- package/src/handlers/gestureHandlerCommon.ts +5 -6
- package/src/handlers/gestures/GestureDetector.tsx +99 -36
- package/src/handlers/gestures/longPressGesture.ts +1 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +21 -20
- package/src/handlers/gestures/tapGesture.ts +1 -0
- package/src/index.ts +7 -3
- package/src/utils.ts +0 -5
- package/src/web/handlers/FlingGestureHandler.ts +0 -5
- package/src/web/handlers/GestureHandler.ts +3 -0
- package/src/web/handlers/LongPressGestureHandler.ts +0 -1
- package/src/web/handlers/ManualGestureHandler.ts +0 -5
- package/src/web/handlers/NativeViewGestureHandler.ts +0 -6
- package/src/web/handlers/PanGestureHandler.ts +2 -9
- package/src/web/handlers/PinchGestureHandler.ts +0 -5
- package/src/web/handlers/RotationGestureHandler.ts +0 -7
- package/src/web/handlers/TapGestureHandler.ts +0 -7
- package/src/web/tools/CircularBuffer.ts +42 -0
- package/src/web/tools/LeastSquareSolver.ts +182 -0
- package/src/web/tools/PointerEventManager.ts +29 -0
- package/src/web/tools/PointerTracker.ts +7 -7
- package/src/web/tools/VelocityTracker.ts +98 -0
- package/src/web_hammer/GestureHandler.ts +1 -1
- package/lib/commonjs/EnableExperimentalWebImplementation.js +0 -31
- package/lib/commonjs/EnableExperimentalWebImplementation.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.android.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/gestureHandlerRootHOC.js.map +0 -1
- package/lib/module/EnableExperimentalWebImplementation.js +0 -20
- package/lib/module/EnableExperimentalWebImplementation.js.map +0 -1
- package/lib/module/GestureHandlerRootView.android.js +0 -14
- package/lib/module/GestureHandlerRootView.android.js.map +0 -1
- package/lib/module/GestureHandlerRootView.js.map +0 -1
- package/lib/module/GestureHandlerRootView.web.js +0 -6
- package/lib/module/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/gestureHandlerRootHOC.js.map +0 -1
- package/lib/typescript/EnableExperimentalWebImplementation.d.ts +0 -2
- package/lib/typescript/gestureHandlerRootHOC.d.ts +0 -3
- package/src/EnableExperimentalWebImplementation.ts +0 -27
- package/src/GestureHandlerRootView.android.tsx +0 -24
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
- /package/lib/typescript/{GestureHandlerRootView.android.d.ts → components/GestureHandlerRootView.android.d.ts} +0 -0
- /package/lib/typescript/{GestureHandlerRootView.d.ts → components/GestureHandlerRootView.d.ts} +0 -0
- /package/lib/typescript/{GestureHandlerRootView.web.d.ts → components/GestureHandlerRootView.web.d.ts} +0 -0
- /package/src/{fabric → specs}/RNGestureHandlerButtonNativeComponent.ts +0 -0
- /package/src/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.ts +0 -0
@@ -36,6 +36,11 @@ type SwipeableExcludes = Exclude<
|
|
36
36
|
'onGestureEvent' | 'onHandlerStateChange'
|
37
37
|
>;
|
38
38
|
|
39
|
+
// Animated.AnimatedInterpolation has been converted to a generic type
|
40
|
+
// in @types/react-native 0.70. This way we can maintain compatibility
|
41
|
+
// with all versions of @types/react-native
|
42
|
+
type AnimatedInterpolation = ReturnType<Animated.Value['interpolate']>;
|
43
|
+
|
39
44
|
export interface SwipeableProps
|
40
45
|
extends Pick<PanGestureHandlerProps, SwipeableExcludes> {
|
41
46
|
/**
|
@@ -68,6 +73,18 @@ export interface SwipeableProps
|
|
68
73
|
*/
|
69
74
|
rightThreshold?: number;
|
70
75
|
|
76
|
+
/**
|
77
|
+
* Distance that the panel must be dragged from the left edge to be considered
|
78
|
+
* a swipe. The default value is 10.
|
79
|
+
*/
|
80
|
+
dragOffsetFromLeftEdge?: number;
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Distance that the panel must be dragged from the right edge to be considered
|
84
|
+
* a swipe. The default value is 10.
|
85
|
+
*/
|
86
|
+
dragOffsetFromRightEdge?: number;
|
87
|
+
|
71
88
|
/**
|
72
89
|
* Value indicating if the swipeable panel can be pulled further than the left
|
73
90
|
* actions panel's width. It is set to true by default as long as the left
|
@@ -150,8 +167,9 @@ export interface SwipeableProps
|
|
150
167
|
* To support `rtl` flexbox layouts use `flexDirection` styling.
|
151
168
|
* */
|
152
169
|
renderLeftActions?: (
|
153
|
-
progressAnimatedValue:
|
154
|
-
dragAnimatedValue:
|
170
|
+
progressAnimatedValue: AnimatedInterpolation,
|
171
|
+
dragAnimatedValue: AnimatedInterpolation,
|
172
|
+
swipeable: Swipeable
|
155
173
|
) => React.ReactNode;
|
156
174
|
/**
|
157
175
|
*
|
@@ -163,8 +181,8 @@ export interface SwipeableProps
|
|
163
181
|
* To support `rtl` flexbox layouts use `flexDirection` styling.
|
164
182
|
* */
|
165
183
|
renderRightActions?: (
|
166
|
-
progressAnimatedValue:
|
167
|
-
dragAnimatedValue:
|
184
|
+
progressAnimatedValue: AnimatedInterpolation,
|
185
|
+
dragAnimatedValue: AnimatedInterpolation,
|
168
186
|
swipeable: Swipeable
|
169
187
|
) => React.ReactNode;
|
170
188
|
|
@@ -242,11 +260,11 @@ export default class Swipeable extends Component<
|
|
242
260
|
private onGestureEvent?: (
|
243
261
|
event: GestureEvent<PanGestureHandlerEventPayload>
|
244
262
|
) => void;
|
245
|
-
private transX?:
|
246
|
-
private showLeftAction?:
|
247
|
-
private leftActionTranslate?:
|
248
|
-
private showRightAction?:
|
249
|
-
private rightActionTranslate?:
|
263
|
+
private transX?: AnimatedInterpolation;
|
264
|
+
private showLeftAction?: AnimatedInterpolation | Animated.Value;
|
265
|
+
private leftActionTranslate?: AnimatedInterpolation;
|
266
|
+
private showRightAction?: AnimatedInterpolation | Animated.Value;
|
267
|
+
private rightActionTranslate?: AnimatedInterpolation;
|
250
268
|
|
251
269
|
private updateAnimatedEvent = (
|
252
270
|
props: SwipeableProps,
|
@@ -437,9 +455,22 @@ export default class Swipeable extends Component<
|
|
437
455
|
this.animateRow(this.currentOffset(), -rightWidth);
|
438
456
|
};
|
439
457
|
|
458
|
+
reset = () => {
|
459
|
+
const { dragX, rowTranslation } = this.state;
|
460
|
+
dragX.setValue(0);
|
461
|
+
rowTranslation.setValue(0);
|
462
|
+
this.setState({ rowState: 0 });
|
463
|
+
};
|
464
|
+
|
440
465
|
render() {
|
441
466
|
const { rowState } = this.state;
|
442
|
-
const {
|
467
|
+
const {
|
468
|
+
children,
|
469
|
+
renderLeftActions,
|
470
|
+
renderRightActions,
|
471
|
+
dragOffsetFromLeftEdge = 10,
|
472
|
+
dragOffsetFromRightEdge = 10,
|
473
|
+
} = this.props;
|
443
474
|
|
444
475
|
const left = renderLeftActions && (
|
445
476
|
<Animated.View
|
@@ -450,7 +481,7 @@ export default class Swipeable extends Component<
|
|
450
481
|
// it for some reason
|
451
482
|
{ transform: [{ translateX: this.leftActionTranslate! }] },
|
452
483
|
]}>
|
453
|
-
{renderLeftActions(this.showLeftAction!, this.transX
|
484
|
+
{renderLeftActions(this.showLeftAction!, this.transX!, this)}
|
454
485
|
<View
|
455
486
|
onLayout={({ nativeEvent }) =>
|
456
487
|
this.setState({ leftWidth: nativeEvent.layout.x })
|
@@ -476,7 +507,7 @@ export default class Swipeable extends Component<
|
|
476
507
|
|
477
508
|
return (
|
478
509
|
<PanGestureHandler
|
479
|
-
activeOffsetX={[-
|
510
|
+
activeOffsetX={[-dragOffsetFromRightEdge, dragOffsetFromLeftEdge]}
|
480
511
|
{...this.props}
|
481
512
|
onGestureEvent={this.onGestureEvent}
|
482
513
|
onHandlerStateChange={this.onHandlerStateChange}>
|
@@ -3,7 +3,9 @@ import { StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
4
4
|
import GestureHandlerRootView from './GestureHandlerRootView';
|
5
5
|
|
6
|
-
export default function gestureHandlerRootHOC<
|
6
|
+
export default function gestureHandlerRootHOC<
|
7
|
+
P extends Record<string, unknown>
|
8
|
+
>(
|
7
9
|
Component: React.ComponentType<P>,
|
8
10
|
containerStyles?: StyleProp<ViewStyle>
|
9
11
|
): React.ComponentType<P> {
|
@@ -19,6 +21,7 @@ export default function gestureHandlerRootHOC<P>(
|
|
19
21
|
Component.displayName || Component.name
|
20
22
|
})`;
|
21
23
|
|
24
|
+
// @ts-ignore - hoistNonReactStatics uses old version of @types/react
|
22
25
|
hoistNonReactStatics(Wrapper, Component);
|
23
26
|
|
24
27
|
return Wrapper;
|
@@ -28,6 +28,7 @@ import { ValueOf } from '../typeUtils';
|
|
28
28
|
import { isFabric, isJestEnv, tagMessage } from '../utils';
|
29
29
|
import { ActionType } from '../ActionType';
|
30
30
|
import { PressabilityDebugView } from './PressabilityDebugView';
|
31
|
+
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
31
32
|
|
32
33
|
const UIManagerAny = UIManager as any;
|
33
34
|
|
@@ -168,13 +169,14 @@ export default function createHandler<
|
|
168
169
|
HandlerState
|
169
170
|
> {
|
170
171
|
static displayName = name;
|
172
|
+
static contextType = GestureHandlerRootViewContext;
|
171
173
|
|
172
174
|
private handlerTag: number;
|
173
175
|
private config: Record<string, unknown>;
|
174
176
|
private propsRef: React.MutableRefObject<unknown>;
|
177
|
+
private isMountedRef: React.MutableRefObject<boolean | null>;
|
175
178
|
private viewNode: any;
|
176
179
|
private viewTag?: number;
|
177
|
-
private updateEnqueued: ReturnType<typeof setImmediate> | null = null;
|
178
180
|
private inspectorToggleListener?: EmitterSubscription;
|
179
181
|
|
180
182
|
constructor(props: T & InternalEventHandlers) {
|
@@ -182,6 +184,7 @@ export default function createHandler<
|
|
182
184
|
this.handlerTag = getNextHandlerTag();
|
183
185
|
this.config = {};
|
184
186
|
this.propsRef = React.createRef();
|
187
|
+
this.isMountedRef = React.createRef();
|
185
188
|
this.state = { allowTouches };
|
186
189
|
if (props.id) {
|
187
190
|
if (handlerIDToTag[props.id] !== undefined) {
|
@@ -193,6 +196,7 @@ export default function createHandler<
|
|
193
196
|
|
194
197
|
componentDidMount() {
|
195
198
|
const props: HandlerProps<U> = this.props;
|
199
|
+
this.isMountedRef.current = true;
|
196
200
|
|
197
201
|
if (DEV_ON_ANDROID) {
|
198
202
|
this.inspectorToggleListener = DeviceEventEmitter.addListener(
|
@@ -207,11 +211,10 @@ export default function createHandler<
|
|
207
211
|
// If there are unresolved refs (e.g. ".current" has not yet been set)
|
208
212
|
// passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to
|
209
213
|
// _update method that will try to update native handler props using
|
210
|
-
//
|
214
|
+
// queueMicrotask. This makes it so update() function gets called after all
|
211
215
|
// react components are mounted and we expect the missing ref object to
|
212
216
|
// be resolved by then.
|
213
|
-
|
214
|
-
this.updateEnqueued = null;
|
217
|
+
queueMicrotask(() => {
|
215
218
|
this.update(UNRESOLVED_REFS_RETRY_LIMIT);
|
216
219
|
});
|
217
220
|
}
|
@@ -237,11 +240,9 @@ export default function createHandler<
|
|
237
240
|
|
238
241
|
componentWillUnmount() {
|
239
242
|
this.inspectorToggleListener?.remove();
|
243
|
+
this.isMountedRef.current = false;
|
240
244
|
RNGestureHandlerModule.dropGestureHandler(this.handlerTag);
|
241
245
|
scheduleFlushOperations();
|
242
|
-
if (this.updateEnqueued) {
|
243
|
-
clearImmediate(this.updateEnqueued);
|
244
|
-
}
|
245
246
|
// 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
|
246
247
|
const handlerID: string | undefined = this.props.id;
|
247
248
|
if (handlerID) {
|
@@ -365,14 +366,17 @@ export default function createHandler<
|
|
365
366
|
};
|
366
367
|
|
367
368
|
private update(remainingTries: number) {
|
369
|
+
if (!this.isMountedRef.current) {
|
370
|
+
return;
|
371
|
+
}
|
372
|
+
|
368
373
|
const props: HandlerProps<U> = this.props;
|
369
374
|
|
370
375
|
// When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of
|
371
376
|
// `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying
|
372
377
|
// again is easy enough fix.
|
373
378
|
if (hasUnresolvedRefs(props) && remainingTries > 0) {
|
374
|
-
|
375
|
-
this.updateEnqueued = null;
|
379
|
+
queueMicrotask(() => {
|
376
380
|
this.update(remainingTries - 1);
|
377
381
|
});
|
378
382
|
} else {
|
@@ -398,6 +402,13 @@ export default function createHandler<
|
|
398
402
|
}
|
399
403
|
|
400
404
|
render() {
|
405
|
+
if (__DEV__ && !this.context) {
|
406
|
+
throw new Error(
|
407
|
+
name +
|
408
|
+
' 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.'
|
409
|
+
);
|
410
|
+
}
|
411
|
+
|
401
412
|
let gestureEventHandler = this.onGestureHandlerEvent;
|
402
413
|
// Another instance of https://github.com/microsoft/TypeScript/issues/13995
|
403
414
|
type OnGestureEventHandlers = {
|
@@ -191,16 +191,15 @@ export function findNodeHandle(
|
|
191
191
|
return findNodeHandleRN(node);
|
192
192
|
}
|
193
193
|
|
194
|
-
let
|
195
|
-
typeof requestAnimationFrame
|
196
|
-
> | null = null;
|
194
|
+
let flushOperationsScheduled = false;
|
197
195
|
|
198
196
|
export function scheduleFlushOperations() {
|
199
|
-
if (
|
200
|
-
|
197
|
+
if (!flushOperationsScheduled) {
|
198
|
+
flushOperationsScheduled = true;
|
199
|
+
queueMicrotask(() => {
|
201
200
|
RNGestureHandlerModule.flushOperations();
|
202
201
|
|
203
|
-
|
202
|
+
flushOperationsScheduled = false;
|
204
203
|
});
|
205
204
|
}
|
206
205
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useRef,
|
1
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
2
2
|
import {
|
3
3
|
GestureType,
|
4
4
|
HandlerCallbacks,
|
@@ -42,7 +42,9 @@ import { Platform } from 'react-native';
|
|
42
42
|
import type RNGestureHandlerModuleWeb from '../../RNGestureHandlerModule.web';
|
43
43
|
import { onGestureHandlerEvent } from './eventReceiver';
|
44
44
|
import { RNRenderer } from '../../RNRenderer';
|
45
|
-
import {
|
45
|
+
import { isNewWebImplementationEnabled } from '../../EnableNewWebImplementation';
|
46
|
+
import { nativeViewGestureHandlerProps } from '../NativeViewGestureHandler';
|
47
|
+
import GestureHandlerRootViewContext from '../../GestureHandlerRootViewContext';
|
46
48
|
|
47
49
|
declare const global: {
|
48
50
|
isFormsStackingContext: (node: unknown) => boolean | null; // JSI function
|
@@ -56,6 +58,7 @@ const ALLOWED_PROPS = [
|
|
56
58
|
...longPressGestureHandlerProps,
|
57
59
|
...forceTouchGestureHandlerProps,
|
58
60
|
...flingGestureHandlerProps,
|
61
|
+
...nativeViewGestureHandlerProps,
|
59
62
|
];
|
60
63
|
|
61
64
|
export type GestureConfigReference = {
|
@@ -130,6 +133,7 @@ interface AttachHandlersConfig {
|
|
130
133
|
gesture: GestureType[];
|
131
134
|
viewTag: number;
|
132
135
|
webEventHandlersRef: React.RefObject<WebEventHandler>;
|
136
|
+
mountedRef: React.RefObject<boolean>;
|
133
137
|
}
|
134
138
|
|
135
139
|
function attachHandlers({
|
@@ -138,6 +142,7 @@ function attachHandlers({
|
|
138
142
|
gesture,
|
139
143
|
viewTag,
|
140
144
|
webEventHandlersRef,
|
145
|
+
mountedRef,
|
141
146
|
}: AttachHandlersConfig) {
|
142
147
|
if (!preparedGesture.firstExecution) {
|
143
148
|
gestureConfig.initialize();
|
@@ -145,9 +150,12 @@ function attachHandlers({
|
|
145
150
|
preparedGesture.firstExecution = false;
|
146
151
|
}
|
147
152
|
|
148
|
-
// use
|
153
|
+
// use queueMicrotask to extract handlerTags, because all refs should be initialized
|
149
154
|
// when it's ran
|
150
|
-
|
155
|
+
queueMicrotask(() => {
|
156
|
+
if (!mountedRef.current) {
|
157
|
+
return;
|
158
|
+
}
|
151
159
|
gestureConfig.prepare();
|
152
160
|
});
|
153
161
|
|
@@ -162,9 +170,12 @@ function attachHandlers({
|
|
162
170
|
registerHandler(handler.handlerTag, handler, handler.config.testId);
|
163
171
|
}
|
164
172
|
|
165
|
-
// use
|
173
|
+
// use queueMicrotask to extract handlerTags, because all refs should be initialized
|
166
174
|
// when it's ran
|
167
|
-
|
175
|
+
queueMicrotask(() => {
|
176
|
+
if (!mountedRef.current) {
|
177
|
+
return;
|
178
|
+
}
|
168
179
|
for (const handler of gesture) {
|
169
180
|
let requireToFail: number[] = [];
|
170
181
|
if (handler.config.requireToFail) {
|
@@ -230,7 +241,7 @@ function updateHandlers(
|
|
230
241
|
preparedGesture: GestureConfigReference,
|
231
242
|
gestureConfig: ComposedGesture | GestureType,
|
232
243
|
gesture: GestureType[],
|
233
|
-
mountedRef: RefObject<boolean>
|
244
|
+
mountedRef: React.RefObject<boolean>
|
234
245
|
) {
|
235
246
|
gestureConfig.prepare();
|
236
247
|
|
@@ -246,10 +257,10 @@ function updateHandlers(
|
|
246
257
|
}
|
247
258
|
}
|
248
259
|
|
249
|
-
// use
|
260
|
+
// use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
|
250
261
|
// and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
|
251
262
|
// in case of external relations)
|
252
|
-
|
263
|
+
queueMicrotask(() => {
|
253
264
|
if (!mountedRef.current) {
|
254
265
|
return;
|
255
266
|
}
|
@@ -588,7 +599,20 @@ interface GestureDetectorProps {
|
|
588
599
|
userSelect?: UserSelect;
|
589
600
|
children?: React.ReactNode;
|
590
601
|
}
|
602
|
+
interface GestureDetectorState {
|
603
|
+
firstRender: boolean;
|
604
|
+
viewRef: React.Component | null;
|
605
|
+
previousViewTag: number;
|
606
|
+
forceReattach: boolean;
|
607
|
+
}
|
591
608
|
export const GestureDetector = (props: GestureDetectorProps) => {
|
609
|
+
const rootViewContext = useContext(GestureHandlerRootViewContext);
|
610
|
+
if (__DEV__ && !rootViewContext) {
|
611
|
+
throw new Error(
|
612
|
+
'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'
|
613
|
+
);
|
614
|
+
}
|
615
|
+
|
592
616
|
const gestureConfig = props.gesture;
|
593
617
|
|
594
618
|
if (props.userSelect) {
|
@@ -597,20 +621,31 @@ export const GestureDetector = (props: GestureDetectorProps) => {
|
|
597
621
|
|
598
622
|
const gesture = gestureConfig.toGestureArray();
|
599
623
|
const useReanimatedHook = gesture.some((g) => g.shouldUseReanimated);
|
600
|
-
|
601
|
-
|
624
|
+
|
625
|
+
// store state in ref to prevent unnecessary renders
|
626
|
+
const state = useRef<GestureDetectorState>({
|
627
|
+
firstRender: true,
|
628
|
+
viewRef: null,
|
629
|
+
previousViewTag: -1,
|
630
|
+
forceReattach: false,
|
631
|
+
}).current;
|
602
632
|
const mountedRef = useRef(false);
|
603
633
|
const webEventHandlersRef = useRef<WebEventHandler>({
|
604
634
|
onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {
|
605
635
|
onGestureHandlerEvent(e.nativeEvent);
|
606
636
|
},
|
607
|
-
onGestureHandlerStateChange:
|
637
|
+
onGestureHandlerStateChange: isNewWebImplementationEnabled()
|
608
638
|
? (e: HandlerStateChangeEvent<unknown>) => {
|
609
639
|
onGestureHandlerEvent(e.nativeEvent);
|
610
640
|
}
|
611
641
|
: undefined,
|
612
642
|
});
|
613
643
|
|
644
|
+
const [renderState, setRenderState] = useState(false);
|
645
|
+
function forceRender() {
|
646
|
+
setRenderState(!renderState);
|
647
|
+
}
|
648
|
+
|
614
649
|
const preparedGesture = React.useRef<GestureConfigReference>({
|
615
650
|
config: gesture,
|
616
651
|
animatedEventHandler: null,
|
@@ -627,10 +662,41 @@ export const GestureDetector = (props: GestureDetectorProps) => {
|
|
627
662
|
);
|
628
663
|
}
|
629
664
|
|
665
|
+
function onHandlersUpdate(skipConfigUpdate?: boolean) {
|
666
|
+
// if the underlying view has changed we need to reattach handlers to the new view
|
667
|
+
const viewTag = findNodeHandle(state.viewRef) as number;
|
668
|
+
const forceReattach = viewTag !== state.previousViewTag;
|
669
|
+
|
670
|
+
if (forceReattach || needsToReattach(preparedGesture, gesture)) {
|
671
|
+
validateDetectorChildren(state.viewRef);
|
672
|
+
dropHandlers(preparedGesture);
|
673
|
+
attachHandlers({
|
674
|
+
preparedGesture,
|
675
|
+
gestureConfig,
|
676
|
+
gesture,
|
677
|
+
webEventHandlersRef,
|
678
|
+
viewTag,
|
679
|
+
mountedRef,
|
680
|
+
});
|
681
|
+
|
682
|
+
state.previousViewTag = viewTag;
|
683
|
+
state.forceReattach = forceReattach;
|
684
|
+
if (forceReattach) {
|
685
|
+
forceRender();
|
686
|
+
}
|
687
|
+
} else if (!skipConfigUpdate) {
|
688
|
+
updateHandlers(preparedGesture, gestureConfig, gesture, mountedRef);
|
689
|
+
}
|
690
|
+
}
|
691
|
+
|
630
692
|
// Reanimated event should be rebuilt only when gestures are reattached, otherwise
|
631
693
|
// config update will be enough as all necessary items are stored in shared values anyway
|
632
694
|
const needsToRebuildReanimatedEvent =
|
633
|
-
preparedGesture.firstExecution ||
|
695
|
+
preparedGesture.firstExecution ||
|
696
|
+
needsToReattach(preparedGesture, gesture) ||
|
697
|
+
state.forceReattach;
|
698
|
+
|
699
|
+
state.forceReattach = false;
|
634
700
|
|
635
701
|
if (preparedGesture.firstExecution) {
|
636
702
|
gestureConfig.initialize();
|
@@ -643,17 +709,19 @@ export const GestureDetector = (props: GestureDetectorProps) => {
|
|
643
709
|
}
|
644
710
|
|
645
711
|
useEffect(() => {
|
646
|
-
|
712
|
+
const viewTag = findNodeHandle(state.viewRef) as number;
|
713
|
+
state.firstRender = true;
|
647
714
|
mountedRef.current = true;
|
648
|
-
const viewTag = findNodeHandle(viewRef.current) as number;
|
649
715
|
|
650
|
-
validateDetectorChildren(viewRef
|
716
|
+
validateDetectorChildren(state.viewRef);
|
717
|
+
|
651
718
|
attachHandlers({
|
652
719
|
preparedGesture,
|
653
720
|
gestureConfig,
|
654
721
|
gesture,
|
655
|
-
viewTag,
|
656
722
|
webEventHandlersRef,
|
723
|
+
viewTag,
|
724
|
+
mountedRef,
|
657
725
|
});
|
658
726
|
|
659
727
|
return () => {
|
@@ -663,31 +731,26 @@ export const GestureDetector = (props: GestureDetectorProps) => {
|
|
663
731
|
}, []);
|
664
732
|
|
665
733
|
useEffect(() => {
|
666
|
-
if (!
|
667
|
-
|
668
|
-
|
669
|
-
if (needsToReattach(preparedGesture, gesture)) {
|
670
|
-
validateDetectorChildren(viewRef.current);
|
671
|
-
dropHandlers(preparedGesture);
|
672
|
-
attachHandlers({
|
673
|
-
preparedGesture,
|
674
|
-
gestureConfig,
|
675
|
-
gesture,
|
676
|
-
viewTag,
|
677
|
-
webEventHandlersRef,
|
678
|
-
});
|
679
|
-
} else {
|
680
|
-
updateHandlers(preparedGesture, gestureConfig, gesture, mountedRef);
|
681
|
-
}
|
734
|
+
if (!state.firstRender) {
|
735
|
+
onHandlersUpdate();
|
682
736
|
} else {
|
683
|
-
|
737
|
+
state.firstRender = false;
|
684
738
|
}
|
685
739
|
}, [props]);
|
686
740
|
|
687
741
|
const refFunction = (ref: unknown) => {
|
688
742
|
if (ref !== null) {
|
689
|
-
|
690
|
-
viewRef
|
743
|
+
// @ts-ignore Just setting the view ref
|
744
|
+
state.viewRef = ref;
|
745
|
+
|
746
|
+
// if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed
|
747
|
+
if (state.previousViewTag === -1) {
|
748
|
+
state.previousViewTag = findNodeHandle(state.viewRef) as number;
|
749
|
+
}
|
750
|
+
|
751
|
+
// pass true as `skipConfigUpdate`, here we only want to trigger the eventual reattaching of handlers
|
752
|
+
// in case the view has changed, while config update would be handled be the `useEffect` above
|
753
|
+
onHandlersUpdate(true);
|
691
754
|
|
692
755
|
if (isFabric()) {
|
693
756
|
const node = getShadowNodeFromRef(ref);
|
@@ -29,27 +29,28 @@ let Reanimated: {
|
|
29
29
|
|
30
30
|
try {
|
31
31
|
Reanimated = require('react-native-reanimated');
|
32
|
+
} catch (e) {
|
33
|
+
// When 'react-native-reanimated' is not available we want to quietly continue
|
34
|
+
// @ts-ignore TS demands the variable to be initialized
|
35
|
+
Reanimated = undefined;
|
36
|
+
}
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
38
|
+
if (!Reanimated?.useSharedValue) {
|
39
|
+
// @ts-ignore Make sure the loaded module is actually Reanimated, if it's not
|
40
|
+
// reset the module to undefined so we can fallback to the default implementation
|
41
|
+
Reanimated = undefined;
|
42
|
+
}
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
)
|
48
|
-
|
49
|
-
}
|
50
|
-
|
51
|
-
// quietly continue
|
52
|
-
// eslint-disable-next-line no-empty
|
53
|
-
} catch (e) {}
|
44
|
+
if (Reanimated !== undefined && !Reanimated.setGestureState) {
|
45
|
+
// The loaded module is Reanimated but it doesn't have the setGestureState defined
|
46
|
+
Reanimated.setGestureState = () => {
|
47
|
+
'worklet';
|
48
|
+
console.warn(
|
49
|
+
tagMessage(
|
50
|
+
'Please use newer version of react-native-reanimated in order to control state of the gestures.'
|
51
|
+
)
|
52
|
+
);
|
53
|
+
};
|
54
|
+
}
|
54
55
|
|
55
56
|
export { Reanimated };
|
package/src/index.ts
CHANGED
@@ -2,8 +2,8 @@ import { initialize } from './init';
|
|
2
2
|
|
3
3
|
export { Directions } from './Directions';
|
4
4
|
export { State } from './State';
|
5
|
-
export { default as gestureHandlerRootHOC } from './gestureHandlerRootHOC';
|
6
|
-
export { default as GestureHandlerRootView } from './GestureHandlerRootView';
|
5
|
+
export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
|
6
|
+
export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
|
7
7
|
export type {
|
8
8
|
// event types
|
9
9
|
GestureEvent,
|
@@ -92,6 +92,7 @@ export {
|
|
92
92
|
BaseButton,
|
93
93
|
RectButton,
|
94
94
|
BorderlessButton,
|
95
|
+
PureNativeButton,
|
95
96
|
} from './components/GestureButtons';
|
96
97
|
export {
|
97
98
|
TouchableHighlight,
|
@@ -157,6 +158,9 @@ export type {
|
|
157
158
|
} from './components/DrawerLayout';
|
158
159
|
export { default as DrawerLayout } from './components/DrawerLayout';
|
159
160
|
|
160
|
-
export {
|
161
|
+
export {
|
162
|
+
enableExperimentalWebImplementation,
|
163
|
+
enableLegacyWebImplementation,
|
164
|
+
} from './EnableNewWebImplementation';
|
161
165
|
|
162
166
|
initialize();
|
package/src/utils.ts
CHANGED
@@ -55,11 +55,6 @@ export function isFabric(): boolean {
|
|
55
55
|
return !!global?.nativeFabricUIManager;
|
56
56
|
}
|
57
57
|
|
58
|
-
export function shouldUseCodegenNativeComponent(): boolean {
|
59
|
-
// use codegenNativeComponent starting with RN 0.68
|
60
|
-
return REACT_NATIVE_VERSION.minor >= 68 || REACT_NATIVE_VERSION.major > 0;
|
61
|
-
}
|
62
|
-
|
63
58
|
export function isRemoteDebuggingEnabled(): boolean {
|
64
59
|
// react-native-reanimated checks if in remote debugging in the same way
|
65
60
|
// @ts-ignore global is available but node types are not included
|
@@ -159,11 +159,6 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
159
159
|
this.endFling();
|
160
160
|
}
|
161
161
|
|
162
|
-
protected onPointerCancel(event: AdaptedEvent): void {
|
163
|
-
super.onPointerCancel(event);
|
164
|
-
this.reset();
|
165
|
-
}
|
166
|
-
|
167
162
|
public activate(force?: boolean): void {
|
168
163
|
super.activate(force);
|
169
164
|
this.end();
|
@@ -352,6 +352,9 @@ export default abstract class GestureHandler {
|
|
352
352
|
if (this.config.needsPointerData) {
|
353
353
|
this.sendTouchEvent(event);
|
354
354
|
}
|
355
|
+
|
356
|
+
this.cancel();
|
357
|
+
this.reset();
|
355
358
|
}
|
356
359
|
protected onPointerOutOfBounds(event: AdaptedEvent): void {
|
357
360
|
this.tryToSendMoveEvent(true);
|