diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java index 82099cb25b6b03..470c7d0f9bff70 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java @@ -1231,8 +1231,12 @@ public void scrollTo(int x, int y) { } super.scrollTo(x, y); - updateStateOnScroll(x, y); - setPendingContentOffsets(x, y); + // The final scroll position might be different from (x, y). For example, we may need to scroll + // to the last item in the list, but that item cannot be move to the start position of the view. + final int actualX = getScrollX(); + final int actualY = getScrollY(); + updateStateOnScroll(actualX, actualY); + setPendingContentOffsets(actualX, actualY); } /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java index 3b920a6f505b80..54643e6e2da4b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java @@ -1006,8 +1006,12 @@ public void onAnimationRepeat(Animator animator) {} @Override public void scrollTo(int x, int y) { super.scrollTo(x, y); - updateStateOnScroll(x, y); - setPendingContentOffsets(x, y); + // The final scroll position might be different from (x, y). For example, we may need to scroll + // to the last item in the list, but that item cannot be move to the start position of the view. + final int actualX = getScrollX(); + final int actualY = getScrollY(); + updateStateOnScroll(actualX, actualY); + setPendingContentOffsets(actualX, actualY); } /**