|
| 1 | +diff --git a/node_modules/react-native-pager-view/ios/Fabric/RNCPagerViewComponentView.mm b/node_modules/react-native-pager-view/ios/Fabric/RNCPagerViewComponentView.mm |
| 2 | +index 652a5c1..c7de2e9 100644 |
| 3 | +--- a/node_modules/react-native-pager-view/ios/Fabric/RNCPagerViewComponentView.mm |
| 4 | ++++ b/node_modules/react-native-pager-view/ios/Fabric/RNCPagerViewComponentView.mm |
| 5 | +@@ -14,7 +14,7 @@ |
| 6 | + |
| 7 | + using namespace facebook::react; |
| 8 | + |
| 9 | +-@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate> |
| 10 | ++@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate> |
| 11 | + |
| 12 | + @property(nonatomic, assign) UIPanGestureRecognizer* panGestureRecognizer; |
| 13 | + |
| 14 | +@@ -73,11 +73,6 @@ using namespace facebook::react; |
| 15 | + _destinationIndex = -1; |
| 16 | + _layoutDirection = @"ltr"; |
| 17 | + _overdrag = NO; |
| 18 | +- UIPanGestureRecognizer* panGestureRecognizer = [UIPanGestureRecognizer new]; |
| 19 | +- self.panGestureRecognizer = panGestureRecognizer; |
| 20 | +- panGestureRecognizer.delegate = self; |
| 21 | +- [self addGestureRecognizer: panGestureRecognizer]; |
| 22 | +- |
| 23 | + } |
| 24 | + |
| 25 | + return self; |
| 26 | +@@ -421,29 +416,6 @@ using namespace facebook::react; |
| 27 | + } |
| 28 | + |
| 29 | + |
| 30 | +-- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { |
| 31 | +- |
| 32 | +- // Recognize simultaneously only if the other gesture is RN Screen's pan gesture (one that is used to perform fullScreenGestureEnabled) |
| 33 | +- if (gestureRecognizer == self.panGestureRecognizer && [NSStringFromClass([otherGestureRecognizer class]) isEqual: @"RNSPanGestureRecognizer"]) { |
| 34 | +- UIPanGestureRecognizer* panGestureRecognizer = (UIPanGestureRecognizer*) gestureRecognizer; |
| 35 | +- CGPoint velocity = [panGestureRecognizer velocityInView:self]; |
| 36 | +- BOOL isLTR = [self isLtrLayout]; |
| 37 | +- BOOL isBackGesture = (isLTR && velocity.x > 0) || (!isLTR && velocity.x < 0); |
| 38 | +- |
| 39 | +- if (self.currentIndex == 0 && isBackGesture) { |
| 40 | +- scrollView.panGestureRecognizer.enabled = false; |
| 41 | +- } else { |
| 42 | +- const auto &viewProps = *std::static_pointer_cast<const RNCViewPagerProps>(_props); |
| 43 | +- scrollView.panGestureRecognizer.enabled = viewProps.scrollEnabled; |
| 44 | +- } |
| 45 | +- |
| 46 | +- return YES; |
| 47 | +- } |
| 48 | +- const auto &viewProps = *std::static_pointer_cast<const RNCViewPagerProps>(_props); |
| 49 | +- scrollView.panGestureRecognizer.enabled = viewProps.scrollEnabled; |
| 50 | +- return NO; |
| 51 | +-} |
| 52 | +- |
| 53 | + @end |
| 54 | + |
| 55 | + Class<RCTComponentViewProtocol> RNCViewPagerCls(void) |
| 56 | +diff --git a/node_modules/react-native-pager-view/ios/RNCPagerView.m b/node_modules/react-native-pager-view/ios/RNCPagerView.m |
| 57 | +index 507b45d..4253edc 100644 |
| 58 | +--- a/node_modules/react-native-pager-view/ios/RNCPagerView.m |
| 59 | ++++ b/node_modules/react-native-pager-view/ios/RNCPagerView.m |
| 60 | +@@ -8,9 +8,7 @@ |
| 61 | + #import "RCTOnPageSelected.h" |
| 62 | + #import <math.h> |
| 63 | + |
| 64 | +-@interface RNCPagerView () <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate> |
| 65 | +- |
| 66 | +-@property(nonatomic, assign) UIPanGestureRecognizer* panGestureRecognizer; |
| 67 | ++@interface RNCPagerView () <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate> |
| 68 | + |
| 69 | + @property(nonatomic, strong) UIPageViewController *reactPageViewController; |
| 70 | + @property(nonatomic, strong) RCTEventDispatcher *eventDispatcher; |
| 71 | +@@ -48,10 +46,6 @@ |
| 72 | + _cachedControllers = [NSHashTable hashTableWithOptions:NSHashTableStrongMemory]; |
| 73 | + _overdrag = NO; |
| 74 | + _layoutDirection = @"ltr"; |
| 75 | +- UIPanGestureRecognizer* panGestureRecognizer = [UIPanGestureRecognizer new]; |
| 76 | +- self.panGestureRecognizer = panGestureRecognizer; |
| 77 | +- panGestureRecognizer.delegate = self; |
| 78 | +- [self addGestureRecognizer: panGestureRecognizer]; |
| 79 | + } |
| 80 | + return self; |
| 81 | + } |
| 82 | +@@ -474,28 +468,6 @@ |
| 83 | + return scrollDirection; |
| 84 | + } |
| 85 | + |
| 86 | +-- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { |
| 87 | +- |
| 88 | +- // Recognize simultaneously only if the other gesture is RN Screen's pan gesture (one that is used to perform fullScreenGestureEnabled) |
| 89 | +- if (gestureRecognizer == self.panGestureRecognizer && [NSStringFromClass([otherGestureRecognizer class]) isEqual: @"RNSPanGestureRecognizer"]) { |
| 90 | +- UIPanGestureRecognizer* panGestureRecognizer = (UIPanGestureRecognizer*) gestureRecognizer; |
| 91 | +- CGPoint velocity = [panGestureRecognizer velocityInView:self]; |
| 92 | +- BOOL isLTR = [self isLtrLayout]; |
| 93 | +- BOOL isBackGesture = (isLTR && velocity.x > 0) || (!isLTR && velocity.x < 0); |
| 94 | +- |
| 95 | +- if (self.currentIndex == 0 && isBackGesture) { |
| 96 | +- self.scrollView.panGestureRecognizer.enabled = false; |
| 97 | +- } else { |
| 98 | +- self.scrollView.panGestureRecognizer.enabled = self.scrollEnabled; |
| 99 | +- } |
| 100 | +- |
| 101 | +- return YES; |
| 102 | +- } |
| 103 | +- |
| 104 | +- self.scrollView.panGestureRecognizer.enabled = self.scrollEnabled; |
| 105 | +- return NO; |
| 106 | +-} |
| 107 | +- |
| 108 | + - (BOOL)isLtrLayout { |
| 109 | + return [_layoutDirection isEqualToString:@"ltr"]; |
| 110 | + } |
0 commit comments