Early exit in scrollToOffset if contentOffset wouldn't change

Summary:
changelog: [internal]

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

Reviewed By: cipolleschi

Differential Revision: D38499666

fbshipit-source-id: ee0bb155fa1619dfd49bca434bf2eee7ad7df9e0
This commit is contained in:
Samuel Susla
2022-08-08 05:01:19 -07:00
committed by Facebook GitHub Bot
parent 904b3b67e2
commit dfbf7d4e14
@@ -649,6 +649,10 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
{
if (CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
return;
}
[self _forceDispatchNextScrollEvent];
if (_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) {