File tree Expand file tree Collapse file tree
packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -572,8 +572,24 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
572572 * Returns whether or not the scroll view interaction should be blocked because
573573 * JavaScript was found to be the responder.
574574 */
575- - (BOOL )_shouldDisableScrollInteraction
575+ - (BOOL )_shouldDisableScrollInteractionForContentView : (UIView *) contentView
576576{
577+ UIView *view = contentView;
578+ while (view) {
579+ if ([view respondsToSelector: @selector (isJSResponder )]) {
580+ BOOL isJSResponder = ((UIView<RCTComponentViewProtocol> *)view).isJSResponder ;
581+ if (isJSResponder) {
582+ return YES ;
583+ }
584+ }
585+
586+ if (view == self) {
587+ break ;
588+ }
589+
590+ view = view.superview ;
591+ }
592+
577593 UIView *ancestorView = self.superview ;
578594
579595 while (ancestorView) {
@@ -736,11 +752,11 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
736752 static_cast <const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag (metrics);
737753}
738754
739- - (BOOL )touchesShouldCancelInContentView : (__unused UIView *)view
755+ - (BOOL )touchesShouldCancelInContentView : (UIView *)view
740756{
741757 // Historically, `UIScrollView`s in React Native do not cancel touches
742758 // started on `UIControl`-based views (as normal iOS `UIScrollView`s do).
743- return ![self _shouldDisableScrollInteraction ];
759+ return ![self _shouldDisableScrollInteractionForContentView: view ];
744760}
745761
746762- (void )scrollViewDidScroll : (UIScrollView *)scrollView
You can’t perform that action at this time.
0 commit comments