|
15 | 15 |
|
16 | 16 | using namespace facebook::react; |
17 | 17 |
|
18 | | -@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate> |
19 | | - |
20 | | -@property(nonatomic, assign) UIPanGestureRecognizer* panGestureRecognizer; |
21 | | - |
| 18 | +@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate> |
22 | 19 | @end |
23 | 20 |
|
24 | 21 | @implementation RNCPagerViewComponentView { |
@@ -66,11 +63,6 @@ - (instancetype)initWithFrame:(CGRect)frame |
66 | 63 | _destinationIndex = -1; |
67 | 64 | _layoutDirection = @"ltr"; |
68 | 65 | _overdrag = NO; |
69 | | - UIPanGestureRecognizer* panGestureRecognizer = [UIPanGestureRecognizer new]; |
70 | | - self.panGestureRecognizer = panGestureRecognizer; |
71 | | - panGestureRecognizer.delegate = self; |
72 | | - [self addGestureRecognizer: panGestureRecognizer]; |
73 | | - |
74 | 66 | } |
75 | 67 |
|
76 | 68 | return self; |
@@ -406,29 +398,6 @@ + (ComponentDescriptorProvider)componentDescriptorProvider |
406 | 398 | } |
407 | 399 |
|
408 | 400 |
|
409 | | -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { |
410 | | - |
411 | | - // Recognize simultaneously only if the other gesture is RN Screen's pan gesture (one that is used to perform fullScreenGestureEnabled) |
412 | | - if (gestureRecognizer == self.panGestureRecognizer && [NSStringFromClass([otherGestureRecognizer class]) isEqual: @"RNSPanGestureRecognizer"]) { |
413 | | - UIPanGestureRecognizer* panGestureRecognizer = (UIPanGestureRecognizer*) gestureRecognizer; |
414 | | - CGPoint velocity = [panGestureRecognizer velocityInView:self]; |
415 | | - BOOL isLTR = [self isLtrLayout]; |
416 | | - BOOL isBackGesture = (isLTR && velocity.x > 0) || (!isLTR && velocity.x < 0); |
417 | | - |
418 | | - if (self.currentIndex == 0 && isBackGesture) { |
419 | | - scrollView.panGestureRecognizer.enabled = false; |
420 | | - } else { |
421 | | - const auto &viewProps = *std::static_pointer_cast<const RNCViewPagerProps>(_props); |
422 | | - scrollView.panGestureRecognizer.enabled = viewProps.scrollEnabled; |
423 | | - } |
424 | | - |
425 | | - return YES; |
426 | | - } |
427 | | - const auto &viewProps = *std::static_pointer_cast<const RNCViewPagerProps>(_props); |
428 | | - scrollView.panGestureRecognizer.enabled = viewProps.scrollEnabled; |
429 | | - return NO; |
430 | | -} |
431 | | - |
432 | 401 | @end |
433 | 402 |
|
434 | 403 | Class<RCTComponentViewProtocol> RNCViewPagerCls(void) |
|
0 commit comments