Skip to content

Commit

Permalink
Fix: Avoid contentInsets overwrites scrollIndicatorInsets on iOS face…
Browse files Browse the repository at this point in the history
…book#13025

Fix to avoid contentInsets always overwrites scrollIndicatorInsets of ScrollView/ListView.
According to issue facebook#13025 https://github.com/facebook/react-native/blob/a8391bde7d757d01521a6d12170fb9090c17a6a0/React/Views/RCTView.m#L299
always overide `scrollIndicatorInsets` when called and only works when `contentInsets` is not set.
We only need to worry about when `contentInsets` is set, We only have to check and reset it after `autoAdjustInsetsForView` is called.
  • Loading branch information
timotew authored Dec 31, 2017
1 parent a8391bd commit d1b9d32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions React/Views/ScrollView/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
_automaticallyAdjustContentInsets = YES;
_DEPRECATED_sendUpdatedChildFrames = NO;
_contentInset = UIEdgeInsetsZero;
_scrollIndicatorInsets = UIEdgeInsetsZero;
_contentSize = CGSizeZero;
_lastClippedToRect = CGRectNull;

Expand Down Expand Up @@ -552,6 +553,10 @@ - (void)setContentInset:(UIEdgeInsets)contentInset
withScrollView:_scrollView
updateOffset:NO];

if (!UIEdgeInsetsEqualToEdgeInsets(scrollIndicatorInsets, _scrollIndicatorInsets)) {
_scrollView.scrollIndicatorInsets = scrollIndicatorInsets;
}

_scrollView.contentOffset = contentOffset;
}

Expand Down

0 comments on commit d1b9d32

Please sign in to comment.