react-native-gesture-handler 2.30.0-20251201-924e38fcb → 2.30.0-20251204-14b690ec8
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/apple/Handlers/RNFlingHandler.m +12 -12
- package/apple/Handlers/RNForceTouchHandler.m +1 -1
- package/apple/Handlers/RNHoverHandler.m +2 -2
- package/apple/Handlers/RNLongPressHandler.m +12 -12
- package/apple/Handlers/RNManualHandler.m +4 -4
- package/apple/Handlers/RNNativeViewHandler.mm +1 -1
- package/apple/Handlers/RNPanHandler.m +8 -6
- package/apple/Handlers/RNPinchHandler.m +3 -3
- package/apple/Handlers/RNRotationHandler.m +3 -3
- package/apple/Handlers/RNTapHandler.m +8 -9
- package/apple/RNGestureHandler.h +1 -1
- package/apple/RNGestureHandler.mm +15 -1
- package/apple/RNGestureHandlerModule.mm +1 -1
- package/apple/RNManualActivationRecognizer.m +1 -1
- package/package.json +1 -1
|
@@ -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:fromReset:)])) {
|
|
20
20
|
_gestureHandler = gestureHandler;
|
|
21
21
|
_lastPoint = CGPointZero;
|
|
22
22
|
_hasBegan = NO;
|
|
@@ -53,8 +53,6 @@
|
|
|
53
53
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
54
54
|
[super touchesEnded:touches withEvent:event];
|
|
55
55
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
56
|
-
|
|
57
|
-
[self triggerAction];
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
@@ -62,20 +60,22 @@
|
|
|
62
60
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
63
61
|
[super touchesCancelled:touches withEvent:event];
|
|
64
62
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
65
|
-
|
|
66
|
-
[self triggerAction];
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
- (void)triggerAction
|
|
70
66
|
{
|
|
71
|
-
[_gestureHandler handleGesture:self];
|
|
67
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)triggerActionFromReset
|
|
71
|
+
{
|
|
72
|
+
[_gestureHandler handleGesture:self fromReset:YES];
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
- (void)reset
|
|
75
76
|
{
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
[self triggerAction]; // Keeping it will not break old iOS because we check if we do not send the same state twice.
|
|
77
|
+
[self triggerActionFromReset]; // Keeping it will not break old iOS because we check if we do not send the same state
|
|
78
|
+
// twice.
|
|
79
79
|
[_gestureHandler.pointerTracker reset];
|
|
80
80
|
_hasBegan = NO;
|
|
81
81
|
[super reset];
|
|
@@ -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:fromReset:)])) {
|
|
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 fromReset:(BOOL)fromReset
|
|
136
136
|
{
|
|
137
|
-
[_gestureHandler handleGesture:self];
|
|
137
|
+
[_gestureHandler handleGesture:self fromReset:fromReset];
|
|
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:fromReset:)])) {
|
|
32
32
|
_gestureHandler = gestureHandler;
|
|
33
33
|
_force = defaultForce;
|
|
34
34
|
_minForce = defaultMinForce;
|
|
@@ -40,7 +40,7 @@ API_AVAILABLE(ios(13.4))
|
|
|
40
40
|
|
|
41
41
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
42
42
|
{
|
|
43
|
-
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) {
|
|
43
|
+
if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:fromReset:)])) {
|
|
44
44
|
_gestureHandler = gestureHandler;
|
|
45
45
|
_hoverEffect = RNGestureHandlerHoverEffectNone;
|
|
46
46
|
}
|
|
@@ -49,7 +49,7 @@ API_AVAILABLE(ios(13.4))
|
|
|
49
49
|
|
|
50
50
|
- (void)triggerAction
|
|
51
51
|
{
|
|
52
|
-
[_gestureHandler handleGesture:self];
|
|
52
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
- (void)cancel
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
- (NSUInteger)getDuration;
|
|
34
34
|
|
|
35
35
|
#if !TARGET_OS_OSX
|
|
36
|
-
- (void)handleGesture:(UIGestureRecognizer *)recognizer;
|
|
36
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset;
|
|
37
37
|
#else
|
|
38
|
-
- (void)handleGesture:(NSGestureRecognizer *)recognizer;
|
|
38
|
+
- (void)handleGesture:(NSGestureRecognizer *)recognizer fromReset:(BOOL)fromReset;
|
|
39
39
|
#endif
|
|
40
40
|
|
|
41
41
|
@end
|
|
@@ -47,21 +47,26 @@
|
|
|
47
47
|
|
|
48
48
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
49
49
|
{
|
|
50
|
-
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
50
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:fromReset:)])) {
|
|
51
51
|
_gestureHandler = gestureHandler;
|
|
52
52
|
}
|
|
53
53
|
return self;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
56
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset
|
|
57
57
|
{
|
|
58
58
|
previousTime = CACurrentMediaTime();
|
|
59
|
-
[_gestureHandler handleGesture:recognizer];
|
|
59
|
+
[_gestureHandler handleGesture:recognizer fromReset:fromReset];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
- (void)triggerAction
|
|
63
63
|
{
|
|
64
|
-
[self handleGesture:self];
|
|
64
|
+
[self handleGesture:self fromReset:NO];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
- (void)triggerActionFromReset
|
|
68
|
+
{
|
|
69
|
+
[self handleGesture:self fromReset:YES];
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
- (CGPoint)translationInView
|
|
@@ -95,8 +100,6 @@
|
|
|
95
100
|
self.state = UIGestureRecognizerStateFailed;
|
|
96
101
|
self.enabled = NO;
|
|
97
102
|
self.enabled = YES;
|
|
98
|
-
|
|
99
|
-
[self triggerAction];
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
|
|
@@ -104,16 +107,12 @@
|
|
|
104
107
|
{
|
|
105
108
|
[super touchesEnded:touches withEvent:event];
|
|
106
109
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
107
|
-
|
|
108
|
-
[self triggerAction];
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
112
113
|
{
|
|
113
114
|
[super touchesCancelled:touches withEvent:event];
|
|
114
115
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
115
|
-
|
|
116
|
-
[self triggerAction];
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
#else
|
|
@@ -187,6 +186,7 @@
|
|
|
187
186
|
|
|
188
187
|
- (void)reset
|
|
189
188
|
{
|
|
189
|
+
[self triggerActionFromReset];
|
|
190
190
|
[_gestureHandler.pointerTracker reset];
|
|
191
191
|
|
|
192
192
|
[super reset];
|
|
@@ -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:fromReset:)])) {
|
|
20
20
|
_gestureHandler = gestureHandler;
|
|
21
21
|
_shouldSendBeginEvent = YES;
|
|
22
22
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
30
30
|
|
|
31
31
|
if (_shouldSendBeginEvent) {
|
|
32
|
-
[_gestureHandler handleGesture:self];
|
|
32
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
33
33
|
#if TARGET_OS_OSX
|
|
34
34
|
self.state = NSGestureRecognizerStateBegan;
|
|
35
35
|
#endif
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
- (void)interactionsMoved:(NSSet *)touches withEvent:(UIEvent *)event
|
|
41
41
|
{
|
|
42
42
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
43
|
-
[_gestureHandler handleGesture:self];
|
|
43
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
44
44
|
|
|
45
45
|
if ([self shouldFail]) {
|
|
46
46
|
self.state = (self.state == UIGestureRecognizerStatePossible) ? UIGestureRecognizerStateFailed
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
- (void)interactionsEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
|
54
54
|
{
|
|
55
55
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
56
|
-
[_gestureHandler handleGesture:self];
|
|
56
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
#if !TARGET_OS_OSX
|
|
@@ -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:fromReset:)])) {
|
|
33
33
|
_gestureHandler = gestureHandler;
|
|
34
34
|
}
|
|
35
35
|
return self;
|
|
@@ -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:fromReset:)])) {
|
|
54
54
|
_gestureHandler = gestureHandler;
|
|
55
55
|
_minDistSq = NAN;
|
|
56
56
|
_minVelocityX = NAN;
|
|
@@ -75,7 +75,12 @@
|
|
|
75
75
|
|
|
76
76
|
- (void)triggerAction
|
|
77
77
|
{
|
|
78
|
-
[_gestureHandler handleGesture:self];
|
|
78
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (void)triggerActionFromReset
|
|
82
|
+
{
|
|
83
|
+
[_gestureHandler handleGesture:self fromReset:YES];
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
#if !TARGET_OS_OSX
|
|
@@ -166,7 +171,6 @@
|
|
|
166
171
|
self.state = (self.state == UIGestureRecognizerStatePossible) ? UIGestureRecognizerStateFailed
|
|
167
172
|
: UIGestureRecognizerStateCancelled;
|
|
168
173
|
|
|
169
|
-
[self triggerAction];
|
|
170
174
|
[self reset];
|
|
171
175
|
return;
|
|
172
176
|
}
|
|
@@ -193,7 +197,6 @@
|
|
|
193
197
|
#if !TARGET_OS_TV && !TARGET_OS_OSX
|
|
194
198
|
[self tryUpdateStylusData:event];
|
|
195
199
|
#endif
|
|
196
|
-
[self triggerAction];
|
|
197
200
|
}
|
|
198
201
|
|
|
199
202
|
- (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
|
@@ -202,7 +205,6 @@
|
|
|
202
205
|
#if !TARGET_OS_TV && !TARGET_OS_OSX
|
|
203
206
|
[self tryUpdateStylusData:event];
|
|
204
207
|
#endif
|
|
205
|
-
[self triggerAction];
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
#if TARGET_OS_OSX
|
|
@@ -259,7 +261,7 @@
|
|
|
259
261
|
|
|
260
262
|
- (void)reset
|
|
261
263
|
{
|
|
262
|
-
[self
|
|
264
|
+
[self triggerActionFromReset];
|
|
263
265
|
[_gestureHandler.pointerTracker reset];
|
|
264
266
|
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil];
|
|
265
267
|
self.enabled = YES;
|
|
@@ -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:fromReset:)])) {
|
|
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 fromReset:(BOOL)fromReset
|
|
47
47
|
{
|
|
48
48
|
if (self.state == UIGestureRecognizerStateBegan) {
|
|
49
49
|
#if TARGET_OS_OSX
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
self.scale = 1;
|
|
53
53
|
#endif
|
|
54
54
|
}
|
|
55
|
-
[_gestureHandler handleGesture:recognizer];
|
|
55
|
+
[_gestureHandler handleGesture:recognizer fromReset:fromReset];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
- (void)interactionsBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
|
@@ -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:fromReset:)])) {
|
|
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 fromReset:(BOOL)fromReset
|
|
45
45
|
{
|
|
46
46
|
if (self.state == UIGestureRecognizerStateBegan) {
|
|
47
47
|
self.rotation = 0;
|
|
48
48
|
}
|
|
49
|
-
[_gestureHandler handleGesture:recognizer];
|
|
49
|
+
[_gestureHandler handleGesture:recognizer fromReset:fromReset];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
- (void)interactionsBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
|
@@ -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:fromReset:)])) {
|
|
51
51
|
_gestureHandler = gestureHandler;
|
|
52
52
|
_tapsSoFar = 0;
|
|
53
53
|
_numberOfTaps = defaultNumberOfTaps;
|
|
@@ -63,7 +63,12 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
63
63
|
|
|
64
64
|
- (void)triggerAction
|
|
65
65
|
{
|
|
66
|
-
[_gestureHandler handleGesture:self];
|
|
66
|
+
[_gestureHandler handleGesture:self fromReset:NO];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (void)triggerActionFromReset
|
|
70
|
+
{
|
|
71
|
+
[_gestureHandler handleGesture:self fromReset:YES];
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
- (void)cancel
|
|
@@ -116,7 +121,6 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
116
121
|
|
|
117
122
|
if ([self shouldFailUnderCustomCriteria]) {
|
|
118
123
|
self.state = UIGestureRecognizerStateFailed;
|
|
119
|
-
[self reset];
|
|
120
124
|
return;
|
|
121
125
|
}
|
|
122
126
|
|
|
@@ -130,7 +134,6 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
130
134
|
|
|
131
135
|
if (_numberOfTaps == _tapsSoFar && _maxNumberOfTouches >= _minPointers) {
|
|
132
136
|
self.state = UIGestureRecognizerStateEnded;
|
|
133
|
-
[self reset];
|
|
134
137
|
} else {
|
|
135
138
|
[self performSelector:@selector(cancel) withObject:nil afterDelay:_maxDelay];
|
|
136
139
|
}
|
|
@@ -140,8 +143,6 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
140
143
|
{
|
|
141
144
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
142
145
|
self.state = UIGestureRecognizerStateCancelled;
|
|
143
|
-
|
|
144
|
-
[self reset];
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
#if TARGET_OS_OSX
|
|
@@ -243,9 +244,7 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
|
|
|
243
244
|
|
|
244
245
|
- (void)reset
|
|
245
246
|
{
|
|
246
|
-
|
|
247
|
-
[self triggerAction];
|
|
248
|
-
}
|
|
247
|
+
[self triggerActionFromReset];
|
|
249
248
|
|
|
250
249
|
[_gestureHandler.pointerTracker reset];
|
|
251
250
|
|
package/apple/RNGestureHandler.h
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
- (void)unbindFromView;
|
|
81
81
|
- (void)resetConfig NS_REQUIRES_SUPER;
|
|
82
82
|
- (void)configure:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
|
|
83
|
-
- (void)handleGesture:(nonnull id)recognizer;
|
|
83
|
+
- (void)handleGesture:(nonnull id)recognizer fromReset:(BOOL)fromReset;
|
|
84
84
|
- (void)handleGesture:(nonnull id)recognizer inState:(RNGestureHandlerState)state;
|
|
85
85
|
- (BOOL)containsPointInView;
|
|
86
86
|
- (RNGestureHandlerState)state;
|
|
@@ -280,7 +280,7 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
|
|
|
280
280
|
#endif
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
|
283
|
+
- (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset
|
|
284
284
|
{
|
|
285
285
|
RNGHUIView *view = [self chooseViewForInteraction:recognizer];
|
|
286
286
|
|
|
@@ -292,6 +292,20 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
_state = [self recognizerState];
|
|
295
|
+
|
|
296
|
+
// From iOS 26.0 when recognizers are reset, their state is also changed to UIGestureRecognizerStatePossible.
|
|
297
|
+
// This means that our logic that relies on sending events in `reset` methods doesn't work properly. The bug that
|
|
298
|
+
// `onFinalize` was not send after `onBegin` happened because both recognizer states, `Began` and `Possible`, are
|
|
299
|
+
// mapped to our internal `Began` state. Because of that, _lastState had the same value as `_state` and callbacks were
|
|
300
|
+
// not triggered.
|
|
301
|
+
//
|
|
302
|
+
// While this solution is not great, we decided to check whether sending events was triggered from `reset` method.
|
|
303
|
+
// This way we can detect double Began mapping by checking previous sent state and current state of recognizer.
|
|
304
|
+
if (fromReset && _lastState == RNGestureHandlerStateBegan &&
|
|
305
|
+
self.recognizer.state == UIGestureRecognizerStatePossible) {
|
|
306
|
+
_state = RNGestureHandlerStateFailed;
|
|
307
|
+
}
|
|
308
|
+
|
|
295
309
|
[self handleGesture:recognizer inState:_state];
|
|
296
310
|
}
|
|
297
311
|
|
|
@@ -256,7 +256,7 @@ RCT_EXPORT_METHOD(flushOperations)
|
|
|
256
256
|
// do not send state change event when activating because it bypasses
|
|
257
257
|
// shouldRequireFailureOfGestureRecognizer
|
|
258
258
|
if (state != 4) {
|
|
259
|
-
[handler handleGesture:handler.recognizer];
|
|
259
|
+
[handler handleGesture:handler.recognizer fromReset:NO];
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
10
10
|
{
|
|
11
|
-
if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
|
|
11
|
+
if ((self = [super initWithTarget:self action:@selector(handleGesture:fromReset:)])) {
|
|
12
12
|
_handler = gestureHandler;
|
|
13
13
|
_activePointers = 0;
|
|
14
14
|
self.delegate = self;
|
package/package.json
CHANGED