Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,24 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
* Returns whether or not the scroll view interaction should be blocked because
* JavaScript was found to be the responder.
*/
- (BOOL)_shouldDisableScrollInteraction
- (BOOL)_shouldDisableScrollInteractionForContentView:(UIView *)contentView
{
UIView *view = contentView;
while (view) {
if ([view respondsToSelector:@selector(isJSResponder)]) {
BOOL isJSResponder = ((UIView<RCTComponentViewProtocol> *)view).isJSResponder;
if (isJSResponder) {
return YES;
}
}

if (view == self) {
break;
}

view = view.superview;
}

UIView *ancestorView = self.superview;

while (ancestorView) {
Expand Down Expand Up @@ -736,11 +752,11 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag(metrics);
}

- (BOOL)touchesShouldCancelInContentView:(__unused UIView *)view
- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
// Historically, `UIScrollView`s in React Native do not cancel touches
// started on `UIControl`-based views (as normal iOS `UIScrollView`s do).
return ![self _shouldDisableScrollInteraction];
return ![self _shouldDisableScrollInteractionForContentView:view];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
Expand Down
Loading