From fbbfeb6426767b336e0619ec95d6f601f9a8991b Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 17 Jun 2019 19:15:30 -0700 Subject: [PATCH] Fabric: Fixed ScrollView layout issue Summary: We should not use `self.contentView` accessor to insert container views (views that might be used as a container for nested views) into component view otherwise it causes double applying of padding values. Reviewed By: mdvacca Differential Revision: D15862075 fbshipit-source-id: aad834aeca06f66b19c2f7bbaa0b58f937e66994 --- .../ComponentViews/ScrollView/RCTScrollViewComponentView.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 6bc664b43c0..7dab050fc1a 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -46,8 +46,9 @@ using namespace facebook::react; _props = defaultProps; _scrollView = [[RCTEnhancedScrollView alloc] initWithFrame:self.bounds]; + _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _scrollView.delaysContentTouches = NO; - self.contentView = _scrollView; + [self addSubview:_scrollView]; _containerView = [[UIView alloc] initWithFrame:CGRectZero]; [_scrollView addSubview:_containerView];