From 9a5faac12b7ff929341bcbb12a604e10110443a3 Mon Sep 17 00:00:00 2001 From: Soe Lynn Date: Wed, 29 May 2024 07:49:13 -0700 Subject: [PATCH] overflow props is not honored in ScrollView in new architecture (#44699) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44699 Changelog: [Internal] In Fabric, overflow props for ScrollView is not passed down. Hence, the overflow props is ignored and FlatList content is always clipped. Reported from OSS https://github.com/facebook/react-native/issues/44683 Reviewed By: sammy-SC Differential Revision: D57895399 fbshipit-source-id: 6ce65bea0803971060e8229b66563123dd6fc114 --- .../ScrollView/RCTScrollViewComponentView.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 24e256a09d3..547dd819a74 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -122,8 +122,8 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol { if (self = [super initWithFrame:frame]) { _props = ScrollViewShadowNode::defaultSharedProps(); - _scrollView = [[RCTEnhancedScrollView alloc] initWithFrame:self.bounds]; + _scrollView.clipsToBounds = _props->getClipsContentToBounds(); _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _scrollView.delaysContentTouches = NO; ((RCTEnhancedScrollView *)_scrollView).overridingDelegate = self; @@ -253,6 +253,11 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol } } + // Overflow prop + if (oldScrollViewProps.getClipsContentToBounds() != newScrollViewProps.getClipsContentToBounds()) { + _scrollView.clipsToBounds = newScrollViewProps.getClipsContentToBounds(); + } + MAP_SCROLL_VIEW_PROP(zoomScale); if (oldScrollViewProps.contentInset != newScrollViewProps.contentInset) {