Skip to content

Commit

Permalink
Fix sticky headers position when scrolling while RefreshControl is re…
Browse files Browse the repository at this point in the history
…freshing

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 facebook#5405
Closes facebook#5517

Reviewed By: svcscm

Differential Revision: D2895623

Pulled By: nicklockwood

fb-gh-sync-id: 81df36cccfc3e7b973c2be78565f8b8408c9fc12
  • Loading branch information
janicduplessis authored and facebook-github-bot-6 committed Feb 3, 2016
1 parent 4a3900b commit 34389c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions React/Views/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ - (void)dockClosestSectionHeader
{
UIView *contentView = [self contentView];
CGFloat scrollTop = self.bounds.origin.y + self.contentInset.top;
// If the RefreshControl is refreshing, remove it's height so sticky headers are
// positioned properly when scrolling down while refreshing.
if (self.refreshControl != nil && self.refreshControl.refreshing) {
scrollTop -= self.refreshControl.frame.size.height;
}

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

0 comments on commit 34389c5

Please sign in to comment.