Skip to content

Commit e964a7f

Browse files
janicduplessisfacebook-github-bot
authored andcommitted
Fix scroll events getting skipped on Android
Summary: This code related to velocity would cause some scroll events to be skipped and caused some jitter for sticky headers. Not sure if there is a better fix but removing this does fix missing events and the velocity calculation still seems to be working. **Test plan** Tested that sticky headers now work properly on Android, tested that velocity calculation still seem to work. Closes #15761 Differential Revision: D5760820 Pulled By: sahrens fbshipit-source-id: 562b5f606bdc5452ca3d85efb5e0e3e7db224891
1 parent 5b79ee6 commit e964a7f

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java

-7
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public class OnScrollDispatchHelper {
2727

2828
private long mLastScrollEventTimeMs = -(MIN_EVENT_SEPARATION_MS + 1);
2929

30-
private static final float THRESHOLD = 0.1f; // Threshold for end fling
31-
3230
/**
3331
* Call from a ScrollView in onScrollChanged, returns true if this onScrollChanged is legit (not a
3432
* duplicate) and should be dispatched.
@@ -40,11 +38,6 @@ public boolean onScrollChanged(int x, int y) {
4038
mPrevX != x ||
4139
mPrevY != y;
4240

43-
// Skip the first calculation in each scroll
44-
if (Math.abs(mXFlingVelocity) < THRESHOLD && Math.abs(mYFlingVelocity) < THRESHOLD) {
45-
shouldDispatch = false;
46-
}
47-
4841
if (eventTime - mLastScrollEventTimeMs != 0) {
4942
mXFlingVelocity = (float) (x - mPrevX) / (eventTime - mLastScrollEventTimeMs);
5043
mYFlingVelocity = (float) (y - mPrevY) / (eventTime - mLastScrollEventTimeMs);

0 commit comments

Comments
 (0)