Skip to content

Commit c254d08

Browse files
skellybFacebook Github Bot 9
authored andcommitted
endRefreshing animates scrollView to top inset instead of zero
Summary:To use a ScrollView and RefreshControl with a translucent navigation bar you have to set the top inset to the height of that bar, allowing the content to scroll underneath. After changes to RCTRefreshControl in **v0.22**, `endRefreshing` always animates the offset to 0, hiding content behind the navigation bar. What you'd expect on iOS is for it to return to the bottom of the bar. **Test plan** To see this in action, refer to the UIExplorerApp. In RefreshControlExample.js if you set the ScrollView's `contentInset={{top: 100}}` you'll see the refresh control UI is where you'd expect, and after refresh the list returns to the correct position. Closes facebook#6848 Differential Revision: D3157934 Pulled By: mkonicek fb-gh-sync-id: c2186a4541fb3988677f0851eb12c259cd003750 fbshipit-source-id: c2186a4541fb3988677f0851eb12c259cd003750
1 parent 39206f3 commit c254d08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

React/Views/RCTRefreshControl.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ - (void)endRefreshing
6868
// endRefreshing otherwise the next pull to refresh will not work properly.
6969
UIScrollView *scrollView = (UIScrollView *)self.superview;
7070
if (scrollView.contentOffset.y < 0) {
71-
CGPoint offset = {scrollView.contentOffset.x, 0};
71+
CGPoint offset = {scrollView.contentOffset.x, -scrollView.contentInset.top};
7272
[UIView animateWithDuration:0.25
7373
delay:0
7474
options:UIViewAnimationOptionBeginFromCurrentState

0 commit comments

Comments
 (0)