Skip to content

Commit

Permalink
Always run the momentum scroll Runnable so scroll position is updated…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed May 11, 2020
1 parent 3c90134 commit dba5887
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,9 @@ public void draw(Canvas canvas) {
* 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,9 @@ public void draw(Canvas canvas) {
* 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;
}

Expand Down

0 comments on commit dba5887

Please sign in to comment.