From caed50151fe518afbce7a529701389c9fecd61ca Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Wed, 13 Apr 2022 20:35:07 -0400 Subject: [PATCH] Fix autoscrollThreshold on iOS --- React/Views/ScrollView/RCTScrollView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index f0f64021aca6..b73719752629 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -944,7 +944,7 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager CGPointMake(self->_scrollView.contentOffset.x + deltaX, self->_scrollView.contentOffset.y); if (autoscrollThreshold != nil) { // If the offset WAS within the threshold of the start, animate to the start. - if (x - deltaX <= [autoscrollThreshold integerValue]) { + if (x <= [autoscrollThreshold integerValue]) { [self scrollToOffset:CGPointMake(-leftInset, self->_scrollView.contentOffset.y) animated:YES]; } } @@ -960,7 +960,7 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager CGPointMake(self->_scrollView.contentOffset.x, self->_scrollView.contentOffset.y + deltaY); if (autoscrollThreshold != nil) { // If the offset WAS within the threshold of the start, animate to the start. - if (y - deltaY <= [autoscrollThreshold integerValue]) { + if (y <= [autoscrollThreshold integerValue]) { [self scrollToOffset:CGPointMake(self->_scrollView.contentOffset.x, -bottomInset) animated:YES]; } }