Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -859,16 +859,18 @@ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
float hScroll = ev.getAxisValue(MotionEvent.AXIS_HSCROLL);
if (hScroll != 0) {
// Perform the scroll
enableFpsListener();
boolean result = super.dispatchGenericMotionEvent(ev);
// Schedule snap alignment to run after scrolling stops
if (result
&& (mPagingEnabled
|| mSnapInterval != 0
|| mSnapOffsets != null
|| mSnapToAlignment != SNAP_ALIGNMENT_DISABLED)) {
// Cancel any pending runnable and reschedule
// Cancel any pending post-touch runnable and reschedule
if (mPostTouchRunnable != null) {
removeCallbacks(mPostTouchRunnable);
mPostTouchRunnable = null;
}
mPostTouchRunnable =
new Runnable() {
Expand All @@ -882,9 +884,12 @@ public void run() {
velocityX = 0;
}
flingAndSnap(velocityX);
handlePostTouchScrolling(velocityX, 0);
}
};
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
} else {
handlePostTouchScrolling(0, 0);
}
return result;
}
Expand Down Expand Up @@ -1212,6 +1217,7 @@ public void run() {
}
ReactScrollViewHelper.notifyUserDrivenScrollEnded_internal(
ReactHorizontalScrollView.this);
disableFpsListener();
} else {
if (mPagingEnabled && !mSnappingToPage) {
// If we have pagingEnabled and we have not snapped to the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a0490be2c6f7eb42376e8e64abf9ce5e>>
* @generated SignedSource<<41d03f4948562c0fae870a660e6e1eac>>
*/

/**
Expand Down Expand Up @@ -700,6 +700,7 @@ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vScroll != 0) {
// Perform the scroll
enableFpsListener();
boolean result = super.dispatchGenericMotionEvent(ev);
// Schedule snap alignment to run after scrolling stops
if (result
Expand All @@ -710,6 +711,7 @@ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
// Cancel any pending post-touch runnable and reschedule
if (mPostTouchRunnable != null) {
removeCallbacks(mPostTouchRunnable);
mPostTouchRunnable = null;
}
mPostTouchRunnable =
new Runnable() {
Expand All @@ -723,9 +725,12 @@ public void run() {
velocityY = 0;
}
flingAndSnap(velocityY);
handlePostTouchScrolling(0, velocityY);
}
};
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
} else {
handlePostTouchScrolling(0, 0);
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vScroll != 0) {
// Perform the scroll
enableFpsListener();
boolean result = super.dispatchGenericMotionEvent(ev);
// Schedule snap alignment to run after scrolling stops
if (result
Expand All @@ -702,6 +703,7 @@ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
// Cancel any pending post-touch runnable and reschedule
if (mPostTouchRunnable != null) {
removeCallbacks(mPostTouchRunnable);
mPostTouchRunnable = null;
}
mPostTouchRunnable =
new Runnable() {
Expand All @@ -715,9 +717,12 @@ public void run() {
velocityY = 0;
}
flingAndSnap(velocityY);
handlePostTouchScrolling(0, velocityY);
}
};
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
} else {
handlePostTouchScrolling(0, 0);
}
return result;
}
Expand Down
Loading