Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting the contentOffset value when refresh ends #24191

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions React/Views/RCTRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ - (void)beginRefreshingProgrammatically

- (void)endRefreshingProgrammatically
{
// The contentOffset of the scrollview MUST be greater than 0 before calling
// The contentOffset of the scrollview MUST be greater than the contentInset before calling
// endRefreshing otherwise the next pull to refresh will not work properly.
UIScrollView *scrollView = (UIScrollView *)self.superview;
if (_refreshingProgrammatically && scrollView.contentOffset.y < 0) {
if (_refreshingProgrammatically && scrollView.contentOffset.y < -scrollView.contentInset.top) {
UInt64 endRefreshingTimestamp = _currentRefreshingStateTimestamp;
CGPoint offset = {scrollView.contentOffset.x, 0};
CGPoint offset = {scrollView.contentOffset.x, -scrollView.contentInset.top};
[UIView animateWithDuration:0.25
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
Expand Down