Skip to content

Commit

Permalink
Early exit in scrollToOffset if contentOffset wouldn't change (micros…
Browse files Browse the repository at this point in the history
…oft#1486)

Summary:
changelog: [internal]

Calling `scrollToOffset` with already set content offset doesn't make sense.

Reviewed By: cipolleschi

Differential Revision: D38499666

fbshipit-source-id: ee0bb155fa1619dfd49bca434bf2eee7ad7df9e0

Co-authored-by: Samuel Susla <[email protected]>
  • Loading branch information
2 people authored and Shawn Dempsey committed Mar 10, 2023
1 parent c052800 commit 1a129bc
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,10 @@ - (void)scrollToOffset:(CGPoint)offset

- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
{
if (CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
return;
}

[self _forceDispatchNextScrollEvent];

if (_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) {
Expand Down

0 comments on commit 1a129bc

Please sign in to comment.