Skip to content

Commit

Permalink
Workaround a wrong fling direction if FlatList or VirtualizedList is …
Browse files Browse the repository at this point in the history
…inverted.
  • Loading branch information
mandrigin committed Sep 14, 2018
1 parent a3752c6 commit 107a9ec
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ public void getClippingRect(Rect outClippingRect) {

@Override
public void fling(int velocityY) {
// Workaround.
// On Android P if a ScrollView is inverted, we will get a wrong sign for
// velocityY (see https://issuetracker.google.com/issues/112385925).
// At the same time, mOnScrollDispatchHelper tracks the correct velocity direction.
//
// Hence, we can use the absolute value from whatever the OS gives
// us and use the sign of what mOnScrollDispatchHelper has tracked.
velocityY = (int)(Math.abs(velocityY) * Math.signum(mOnScrollDispatchHelper.getYFlingVelocity()));


if (mPagingEnabled) {
smoothScrollAndSnap(velocityY);
} else if (mScroller != null) {
Expand Down

0 comments on commit 107a9ec

Please sign in to comment.