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 https://github.com/facebook/react-native/pull/15761

Differential Revision: D5760820

Pulled By: sahrens

fbshipit-source-id: 562b5f606bdc5452ca3d85efb5e0e3e7db224891
This commit is contained in:
Janic Duplessis 2017-09-01 17:57:59 -07:00 коммит произвёл Facebook Github Bot
Родитель 5b79ee6808
Коммит e964a7f4ef
1 изменённых файлов: 0 добавлений и 7 удалений

Просмотреть файл

@ -27,8 +27,6 @@ public class OnScrollDispatchHelper {
private long mLastScrollEventTimeMs = -(MIN_EVENT_SEPARATION_MS + 1);
private static final float THRESHOLD = 0.1f; // Threshold for end fling
/**
* Call from a ScrollView in onScrollChanged, returns true if this onScrollChanged is legit (not a
* duplicate) and should be dispatched.
@ -40,11 +38,6 @@ public class OnScrollDispatchHelper {
mPrevX != x ||
mPrevY != y;
// Skip the first calculation in each scroll
if (Math.abs(mXFlingVelocity) < THRESHOLD && Math.abs(mYFlingVelocity) < THRESHOLD) {
shouldDispatch = false;
}
if (eventTime - mLastScrollEventTimeMs != 0) {
mXFlingVelocity = (float) (x - mPrevX) / (eventTime - mLastScrollEventTimeMs);
mYFlingVelocity = (float) (y - mPrevY) / (eventTime - mLastScrollEventTimeMs);