react-native-gesture-handler 2.10.2 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ios/RNGestureHandlerManager.mm +24 -12
- package/package.json +1 -1
@@ -3,6 +3,7 @@
|
|
3
3
|
#import <React/RCTComponent.h>
|
4
4
|
#import <React/RCTEventDispatcher.h>
|
5
5
|
#import <React/RCTLog.h>
|
6
|
+
#import <React/RCTModalHostViewController.h>
|
6
7
|
#import <React/RCTRootContentView.h>
|
7
8
|
#import <React/RCTRootView.h>
|
8
9
|
#import <React/RCTUIManager.h>
|
@@ -15,6 +16,7 @@
|
|
15
16
|
#import "RNRootViewGestureRecognizer.h"
|
16
17
|
|
17
18
|
#ifdef RCT_NEW_ARCH_ENABLED
|
19
|
+
#import <React/RCTFabricModalHostViewController.h>
|
18
20
|
#import <React/RCTSurfaceTouchHandler.h>
|
19
21
|
#import <React/RCTSurfaceView.h>
|
20
22
|
#import <React/RCTViewComponentView.h>
|
@@ -199,15 +201,26 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
199
201
|
#ifdef RCT_NEW_ARCH_ENABLED
|
200
202
|
UIView *touchHandlerView = childView;
|
201
203
|
|
202
|
-
|
203
|
-
touchHandlerView =
|
204
|
+
if ([[childView reactViewController] isKindOfClass:[RCTFabricModalHostViewController class]]) {
|
205
|
+
touchHandlerView = [childView reactViewController].view;
|
206
|
+
} else {
|
207
|
+
while (touchHandlerView != nil && ![touchHandlerView isKindOfClass:[RCTSurfaceView class]]) {
|
208
|
+
touchHandlerView = touchHandlerView.superview;
|
209
|
+
}
|
204
210
|
}
|
205
211
|
#else
|
206
|
-
UIView *
|
207
|
-
|
208
|
-
|
212
|
+
UIView *touchHandlerView = nil;
|
213
|
+
|
214
|
+
if ([[childView reactViewController] isKindOfClass:[RCTModalHostViewController class]]) {
|
215
|
+
touchHandlerView = [childView reactViewController].view.subviews[0];
|
216
|
+
} else {
|
217
|
+
UIView *parent = childView;
|
218
|
+
while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)]) {
|
219
|
+
parent = parent.superview;
|
220
|
+
}
|
209
221
|
|
210
|
-
|
222
|
+
touchHandlerView = [[parent performSelector:@selector(touchHandler)] view];
|
223
|
+
}
|
211
224
|
#endif // RCT_NEW_ARCH_ENABLED
|
212
225
|
|
213
226
|
if (touchHandlerView == nil) {
|
@@ -247,20 +260,19 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
247
260
|
if ([gestureRecognizer.view isKindOfClass:[UIScrollView class]])
|
248
261
|
return;
|
249
262
|
|
250
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
251
263
|
UIGestureRecognizer *touchHandler = nil;
|
252
264
|
|
253
|
-
//
|
254
|
-
// this little trick to get access to it
|
265
|
+
// this way we can extract the touch handler on both architectures relatively easily
|
255
266
|
for (UIGestureRecognizer *recognizer in [viewWithTouchHandler gestureRecognizers]) {
|
267
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
256
268
|
if ([recognizer isKindOfClass:[RCTSurfaceTouchHandler class]]) {
|
269
|
+
#else
|
270
|
+
if ([recognizer isKindOfClass:[RCTTouchHandler class]]) {
|
271
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
257
272
|
touchHandler = recognizer;
|
258
273
|
break;
|
259
274
|
}
|
260
275
|
}
|
261
|
-
#else
|
262
|
-
RCTTouchHandler *touchHandler = [viewWithTouchHandler performSelector:@selector(touchHandler)];
|
263
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
264
276
|
[touchHandler setEnabled:NO];
|
265
277
|
[touchHandler setEnabled:YES];
|
266
278
|
}
|
package/package.json
CHANGED