Fix likely bug in maintainVisibleContentPosition (#54363)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54363

The calculus for active scroll maintainVisibleContentPosition is not isomorphic between ReactHorizontalScrollView and ReactScrollView. Additiionally, it doesn't make sense that we would use an x-offset in a y-offset calculation. This fixes a likely bug where the OverScroller's x-offset is used to compute the scroll animation update in ReactScrollView.recreateFlingAnimation.

## Changelog

[Android][Fixed] - Issue with restarting scroll in maintainVisibleContentPosition

Reviewed By: javache

Differential Revision: D86021007

fbshipit-source-id: 0d7febcbccd59df534bacbba7f1b5bb5085fa95f
This commit is contained in:
Eric Rozell authored and meta-codesync[bot] committed 2025-11-03 06:06:09 -08:00
1 parent 19d87c874e
commit a034841fd6
1 file changed
+1 -1
@@ -1367,7 +1367,7 @@ public class ReactScrollView extends ScrollView
mScroller.fling(getScrollX(), scrollY, 0, (int) flingVelocityY, 0, 0, 0, Integer.MAX_VALUE);
} else {
scrollTo(getScrollX(), scrollY + (mScroller.getCurrX() - scrollerYBeforeTick));
scrollTo(getScrollX(), scrollY + (mScroller.getCurrY() - scrollerYBeforeTick));
}
}
}