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

Update RCTScrollView.m #13180

Closed
wants to merge 9 commits into from
6 changes: 4 additions & 2 deletions React/Views/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,11 @@ - (void)scrollToEnd:(BOOL)animated
BOOL isHorizontal = [self isHorizontal:_scrollView];
CGPoint offset;
if (isHorizontal) {
offset = CGPointMake(_scrollView.contentSize.width - _scrollView.bounds.size.width, 0);
CGFloat offsetX = _scrollView.contentSize.width - _scrollView.bounds.size.width;
offset = CGPointMake(MAX(offsetX, 0), 0);
} else {
offset = CGPointMake(0, _scrollView.contentSize.height - _scrollView.bounds.size.height);
CGFloat offsetY = _scrollView.contentSize.height - _scrollView.bounds.size.height;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid that we forget to consider contentInset here. :(

offset = CGPointMake(0, MAX(offsetY, 0));
}
if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
// Ensure at least one scroll event will fire
Expand Down