Skip to content

Commit efcab20

Browse files
cbrevikmeta-codesync[bot]
authored andcommitted
Fix ScrollView touch events ignored in contentInset area on iOS (#56747)
Summary: Fixes #54123 In RN 0.80, `betterHitTest:withEvent:` in `RCTScrollViewComponentView` was added, which returns `self` (the `RCTScrollViewComponentView` wrapper view) when a touch point falls inside the scroll view's bounds. This causes touches in the contentInset area — where no content is rendered — to be absorbed by the wrapper rather than forwarded to the underlying UIScrollView, making scroll gestures in that region completely non-functional. The fix returns `_scrollView` instead of `self`, so hit-tested touches are correctly attributed to the `UIScrollView` and scrolling works throughout the full bounds, including the inset area. ## Changelog: [IOS] [FIXED] - Fix ScrollView touch events ignored in contentInset area on Fabric Pull Request resolved: #56747 Test Plan: Couldn't use the snack-repro from #54123 since this requires a native change. But using the `ScrollViewSimpleExample` from the RNTester, and removing a lot of the items demonstrates the behaviour change. The two videos show attempted dragging from the region below the ScrollView content. ### Before: Dragging in the inset area does nothing — scroll view does not respond https://github.com/user-attachments/assets/55468ca8-78a7-4034-9e34-0191d55f7da1 ### After: Dragging in the inset area scrolls the content correctly https://github.com/user-attachments/assets/d1f10729-9b41-4a55-8738-16faf27031d7 Reviewed By: christophpurrer Differential Revision: D104644045 Pulled By: javache fbshipit-source-id: c8b856ff133705f2197ce9938d5ebafae46d0c17
1 parent b09fce6 commit efcab20

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ - (UIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event
523523
}
524524
}
525525

526-
return isPointInside ? self : nil;
526+
return isPointInside ? _scrollView : nil;
527527
}
528528

529529
/*

0 commit comments

Comments
 (0)