From 9a9d81a3171324da61ecb65c074e6ecdf283cc8c Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Wed, 22 Jan 2025 00:21:44 +0800 Subject: [PATCH] [iOS] Fabric: Fixes TouchableOpacity not work in ScrollView --- .../ComponentViews/ScrollView/RCTScrollViewComponentView.mm | 2 +- .../Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 d029337fb0d40f..17fdec7ab39ea3 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -132,7 +132,7 @@ - (instancetype)initWithFrame:(CGRect)frame _automaticallyAdjustKeyboardInsets = NO; [self addSubview:_scrollView]; - _containerView = [[UIView alloc] initWithFrame:CGRectZero]; + _containerView = [[RCTViewComponentView alloc] initWithFrame:CGRectZero]; [_scrollView addSubview:_containerView]; [self.scrollViewDelegateSplitter addDelegate:self]; diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index e1d731ae17ee07..e4574dea619179 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -617,7 +617,7 @@ - (UIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event BOOL clipsToBounds = self.currentContainerView.clipsToBounds; - clipsToBounds = clipsToBounds || _layoutMetrics.overflowInset == EdgeInsets{}; + clipsToBounds = clipsToBounds || (_layoutMetrics.overflowInset == EdgeInsets{} && _props->getClipsContentToBounds()); if (clipsToBounds && !isPointInside) { return nil;