react-native-gesture-handler 2.8.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RNBetterSwipeGestureRecognizer : UISwipeGestureRecognizer
|
|
4
4
|
|
|
5
|
-
- (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler;
|
|
5
|
+
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
|
|
6
6
|
|
|
7
7
|
@end
|
|
8
8
|
|
|
9
9
|
@implementation RNBetterSwipeGestureRecognizer {
|
|
10
|
-
__weak RNGestureHandler*
|
|
10
|
+
__weak RNGestureHandler *_gestureHandler;
|
|
11
11
|
CGPoint _lastPoint; // location of the most recently updated touch, relative to the view
|
|
12
12
|
bool _hasBegan; // whether the `BEGAN` event has been sent
|
|
13
13
|
}
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
28
28
|
[_gestureHandler reset];
|
|
29
29
|
[super touchesBegan:touches withEvent:event];
|
|
30
|
+
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
30
31
|
|
|
31
32
|
// self.numberOfTouches doesn't work for this because in case than one finger is required,
|
|
32
33
|
// when holding one finger on the screen and tapping with the second one, numberOfTouches is equal
|
|
@@ -35,8 +36,6 @@
|
|
|
35
36
|
[self triggerAction];
|
|
36
37
|
_hasBegan = YES;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
|
@@ -73,7 +72,8 @@
|
|
|
73
72
|
[super reset];
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
- (CGPoint)getLastLocation
|
|
75
|
+
- (CGPoint)getLastLocation
|
|
76
|
+
{
|
|
77
77
|
// I think keeping the location of only one touch is enough since it would be used to determine the direction
|
|
78
78
|
// of the movement, and if it's wrong the recognizer fails anyway.
|
|
79
79
|
// In case the location of all touches is required, touch events are the way to go
|
|
@@ -103,48 +103,50 @@
|
|
|
103
103
|
|
|
104
104
|
- (void)configure:(NSDictionary *)config
|
|
105
105
|
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
[super configure:config];
|
|
107
|
+
UISwipeGestureRecognizer *recognizer = (UISwipeGestureRecognizer *)_recognizer;
|
|
108
|
+
|
|
109
|
+
id prop = config[@"direction"];
|
|
110
|
+
if (prop != nil) {
|
|
111
|
+
recognizer.direction = [RCTConvert NSInteger:prop];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
114
|
#if !TARGET_OS_TV
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
prop = config[@"numberOfPointers"];
|
|
116
|
+
if (prop != nil) {
|
|
117
|
+
recognizer.numberOfTouchesRequired = [RCTConvert NSInteger:prop];
|
|
118
|
+
}
|
|
119
119
|
#endif
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
|
123
123
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
RNGestureHandlerState savedState = _lastState;
|
|
125
|
+
BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer];
|
|
126
|
+
_lastState = savedState;
|
|
127
|
+
|
|
128
|
+
return shouldBegin;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
- (RNGestureHandlerEventExtraData *)eventExtraData:(id)_recognizer
|
|
132
132
|
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
133
|
+
// For some weird reason [recognizer locationInView:recognizer.view.window] returns (0, 0).
|
|
134
|
+
// To calculate the correct absolute position, first calculate the absolute position of the
|
|
135
|
+
// view inside the root view controller (https://stackoverflow.com/a/7448573) and then
|
|
136
|
+
// add the relative touch position to it.
|
|
137
|
+
|
|
138
|
+
RNBetterSwipeGestureRecognizer *recognizer = (RNBetterSwipeGestureRecognizer *)_recognizer;
|
|
139
|
+
|
|
140
|
+
CGPoint viewAbsolutePosition =
|
|
141
|
+
[recognizer.view convertPoint:recognizer.view.bounds.origin
|
|
142
|
+
toView:[UIApplication sharedApplication].keyWindow.rootViewController.view];
|
|
143
|
+
CGPoint locationInView = [recognizer getLastLocation];
|
|
144
|
+
|
|
145
|
+
return [RNGestureHandlerEventExtraData
|
|
146
|
+
forPosition:locationInView
|
|
147
|
+
withAbsolutePosition:CGPointMake(
|
|
148
|
+
viewAbsolutePosition.x + locationInView.x, viewAbsolutePosition.y + locationInView.y)
|
|
149
|
+
withNumberOfTouches:recognizer.numberOfTouches];
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
@end
|
|
150
|
-
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
@property (nonatomic) CGFloat force;
|
|
12
12
|
@property (nonatomic) BOOL feedbackOnActivation;
|
|
13
13
|
|
|
14
|
-
- (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler;
|
|
14
|
+
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
|
|
15
15
|
|
|
16
16
|
@end
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ static const CGFloat defaultMinForce = 0.2;
|
|
|
25
25
|
static const CGFloat defaultMaxForce = NAN;
|
|
26
26
|
static const BOOL defaultFeedbackOnActivation = NO;
|
|
27
27
|
|
|
28
|
-
- (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler
|
|
28
|
+
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
29
29
|
{
|
|
30
30
|
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
31
31
|
_gestureHandler = gestureHandler;
|
|
@@ -45,7 +45,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
45
45
|
}
|
|
46
46
|
[super touchesBegan:touches withEvent:event];
|
|
47
47
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
_firstTouch = [touches anyObject];
|
|
50
50
|
[self handleForceWithTouches:touches];
|
|
51
51
|
self.state = UIGestureRecognizerStatePossible;
|
|
@@ -59,25 +59,27 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
59
59
|
}
|
|
60
60
|
[super touchesMoved:touches withEvent:event];
|
|
61
61
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
[self handleForceWithTouches:touches];
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
if ([self shouldFail]) {
|
|
66
66
|
self.state = UIGestureRecognizerStateFailed;
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
if (self.state == UIGestureRecognizerStatePossible && [self shouldActivate]) {
|
|
71
71
|
[self performFeedbackIfRequired];
|
|
72
72
|
self.state = UIGestureRecognizerStateBegan;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
- (BOOL)shouldActivate
|
|
76
|
+
- (BOOL)shouldActivate
|
|
77
|
+
{
|
|
77
78
|
return (_force >= _minForce);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
- (BOOL)shouldFail
|
|
81
|
+
- (BOOL)shouldFail
|
|
82
|
+
{
|
|
81
83
|
return TEST_MAX_IF_NOT_NAN(_force, _maxForce);
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -113,11 +115,13 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
113
115
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
114
116
|
}
|
|
115
117
|
|
|
116
|
-
- (void)handleForceWithTouches:(NSSet<UITouch *> *)touches
|
|
118
|
+
- (void)handleForceWithTouches:(NSSet<UITouch *> *)touches
|
|
119
|
+
{
|
|
117
120
|
_force = _firstTouch.force / _firstTouch.maximumPossibleForce;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
- (void)reset
|
|
123
|
+
- (void)reset
|
|
124
|
+
{
|
|
121
125
|
[_gestureHandler.pointerTracker reset];
|
|
122
126
|
[super reset];
|
|
123
127
|
_force = 0;
|
|
@@ -140,7 +144,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
140
144
|
{
|
|
141
145
|
[super resetConfig];
|
|
142
146
|
RNForceTouchGestureRecognizer *recognizer = (RNForceTouchGestureRecognizer *)_recognizer;
|
|
143
|
-
|
|
147
|
+
|
|
144
148
|
recognizer.feedbackOnActivation = defaultFeedbackOnActivation;
|
|
145
149
|
recognizer.maxForce = defaultMaxForce;
|
|
146
150
|
recognizer.minForce = defaultMinForce;
|
|
@@ -162,12 +166,10 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
162
166
|
|
|
163
167
|
- (RNGestureHandlerEventExtraData *)eventExtraData:(RNForceTouchGestureRecognizer *)recognizer
|
|
164
168
|
{
|
|
165
|
-
return [RNGestureHandlerEventExtraData
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
withNumberOfTouches:recognizer.numberOfTouches];
|
|
169
|
+
return [RNGestureHandlerEventExtraData forForce:recognizer.force
|
|
170
|
+
forPosition:[recognizer locationInView:recognizer.view]
|
|
171
|
+
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
172
|
+
withNumberOfTouches:recognizer.numberOfTouches];
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
@end
|
|
173
|
-
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
uint64_t previousTime;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
- (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler;
|
|
22
|
+
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
|
|
23
23
|
- (void)handleGesture:(UIGestureRecognizer *)recognizer;
|
|
24
|
-
- (NSUInteger)
|
|
24
|
+
- (NSUInteger)getDuration;
|
|
25
25
|
|
|
26
26
|
@end
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
CGPoint _initPosition;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
- (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler
|
|
33
|
+
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
34
34
|
{
|
|
35
35
|
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
36
36
|
_gestureHandler = gestureHandler;
|
|
@@ -70,10 +70,11 @@
|
|
|
70
70
|
{
|
|
71
71
|
[super touchesMoved:touches withEvent:event];
|
|
72
72
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
CGPoint trans = [self translationInView];
|
|
75
|
-
if ((_gestureHandler.shouldCancelWhenOutside && ![_gestureHandler containsPointInView])
|
|
76
|
-
|
|
75
|
+
if ((_gestureHandler.shouldCancelWhenOutside && ![_gestureHandler containsPointInView]) ||
|
|
76
|
+
(TEST_MAX_IF_NOT_NAN(
|
|
77
|
+
fabs(trans.y * trans.y + trans.x + trans.x), self.allowableMovement * self.allowableMovement))) {
|
|
77
78
|
self.enabled = NO;
|
|
78
79
|
self.enabled = YES;
|
|
79
80
|
}
|
|
@@ -96,26 +97,25 @@
|
|
|
96
97
|
if (self.state == UIGestureRecognizerStateFailed) {
|
|
97
98
|
[self triggerAction];
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
+
|
|
100
101
|
[_gestureHandler.pointerTracker reset];
|
|
101
|
-
|
|
102
|
+
|
|
102
103
|
[super reset];
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
- (NSUInteger)getDuration
|
|
106
107
|
{
|
|
107
108
|
static mach_timebase_info_data_t sTimebaseInfo;
|
|
108
|
-
|
|
109
|
+
|
|
109
110
|
if (sTimebaseInfo.denom == 0) {
|
|
110
111
|
mach_timebase_info(&sTimebaseInfo);
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
|
|
113
114
|
return (NSUInteger)(((previousTime - startTime) * sTimebaseInfo.numer / (sTimebaseInfo.denom * 1000000)));
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
@end
|
|
117
118
|
|
|
118
|
-
|
|
119
119
|
@implementation RNLongPressGestureHandler
|
|
120
120
|
|
|
121
121
|
- (instancetype)initWithTag:(NSNumber *)tag
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
{
|
|
131
131
|
[super resetConfig];
|
|
132
132
|
UILongPressGestureRecognizer *recognizer = (UILongPressGestureRecognizer *)_recognizer;
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
recognizer.minimumPressDuration = 0.5;
|
|
135
135
|
recognizer.allowableMovement = 10;
|
|
136
136
|
}
|
|
@@ -139,12 +139,12 @@
|
|
|
139
139
|
{
|
|
140
140
|
[super configure:config];
|
|
141
141
|
UILongPressGestureRecognizer *recognizer = (UILongPressGestureRecognizer *)_recognizer;
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
id prop = config[@"minDurationMs"];
|
|
144
144
|
if (prop != nil) {
|
|
145
145
|
recognizer.minimumPressDuration = [RCTConvert CGFloat:prop] / 1000.0;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
prop = config[@"maxDist"];
|
|
149
149
|
if (prop != nil) {
|
|
150
150
|
recognizer.allowableMovement = [RCTConvert CGFloat:prop];
|
|
@@ -165,21 +165,19 @@
|
|
|
165
165
|
|
|
166
166
|
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
|
167
167
|
{
|
|
168
|
-
//same as TapGH, this needs to be unified when all handlers are updated
|
|
168
|
+
// same as TapGH, this needs to be unified when all handlers are updated
|
|
169
169
|
RNGestureHandlerState savedState = _lastState;
|
|
170
170
|
BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer];
|
|
171
171
|
_lastState = savedState;
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
return shouldBegin;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer
|
|
177
177
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
withDuration:[(RNBetterLongPressGestureRecognizer*)recognizer getDuration]];
|
|
178
|
+
return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:recognizer.view]
|
|
179
|
+
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
180
|
+
withNumberOfTouches:recognizer.numberOfTouches
|
|
181
|
+
withDuration:[(RNBetterLongPressGestureRecognizer *)recognizer getDuration]];
|
|
183
182
|
}
|
|
184
183
|
@end
|
|
185
|
-
|
|
@@ -37,9 +37,8 @@
|
|
|
37
37
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
38
38
|
|
|
39
39
|
if ([self shouldFail]) {
|
|
40
|
-
self.state = (self.state == UIGestureRecognizerStatePossible)
|
|
41
|
-
|
|
42
|
-
: UIGestureRecognizerStateCancelled;
|
|
40
|
+
self.state = (self.state == UIGestureRecognizerStatePossible) ? UIGestureRecognizerStateFailed
|
|
41
|
+
: UIGestureRecognizerStateCancelled;
|
|
43
42
|
|
|
44
43
|
[self reset];
|
|
45
44
|
}
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
#import <React/RCTConvert.h>
|
|
14
14
|
#import <React/UIView+React.h>
|
|
15
15
|
|
|
16
|
-
#ifdef
|
|
16
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
17
|
#import <React/RCTScrollViewComponentView.h>
|
|
18
18
|
#else
|
|
19
19
|
#import <React/RCTScrollView.h>
|
|
20
|
-
#endif //
|
|
20
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
21
21
|
|
|
22
22
|
#pragma mark RNDummyGestureRecognizer
|
|
23
23
|
|
|
@@ -27,37 +27,37 @@
|
|
|
27
27
|
|
|
28
28
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
29
29
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
31
|
+
_gestureHandler = gestureHandler;
|
|
32
|
+
}
|
|
33
|
+
return self;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
|
37
37
|
{
|
|
38
|
-
|
|
38
|
+
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
|
42
42
|
{
|
|
43
|
-
|
|
43
|
+
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
|
47
47
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
49
|
+
self.state = UIGestureRecognizerStateFailed;
|
|
50
|
+
[self reset];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
|
54
54
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
56
|
+
self.state = UIGestureRecognizerStateCancelled;
|
|
57
|
+
[self reset];
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
-(void)reset
|
|
60
|
+
- (void)reset
|
|
61
61
|
{
|
|
62
62
|
[_gestureHandler.pointerTracker reset];
|
|
63
63
|
[super reset];
|
|
@@ -68,122 +68,126 @@
|
|
|
68
68
|
#pragma mark RNNativeViewgestureHandler
|
|
69
69
|
|
|
70
70
|
@implementation RNNativeViewGestureHandler {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
BOOL _shouldActivateOnStart;
|
|
72
|
+
BOOL _disallowInterruption;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
- (instancetype)initWithTag:(NSNumber *)tag
|
|
76
76
|
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
if ((self = [super initWithTag:tag])) {
|
|
78
|
+
_recognizer = [[RNDummyGestureRecognizer alloc] initWithGestureHandler:self];
|
|
79
|
+
}
|
|
80
|
+
return self;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
- (void)configure:(NSDictionary *)config
|
|
84
84
|
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
[super configure:config];
|
|
86
|
+
_shouldActivateOnStart = [RCTConvert BOOL:config[@"shouldActivateOnStart"]];
|
|
87
|
+
_disallowInterruption = [RCTConvert BOOL:config[@"disallowInterruption"]];
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
- (void)bindToView:(UIView *)view
|
|
91
91
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
92
|
+
// For UIControl based views (UIButton, UISwitch) we provide special handling that would allow
|
|
93
|
+
// for properties like `disallowInterruption` to work.
|
|
94
|
+
if ([view isKindOfClass:[UIControl class]]) {
|
|
95
|
+
UIControl *control = (UIControl *)view;
|
|
96
|
+
[control addTarget:self action:@selector(handleTouchDown:forEvent:) forControlEvents:UIControlEventTouchDown];
|
|
97
|
+
[control addTarget:self
|
|
98
|
+
action:@selector(handleTouchUpOutside:forEvent:)
|
|
99
|
+
forControlEvents:UIControlEventTouchUpOutside];
|
|
100
|
+
[control addTarget:self
|
|
101
|
+
action:@selector(handleTouchUpInside:forEvent:)
|
|
102
|
+
forControlEvents:UIControlEventTouchUpInside];
|
|
103
|
+
[control addTarget:self action:@selector(handleDragExit:forEvent:) forControlEvents:UIControlEventTouchDragExit];
|
|
104
|
+
[control addTarget:self action:@selector(handleDragEnter:forEvent:) forControlEvents:UIControlEventTouchDragEnter];
|
|
105
|
+
[control addTarget:self action:@selector(handleTouchCancel:forEvent:) forControlEvents:UIControlEventTouchCancel];
|
|
106
|
+
} else {
|
|
107
|
+
[super bindToView:view];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// We can restore default scrollview behaviour to delay touches to scrollview's children
|
|
111
|
+
// because gesture handler system can handle cancellation of scroll recognizer when JS responder
|
|
112
|
+
// is set
|
|
113
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
114
|
+
if ([view isKindOfClass:[RCTScrollViewComponentView class]]) {
|
|
115
|
+
UIScrollView *scrollView = ((RCTScrollViewComponentView *)view).scrollView;
|
|
116
|
+
scrollView.delaysContentTouches = YES;
|
|
117
|
+
}
|
|
114
118
|
#else
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
#endif //
|
|
119
|
+
if ([view isKindOfClass:[RCTScrollView class]]) {
|
|
120
|
+
// This part of the code is coupled with RN implementation of ScrollView native wrapper and
|
|
121
|
+
// we expect for RCTScrollView component to contain a subclass of UIScrollview as the only
|
|
122
|
+
// subview
|
|
123
|
+
UIScrollView *scrollView = [view.subviews objectAtIndex:0];
|
|
124
|
+
scrollView.delaysContentTouches = YES;
|
|
125
|
+
}
|
|
126
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
- (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
|
|
126
130
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
131
|
+
[self reset];
|
|
132
|
+
|
|
133
|
+
if (_disallowInterruption) {
|
|
134
|
+
// When `disallowInterruption` is set we cancel all gesture handlers when this UIControl
|
|
135
|
+
// gets DOWN event
|
|
136
|
+
for (UITouch *touch in [event allTouches]) {
|
|
137
|
+
for (UIGestureRecognizer *recogn in [touch gestureRecognizers]) {
|
|
138
|
+
recogn.enabled = NO;
|
|
139
|
+
recogn.enabled = YES;
|
|
140
|
+
}
|
|
138
141
|
}
|
|
142
|
+
}
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
[self sendEventsInState:RNGestureHandlerStateActive
|
|
145
|
+
forViewWithTag:sender.reactTag
|
|
146
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES]];
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
- (void)handleTouchUpOutside:(UIView *)sender forEvent:(UIEvent *)event
|
|
146
150
|
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
152
|
+
forViewWithTag:sender.reactTag
|
|
153
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
- (void)handleTouchUpInside:(UIView *)sender forEvent:(UIEvent *)event
|
|
153
157
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
159
|
+
forViewWithTag:sender.reactTag
|
|
160
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES]];
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
- (void)handleDragExit:(UIView *)sender forEvent:(UIEvent *)event
|
|
160
164
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
// Pointer is moved outside of the view bounds, we cancel button when `shouldCancelWhenOutside` is set
|
|
166
|
+
if (self.shouldCancelWhenOutside) {
|
|
167
|
+
UIControl *control = (UIControl *)sender;
|
|
168
|
+
[control cancelTrackingWithEvent:event];
|
|
169
|
+
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
170
|
+
forViewWithTag:sender.reactTag
|
|
171
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
172
|
+
} else {
|
|
173
|
+
[self sendEventsInState:RNGestureHandlerStateActive
|
|
174
|
+
forViewWithTag:sender.reactTag
|
|
175
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
176
|
+
}
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
- (void)handleDragEnter:(UIView *)sender forEvent:(UIEvent *)event
|
|
176
180
|
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
[self sendEventsInState:RNGestureHandlerStateActive
|
|
182
|
+
forViewWithTag:sender.reactTag
|
|
183
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES]];
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
- (void)handleTouchCancel:(UIView *)sender forEvent:(UIEvent *)event
|
|
183
187
|
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
[self sendEventsInState:RNGestureHandlerStateCancelled
|
|
189
|
+
forViewWithTag:sender.reactTag
|
|
190
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
@end
|