From 805f1493c7026da487f04a0e77fc79bc3c79bc98 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 83511c3afa1..5bc1ca6f95c 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -121,8 +121,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; @@ -250,6 +250,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) {