From c254d081fdcda2e243e1982a4ed7f6294c254355 Mon Sep 17 00:00:00 2001 From: skellyb Date: Wed, 13 Apr 2016 08:14:13 -0700 Subject: [PATCH] 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 https://github.com/facebook/react-native/pull/6848 Differential Revision: D3157934 Pulled By: mkonicek fb-gh-sync-id: c2186a4541fb3988677f0851eb12c259cd003750 fbshipit-source-id: c2186a4541fb3988677f0851eb12c259cd003750 --- React/Views/RCTRefreshControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Views/RCTRefreshControl.m b/React/Views/RCTRefreshControl.m index 5d24ffadc7d..8b8638a2d94 100644 --- a/React/Views/RCTRefreshControl.m +++ b/React/Views/RCTRefreshControl.m @@ -68,7 +68,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) // endRefreshing otherwise the next pull to refresh will not work properly. UIScrollView *scrollView = (UIScrollView *)self.superview; if (scrollView.contentOffset.y < 0) { - CGPoint offset = {scrollView.contentOffset.x, 0}; + CGPoint offset = {scrollView.contentOffset.x, -scrollView.contentInset.top}; [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState