File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ NOTE: This file is *not* currently used, for context see:
3+ - https://github.com/callstack/react-native-pager-view/pull/783#discussion_r1410295171
4+ - https://github.com/callstack/react-native-pager-view/pull/783#discussion_r1410316201
5+ */
6+
7+ @interface RNCPagerScrollView : UIScrollView <UIGestureRecognizerDelegate>
8+ @end
Original file line number Diff line number Diff line change 1+ /*
2+ NOTE: This file is *not* currently used, for context see:
3+ - https://github.com/callstack/react-native-pager-view/pull/783#discussion_r1410295171
4+ - https://github.com/callstack/react-native-pager-view/pull/783#discussion_r1410316201
5+ */
6+
7+ #import " RNCPagerScrollView.h"
8+
9+ @implementation RNCPagerScrollView
10+ - (instancetype )initWithFrame : (CGRect)frame {
11+ if (self = [super initWithFrame: frame]) {
12+ self.panGestureRecognizer .delegate = self;
13+ }
14+ return self;
15+ }
16+
17+ - (BOOL )gestureRecognizer : (UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer : (UIGestureRecognizer *)otherGestureRecognizer {
18+ if (gestureRecognizer == self.panGestureRecognizer ) {
19+ CGPoint velocity = [self .panGestureRecognizer velocityInView: self ];
20+ UIUserInterfaceLayoutDirection layoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute: self .semanticContentAttribute];
21+ BOOL isLTR = UIUserInterfaceLayoutDirectionLeftToRight == layoutDirection;
22+ BOOL isBackGesture = (isLTR && velocity.x > 0 ) || (!isLTR && velocity.x < 0 );
23+ // if it's back gesture and scroll view is at the beginning of scroll we allow simultaneous gesture
24+ if (isBackGesture && self.contentOffset .x <= 0 ) {
25+ return YES ;
26+ }
27+ }
28+ return NO ;
29+ }
30+
31+ @end
You can’t perform that action at this time.
0 commit comments