react-native-gesture-handler 2.31.0-nightly-20260122-b776a8137 → 2.31.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/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -5
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +2 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +2 -1
- package/apple/Handlers/RNFlingHandler.m +5 -5
- package/apple/Handlers/RNForceTouchHandler.m +2 -2
- package/apple/Handlers/RNHoverHandler.m +35 -6
- package/apple/Handlers/RNLongPressHandler.m +10 -2
- package/apple/Handlers/RNManualHandler.m +2 -2
- package/apple/Handlers/RNNativeViewHandler.mm +25 -10
- package/apple/Handlers/RNPanHandler.m +2 -2
- package/apple/Handlers/RNPinchHandler.m +5 -4
- package/apple/Handlers/RNRotationHandler.m +4 -4
- package/apple/Handlers/RNTapHandler.m +4 -2
- package/apple/RNGestureHandler.h +4 -1
- package/apple/RNGestureHandler.mm +14 -1
- package/apple/RNGestureHandlerButtonComponentView.mm +2 -0
- package/apple/RNGestureHandlerEvents.h +3 -1
- package/apple/RNGestureHandlerEvents.m +8 -3
- package/apple/RNGestureHandlerManager.h +2 -0
- package/apple/RNGestureHandlerManager.mm +43 -2
- package/apple/RNGestureHandlerModule.mm +12 -10
- package/apple/RNGestureHandlerRegistry.h +2 -0
- package/apple/RNGestureHandlerRegistry.m +5 -0
- package/apple/RNManualActivationRecognizer.m +1 -1
- package/lib/commonjs/components/Text.js +26 -21
- package/lib/commonjs/components/Text.js.map +1 -1
- package/lib/commonjs/mocks/mocks.js +2 -1
- package/lib/commonjs/mocks/mocks.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/components/Text.js +26 -22
- package/lib/module/components/Text.js.map +1 -1
- package/lib/module/mocks/mocks.js +2 -1
- package/lib/module/mocks/mocks.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/typescript/components/GestureButtonsProps.d.ts +20 -20
- package/lib/typescript/components/GestureButtonsProps.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/PressableProps.d.ts +1 -1
- package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +1 -1
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts.map +1 -1
- package/lib/typescript/components/Swipeable.d.ts +3 -3
- package/lib/typescript/components/Swipeable.d.ts.map +1 -1
- package/lib/typescript/components/Text.d.ts +6 -2
- package/lib/typescript/components/Text.d.ts.map +1 -1
- package/lib/typescript/components/touchables/ExtraButtonProps.d.ts +5 -5
- package/lib/typescript/components/touchables/ExtraButtonProps.d.ts.map +1 -1
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +2 -2
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts.map +1 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts.map +1 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts.map +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +22 -22
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts +3 -3
- package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts.map +1 -1
- package/lib/typescript/mocks/mocks.d.ts +3 -3
- package/lib/typescript/mocks/mocks.d.ts.map +1 -1
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +3 -2
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/interfaces.d.ts +23 -23
- package/lib/typescript/web/interfaces.d.ts.map +1 -1
- package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +2 -2
- package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +2 -2
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +2 -2
- package/lib/typescript/web_hammer/PanGestureHandler.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/GestureButtonsProps.ts +20 -20
- package/src/components/Pressable/PressableProps.tsx +1 -1
- package/src/components/ReanimatedDrawerLayout.tsx +1 -1
- package/src/components/Swipeable.tsx +3 -3
- package/src/components/Text.tsx +40 -45
- package/src/components/touchables/ExtraButtonProps.ts +5 -5
- package/src/components/touchables/TouchableHighlight.tsx +2 -2
- package/src/handlers/GestureHandlerEventPayload.ts +2 -2
- package/src/handlers/NativeViewGestureHandler.ts +2 -2
- package/src/handlers/PanGestureHandler.ts +1 -1
- package/src/handlers/gestureHandlerCommon.ts +26 -24
- package/src/handlers/gestures/GestureDetector/index.tsx +3 -3
- package/src/handlers/gestures/GestureDetector/types.ts +3 -3
- package/src/mocks/mocks.tsx +2 -2
- package/src/web/handlers/NativeViewGestureHandler.ts +3 -2
- package/src/web/interfaces.ts +23 -23
|
@@ -577,11 +577,22 @@ open class GestureHandler {
|
|
|
577
577
|
onStateChange(newState, oldState)
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
-
fun wantsEvent(event: MotionEvent): Boolean
|
|
581
|
-
state
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
580
|
+
fun wantsEvent(event: MotionEvent): Boolean {
|
|
581
|
+
if (!isEnabled || state == STATE_FAILED || state == STATE_CANCELLED || state == STATE_END) {
|
|
582
|
+
return false
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
if (event.actionMasked == MotionEvent.ACTION_MOVE) {
|
|
586
|
+
for (i in 0 until event.pointerCount) {
|
|
587
|
+
if (isTrackingPointer(event.getPointerId(i))) {
|
|
588
|
+
return true
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return false
|
|
592
|
+
} else {
|
|
593
|
+
return isTrackingPointer(event.getPointerId(event.actionIndex))
|
|
594
|
+
}
|
|
595
|
+
}
|
|
585
596
|
|
|
586
597
|
open fun shouldRequireToWaitForFailure(handler: GestureHandler): Boolean {
|
|
587
598
|
if (handler === this) {
|
|
@@ -14,6 +14,7 @@ class RNGestureHandlerInteractionManager : GestureHandlerInteractionController {
|
|
|
14
14
|
fun dropRelationsForHandlerWithTag(handlerTag: Int) {
|
|
15
15
|
waitForRelations.remove(handlerTag)
|
|
16
16
|
simultaneousRelations.remove(handlerTag)
|
|
17
|
+
blockingRelations.remove(handlerTag)
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
private fun convertHandlerTagsArray(config: ReadableMap, key: String): IntArray {
|
|
@@ -64,6 +65,7 @@ class RNGestureHandlerInteractionManager : GestureHandlerInteractionController {
|
|
|
64
65
|
fun reset() {
|
|
65
66
|
waitForRelations.clear()
|
|
66
67
|
simultaneousRelations.clear()
|
|
68
|
+
blockingRelations.clear()
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
companion object {
|
|
@@ -170,7 +170,8 @@ class RNGestureHandlerModule(reactContext: ReactApplicationContext?) :
|
|
|
170
170
|
}
|
|
171
171
|
synchronized(roots) {
|
|
172
172
|
return roots.firstOrNull {
|
|
173
|
-
|
|
173
|
+
val rv = it.rootView
|
|
174
|
+
rv is ReactRootView && rv.getRootViewTag() == rootViewTag
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
18
18
|
{
|
|
19
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:
|
|
19
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
20
20
|
_gestureHandler = gestureHandler;
|
|
21
21
|
_lastPoint = CGPointZero;
|
|
22
22
|
_hasBegan = NO;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
28
28
|
{
|
|
29
|
-
[_gestureHandler
|
|
29
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
30
30
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
31
31
|
[_gestureHandler reset];
|
|
32
32
|
[super touchesBegan:touches withEvent:event];
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
|
|
120
120
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
121
121
|
{
|
|
122
|
-
if ((self = [super initWithTarget:self action:@selector(handleGesture:
|
|
122
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
123
123
|
_gestureHandler = gestureHandler;
|
|
124
124
|
|
|
125
125
|
maxDuration = 1.0;
|
|
@@ -132,9 +132,9 @@
|
|
|
132
132
|
return self;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
- (void)handleGesture:(NSPanGestureRecognizer *)gestureRecognizer
|
|
135
|
+
- (void)handleGesture:(NSPanGestureRecognizer *)gestureRecognizer
|
|
136
136
|
{
|
|
137
|
-
[_gestureHandler handleGesture:self
|
|
137
|
+
[_gestureHandler handleGesture:self];
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
- (void)mouseDown:(NSEvent *)event
|
|
@@ -28,7 +28,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
28
28
|
|
|
29
29
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
30
30
|
{
|
|
31
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:
|
|
31
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
32
32
|
_gestureHandler = gestureHandler;
|
|
33
33
|
_force = defaultForce;
|
|
34
34
|
_minForce = defaultMinForce;
|
|
@@ -40,7 +40,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
40
40
|
|
|
41
41
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
42
42
|
{
|
|
43
|
-
[_gestureHandler
|
|
43
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
44
44
|
if (_firstTouch) {
|
|
45
45
|
// ignore rest of fingers
|
|
46
46
|
return;
|
|
@@ -40,13 +40,22 @@ API_AVAILABLE(ios(13.4))
|
|
|
40
40
|
|
|
41
41
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
42
42
|
{
|
|
43
|
-
if ((self = [super initWithTarget:
|
|
43
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
44
44
|
_gestureHandler = gestureHandler;
|
|
45
45
|
_hoverEffect = RNGestureHandlerHoverEffectNone;
|
|
46
46
|
}
|
|
47
47
|
return self;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
- (void)handleGesture:(UIHoverGestureRecognizer *)recognizer
|
|
51
|
+
{
|
|
52
|
+
if (recognizer.state == UIGestureRecognizerStateBegan) {
|
|
53
|
+
[_gestureHandler setCurrentPointerType:RNGestureHandlerMouse];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[_gestureHandler handleGesture:self];
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
- (void)triggerAction
|
|
51
60
|
{
|
|
52
61
|
[_gestureHandler handleGesture:self fromReset:NO];
|
|
@@ -153,11 +162,22 @@ API_AVAILABLE(ios(13.4))
|
|
|
153
162
|
#endif
|
|
154
163
|
}
|
|
155
164
|
|
|
165
|
+
- (void)setCurrentPointerType:(RNGestureHandlerPointerType)pointerType
|
|
166
|
+
{
|
|
167
|
+
_pointerType = pointerType;
|
|
168
|
+
|
|
169
|
+
if (@available(iOS 16.1, *)) {
|
|
170
|
+
if (((UIHoverGestureRecognizer *)self.recognizer).zOffset > 0.0) {
|
|
171
|
+
_pointerType = RNGestureHandlerStylus;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
156
176
|
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer
|
|
157
177
|
{
|
|
158
178
|
return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:recognizer.view]
|
|
159
179
|
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
160
|
-
withPointerType:
|
|
180
|
+
withPointerType:_pointerType];
|
|
161
181
|
}
|
|
162
182
|
|
|
163
183
|
@end
|
|
@@ -173,6 +193,7 @@ API_AVAILABLE(ios(13.4))
|
|
|
173
193
|
{
|
|
174
194
|
if ((self = [super initWithTag:tag])) {
|
|
175
195
|
_recognizer = [NSGestureRecognizer alloc];
|
|
196
|
+
_pointerType = RNGestureHandlerMouse;
|
|
176
197
|
}
|
|
177
198
|
|
|
178
199
|
return self;
|
|
@@ -199,21 +220,29 @@ API_AVAILABLE(ios(13.4))
|
|
|
199
220
|
{
|
|
200
221
|
[self sendEventsInState:RNGestureHandlerStateBegan
|
|
201
222
|
forViewWithTag:_view.reactTag
|
|
202
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
223
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
224
|
+
withNumberOfTouches:1
|
|
225
|
+
withPointerType:_pointerType]];
|
|
203
226
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
204
227
|
forViewWithTag:_view.reactTag
|
|
205
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
228
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
229
|
+
withNumberOfTouches:1
|
|
230
|
+
withPointerType:_pointerType]];
|
|
206
231
|
}
|
|
207
232
|
|
|
208
233
|
- (void)mouseExited:(NSEvent *)theEvent
|
|
209
234
|
{
|
|
210
235
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
211
236
|
forViewWithTag:_view.reactTag
|
|
212
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:
|
|
237
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
238
|
+
withNumberOfTouches:1
|
|
239
|
+
withPointerType:_pointerType]];
|
|
213
240
|
|
|
214
241
|
[self sendEventsInState:RNGestureHandlerStateUndetermined
|
|
215
242
|
forViewWithTag:_view.reactTag
|
|
216
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:
|
|
243
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
244
|
+
withNumberOfTouches:1
|
|
245
|
+
withPointerType:_pointerType]];
|
|
217
246
|
}
|
|
218
247
|
|
|
219
248
|
@end
|
|
@@ -33,8 +33,10 @@
|
|
|
33
33
|
- (NSUInteger)getDuration;
|
|
34
34
|
|
|
35
35
|
#if !TARGET_OS_OSX
|
|
36
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer;
|
|
36
37
|
- (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset;
|
|
37
38
|
#else
|
|
39
|
+
- (void)handleGesture:(NSGestureRecognizer *)recognizer;
|
|
38
40
|
- (void)handleGesture:(NSGestureRecognizer *)recognizer fromReset:(BOOL)fromReset;
|
|
39
41
|
#endif
|
|
40
42
|
|
|
@@ -47,12 +49,18 @@
|
|
|
47
49
|
|
|
48
50
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
49
51
|
{
|
|
50
|
-
if ((self = [super initWithTarget:self action:@selector(handleGesture:
|
|
52
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
51
53
|
_gestureHandler = gestureHandler;
|
|
52
54
|
}
|
|
53
55
|
return self;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
59
|
+
{
|
|
60
|
+
previousTime = CACurrentMediaTime();
|
|
61
|
+
[_gestureHandler handleGesture:recognizer fromReset:NO];
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
- (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset
|
|
57
65
|
{
|
|
58
66
|
previousTime = CACurrentMediaTime();
|
|
@@ -79,7 +87,7 @@
|
|
|
79
87
|
|
|
80
88
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
81
89
|
{
|
|
82
|
-
[_gestureHandler
|
|
90
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
83
91
|
[super touchesBegan:touches withEvent:event];
|
|
84
92
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
85
93
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
18
18
|
{
|
|
19
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:
|
|
19
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
20
20
|
_gestureHandler = gestureHandler;
|
|
21
21
|
_shouldSendBeginEvent = YES;
|
|
22
22
|
}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
#if !TARGET_OS_OSX
|
|
60
60
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
61
61
|
{
|
|
62
|
-
[_gestureHandler
|
|
62
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
63
63
|
[super touchesBegan:touches withEvent:event];
|
|
64
64
|
|
|
65
65
|
[self interactionsBegan:touches withEvent:event];
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
31
31
|
{
|
|
32
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:
|
|
32
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
33
33
|
_gestureHandler = gestureHandler;
|
|
34
34
|
}
|
|
35
35
|
return self;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
#if !TARGET_OS_OSX
|
|
39
39
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
40
40
|
{
|
|
41
|
-
[_gestureHandler
|
|
41
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
42
42
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
|
|
167
167
|
- (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
|
|
168
168
|
{
|
|
169
|
-
[self
|
|
169
|
+
[self setCurrentPointerTypeForEvent:event];
|
|
170
170
|
[self reset];
|
|
171
171
|
|
|
172
172
|
if (_disallowInterruption) {
|
|
@@ -182,21 +182,27 @@
|
|
|
182
182
|
|
|
183
183
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
184
184
|
forViewWithTag:sender.reactTag
|
|
185
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
185
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
186
|
+
withNumberOfTouches:event.allTouches.count
|
|
187
|
+
withPointerType:_pointerType]];
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
- (void)handleTouchUpOutside:(UIView *)sender forEvent:(UIEvent *)event
|
|
189
191
|
{
|
|
190
192
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
191
193
|
forViewWithTag:sender.reactTag
|
|
192
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
194
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
195
|
+
withNumberOfTouches:event.allTouches.count
|
|
196
|
+
withPointerType:_pointerType]];
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
- (void)handleTouchUpInside:(UIView *)sender forEvent:(UIEvent *)event
|
|
196
200
|
{
|
|
197
201
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
198
202
|
forViewWithTag:sender.reactTag
|
|
199
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
203
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
204
|
+
withNumberOfTouches:event.allTouches.count
|
|
205
|
+
withPointerType:_pointerType]];
|
|
200
206
|
}
|
|
201
207
|
|
|
202
208
|
- (void)handleDragExit:(UIView *)sender forEvent:(UIEvent *)event
|
|
@@ -207,11 +213,15 @@
|
|
|
207
213
|
[control cancelTrackingWithEvent:event];
|
|
208
214
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
209
215
|
forViewWithTag:sender.reactTag
|
|
210
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
216
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
217
|
+
withNumberOfTouches:event.allTouches.count
|
|
218
|
+
withPointerType:_pointerType]];
|
|
211
219
|
} else {
|
|
212
220
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
213
221
|
forViewWithTag:sender.reactTag
|
|
214
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
222
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
223
|
+
withNumberOfTouches:event.allTouches.count
|
|
224
|
+
withPointerType:_pointerType]];
|
|
215
225
|
}
|
|
216
226
|
}
|
|
217
227
|
|
|
@@ -219,14 +229,18 @@
|
|
|
219
229
|
{
|
|
220
230
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
221
231
|
forViewWithTag:sender.reactTag
|
|
222
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
232
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
|
|
233
|
+
withNumberOfTouches:event.allTouches.count
|
|
234
|
+
withPointerType:_pointerType]];
|
|
223
235
|
}
|
|
224
236
|
|
|
225
237
|
- (void)handleTouchCancel:(UIView *)sender forEvent:(UIEvent *)event
|
|
226
238
|
{
|
|
227
239
|
[self sendEventsInState:RNGestureHandlerStateCancelled
|
|
228
240
|
forViewWithTag:sender.reactTag
|
|
229
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
241
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
|
|
242
|
+
withNumberOfTouches:event.allTouches.count
|
|
243
|
+
withPointerType:_pointerType]];
|
|
230
244
|
}
|
|
231
245
|
|
|
232
246
|
#else
|
|
@@ -234,6 +248,7 @@
|
|
|
234
248
|
- (RNGestureHandlerEventExtraData *)eventExtraData:(RNDummyGestureRecognizer *)recognizer
|
|
235
249
|
{
|
|
236
250
|
return [RNGestureHandlerEventExtraData forPointerInside:[self containsPointInView]
|
|
251
|
+
withNumberOfTouches:1
|
|
237
252
|
withPointerType:RNGestureHandlerMouse];
|
|
238
253
|
}
|
|
239
254
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
52
52
|
{
|
|
53
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:
|
|
53
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
54
54
|
_gestureHandler = gestureHandler;
|
|
55
55
|
_minDistSq = NAN;
|
|
56
56
|
_minVelocityX = NAN;
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
|
|
234
234
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
235
235
|
{
|
|
236
|
-
[_gestureHandler
|
|
236
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
237
237
|
// super call was moved to interactionsBegan method to keep the
|
|
238
238
|
// original order of calls
|
|
239
239
|
[self interactionsBegan:touches withEvent:event];
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
35
35
|
{
|
|
36
|
-
if ((self = [super initWithTarget:self action:@selector(handleGesture:
|
|
36
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
37
37
|
_gestureHandler = gestureHandler;
|
|
38
38
|
}
|
|
39
39
|
#if TARGET_OS_OSX
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
return self;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
46
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
47
47
|
{
|
|
48
48
|
if (self.state == UIGestureRecognizerStateBegan) {
|
|
49
49
|
#if TARGET_OS_OSX
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
self.scale = 1;
|
|
53
53
|
#endif
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
|
+
[_gestureHandler handleGesture:recognizer fromReset:NO];
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
- (void)interactionsBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
#else
|
|
104
105
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
105
106
|
{
|
|
106
|
-
[_gestureHandler
|
|
107
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
107
108
|
[super touchesBegan:touches withEvent:event];
|
|
108
109
|
[self interactionsBegan:touches withEvent:event];
|
|
109
110
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
33
33
|
{
|
|
34
|
-
if ((self = [super initWithTarget:self action:@selector(handleGesture:
|
|
34
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
35
35
|
_gestureHandler = gestureHandler;
|
|
36
36
|
}
|
|
37
37
|
#if TARGET_OS_OSX
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
return self;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
44
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
45
45
|
{
|
|
46
46
|
if (self.state == UIGestureRecognizerStateBegan) {
|
|
47
47
|
self.rotation = 0;
|
|
48
48
|
}
|
|
49
|
-
[_gestureHandler handleGesture:recognizer fromReset:
|
|
49
|
+
[_gestureHandler handleGesture:recognizer fromReset:NO];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
- (void)interactionsBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
#else
|
|
98
98
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
99
99
|
{
|
|
100
|
-
[_gestureHandler
|
|
100
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
101
101
|
[super touchesBegan:touches withEvent:event];
|
|
102
102
|
[self interactionsBegan:touches withEvent:event];
|
|
103
103
|
}
|
|
@@ -47,7 +47,7 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
47
47
|
|
|
48
48
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
49
49
|
{
|
|
50
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:
|
|
50
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
51
51
|
_gestureHandler = gestureHandler;
|
|
52
52
|
_tapsSoFar = 0;
|
|
53
53
|
_numberOfTaps = defaultNumberOfTaps;
|
|
@@ -143,6 +143,8 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
143
143
|
{
|
|
144
144
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
145
145
|
self.state = UIGestureRecognizerStateCancelled;
|
|
146
|
+
|
|
147
|
+
[self triggerAction];
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
#if TARGET_OS_OSX
|
|
@@ -186,7 +188,7 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
186
188
|
|
|
187
189
|
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
188
190
|
{
|
|
189
|
-
[_gestureHandler
|
|
191
|
+
[_gestureHandler setCurrentPointerTypeForEvent:event];
|
|
190
192
|
[super touchesBegan:touches withEvent:event];
|
|
191
193
|
[self interactionsBegan:touches withEvent:event];
|
|
192
194
|
}
|
package/apple/RNGestureHandler.h
CHANGED
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
@property (nonatomic) BOOL shouldCancelWhenOutside;
|
|
73
73
|
@property (nonatomic) BOOL needsPointerData;
|
|
74
74
|
@property (nonatomic) BOOL manualActivation;
|
|
75
|
+
@property (nonatomic, copy, nullable) NSNumber *viewTag;
|
|
75
76
|
|
|
76
77
|
#if RCT_NEW_ARCH_ENABLED
|
|
77
78
|
- (BOOL)isViewParagraphComponent:(nullable RNGHUIView *)view;
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
- (void)unbindFromView;
|
|
82
83
|
- (void)resetConfig NS_REQUIRES_SUPER;
|
|
83
84
|
- (void)configure:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
|
|
85
|
+
- (void)handleGesture:(nonnull id)recognizer;
|
|
84
86
|
- (void)handleGesture:(nonnull id)recognizer fromReset:(BOOL)fromReset;
|
|
85
87
|
- (void)handleGesture:(nonnull id)recognizer inState:(RNGestureHandlerState)state;
|
|
86
88
|
- (BOOL)containsPointInView;
|
|
@@ -103,7 +105,8 @@
|
|
|
103
105
|
#endif
|
|
104
106
|
|
|
105
107
|
#if !TARGET_OS_OSX
|
|
106
|
-
- (void)setCurrentPointerType:(
|
|
108
|
+
- (void)setCurrentPointerType:(RNGestureHandlerPointerType)pointerType;
|
|
109
|
+
- (void)setCurrentPointerTypeForEvent:(nonnull UIEvent *)event;
|
|
107
110
|
#else
|
|
108
111
|
- (void)setCurrentPointerTypeToMouse;
|
|
109
112
|
#endif
|
|
@@ -184,8 +184,13 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
|
|
|
184
184
|
self.recognizer.enabled = enabled;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
- (void)setCurrentPointerType:(RNGestureHandlerPointerType)pointerType
|
|
188
|
+
{
|
|
189
|
+
_pointerType = pointerType;
|
|
190
|
+
}
|
|
191
|
+
|
|
187
192
|
#if !TARGET_OS_OSX
|
|
188
|
-
- (void)
|
|
193
|
+
- (void)setCurrentPointerTypeForEvent:(UIEvent *)event
|
|
189
194
|
{
|
|
190
195
|
UITouch *touch = [[event allTouches] anyObject];
|
|
191
196
|
|
|
@@ -242,12 +247,15 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
|
|
|
242
247
|
|
|
243
248
|
[recognizerView addGestureRecognizer:self.recognizer];
|
|
244
249
|
[self bindManualActivationToView:recognizerView];
|
|
250
|
+
|
|
251
|
+
self.viewTag = view.reactTag;
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
- (void)unbindFromView
|
|
248
255
|
{
|
|
249
256
|
[self.recognizer.view removeGestureRecognizer:self.recognizer];
|
|
250
257
|
self.recognizer.delegate = nil;
|
|
258
|
+
self.viewTag = nil;
|
|
251
259
|
|
|
252
260
|
[self unbindManualActivation];
|
|
253
261
|
}
|
|
@@ -280,6 +288,11 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
|
|
|
280
288
|
#endif
|
|
281
289
|
}
|
|
282
290
|
|
|
291
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
292
|
+
{
|
|
293
|
+
[self handleGesture:recognizer fromReset:NO];
|
|
294
|
+
}
|
|
295
|
+
|
|
283
296
|
- (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset
|
|
284
297
|
{
|
|
285
298
|
RNGHUIView *view = [self chooseViewForInteraction:recognizer];
|
|
@@ -47,10 +47,12 @@ static RNGestureHandlerPointerEvents RCTPointerEventsToEnum(facebook::react::Poi
|
|
|
47
47
|
#endif
|
|
48
48
|
|
|
49
49
|
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
50
|
+
#ifdef RCT_DYNAMIC_FRAMEWORKS
|
|
50
51
|
+ (void)load
|
|
51
52
|
{
|
|
52
53
|
[super load];
|
|
53
54
|
}
|
|
55
|
+
#endif
|
|
54
56
|
|
|
55
57
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
56
58
|
{
|
|
@@ -52,7 +52,9 @@
|
|
|
52
52
|
withAllPointers:(NSArray<NSDictionary *> *)allPointers
|
|
53
53
|
withNumberOfTouches:(NSUInteger)numberOfTouches
|
|
54
54
|
withPointerType:(NSInteger)pointerType;
|
|
55
|
-
+ (RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside
|
|
55
|
+
+ (RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside
|
|
56
|
+
withNumberOfTouches:(NSUInteger)numberOfTouches
|
|
57
|
+
withPointerType:(NSInteger)pointerType;
|
|
56
58
|
@end
|
|
57
59
|
|
|
58
60
|
@interface RNGestureHandlerEvent : NSObject <RCTEvent>
|
|
@@ -156,10 +156,15 @@
|
|
|
156
156
|
}];
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
+ (RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside
|
|
159
|
+
+ (RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside
|
|
160
|
+
withNumberOfTouches:(NSUInteger)numberOfTouches
|
|
161
|
+
withPointerType:(NSInteger)pointerType
|
|
160
162
|
{
|
|
161
|
-
return [[RNGestureHandlerEventExtraData alloc]
|
|
162
|
-
|
|
163
|
+
return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
|
|
164
|
+
@"pointerInside" : @(pointerInside),
|
|
165
|
+
@"numberOfPointers" : @(numberOfTouches),
|
|
166
|
+
@"pointerType" : @(pointerType)
|
|
167
|
+
}];
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
@end
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
13
13
|
- (nonnull instancetype)initWithModuleRegistry:(nonnull RCTModuleRegistry *)moduleRegistry
|
|
14
14
|
viewRegistry:(nonnull RCTViewRegistry *)viewRegistry;
|
|
15
|
+
|
|
16
|
+
- (void)reattachHandlersIfNeeded;
|
|
15
17
|
#else
|
|
16
18
|
- (nonnull instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager
|
|
17
19
|
eventDispatcher:(nonnull id<RCTEventDispatcherProtocol>)eventDispatcher;
|