From dba588741c17d64a350676727a20a24ac4b8b4c6 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Mon, 11 May 2020 11:11:44 -0700 Subject: [PATCH] Always run the momentum scroll Runnable so scroll position is updated on Fabric Summary: This early return is a very minor perf optimization, and it complicates things on Fabric: if scroll perf logging is disabled, the scroll position in C++ (State) doesn't get updated for the scrollview. Just remove it. Always run the Runnable, no matter what. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D21503695 fbshipit-source-id: 13dfe232d692ff544bff725a2344a66b572f5444 --- .../react/views/scroll/ReactHorizontalScrollView.java | 7 ------- .../com/facebook/react/views/scroll/ReactScrollView.java | 7 ------- 2 files changed, 14 deletions(-) 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 61d40f287c8..c6db70340f8 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 @@ -607,16 +607,9 @@ public class ReactHorizontalScrollView extends HorizontalScrollView * runnable that checks if we scrolled in the last frame and if so assumes we are still scrolling. */ private void handlePostTouchScrolling(int velocityX, int velocityY) { - // If we aren't going to do anything (send events or snap to page), we can early exit out. - if (!mSendMomentumEvents && !mPagingEnabled && !isScrollPerfLoggingEnabled()) { - updateStateOnScroll(); - return; - } - // Check if we are already handling this which may occur if this is called by both the touch up // and a fling call if (mPostTouchRunnable != null) { - updateStateOnScroll(); return; } 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 bc3f3da39c1..5016bafe25e 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 @@ -494,16 +494,9 @@ public class ReactScrollView extends ScrollView * runnable that checks if we scrolled in the last frame and if so assumes we are still scrolling. */ private void handlePostTouchScrolling(int velocityX, int velocityY) { - // If we aren't going to do anything (send events or snap to page), we can early exit out. - if (!mSendMomentumEvents && !mPagingEnabled && !isScrollPerfLoggingEnabled()) { - updateStateOnScroll(); - return; - } - // Check if we are already handling this which may occur if this is called by both the touch up // and a fling call if (mPostTouchRunnable != null) { - updateStateOnScroll(); return; }