Skip to content

Commit 34389c5

Browse files
janicduplessisfacebook-github-bot-6
authored andcommitted
Fix sticky headers position when scrolling while RefreshControl is refreshing
Summary: When scrolling while RefreshControl is refreshing the sticky headers are offset by the height of the UIRefreshControl. This simply removes the height of the UIRefreshControl while it is refreshing and fixes the problem. You can repro the bug using this example in UIExplorer by doing a pull to refresh and scrolling the ListView immediately after. https://gist.github.com/janicduplessis/26b4f2758e90b2aa1620 Fixes #5405 Closes react/react-native#5517 Reviewed By: svcscm Differential Revision: D2895623 Pulled By: nicklockwood fb-gh-sync-id: 81df36cccfc3e7b973c2be78565f8b8408c9fc12
1 parent 4a3900b commit 34389c5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

React/Views/RCTScrollView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ - (void)dockClosestSectionHeader
275275
{
276276
UIView *contentView = [self contentView];
277277
CGFloat scrollTop = self.bounds.origin.y + self.contentInset.top;
278+
// If the RefreshControl is refreshing, remove it's height so sticky headers are
279+
// positioned properly when scrolling down while refreshing.
280+
if (self.refreshControl != nil && self.refreshControl.refreshing) {
281+
scrollTop -= self.refreshControl.frame.size.height;
282+
}
278283

279284
// Find the section headers that need to be docked
280285
__block UIView *previousHeader = nil;

0 commit comments

Comments
 (0)