@@ -158,14 +158,16 @@ public boolean onTouchEvent(MotionEvent ev) {
158
158
mVelocityHelper .calculateVelocity (ev );
159
159
int action = ev .getAction () & MotionEvent .ACTION_MASK ;
160
160
if (action == MotionEvent .ACTION_UP && mDragging ) {
161
+ float velocityX = mVelocityHelper .getXVelocity ();
162
+ float velocityY = mVelocityHelper .getYVelocity ();
161
163
ReactScrollViewHelper .emitScrollEndDragEvent (
162
164
this ,
163
- mVelocityHelper . getXVelocity () ,
164
- mVelocityHelper . getYVelocity () );
165
+ velocityX ,
166
+ velocityY );
165
167
mDragging = false ;
166
168
// After the touch finishes, we may need to do some scrolling afterwards either as a result
167
169
// of a fling or because we need to page align the content
168
- handlePostTouchScrolling ();
170
+ handlePostTouchScrolling (Math . round ( velocityX ), Math . round ( velocityY ) );
169
171
}
170
172
171
173
return super .onTouchEvent (ev );
@@ -178,7 +180,7 @@ public void fling(int velocityX) {
178
180
} else {
179
181
super .fling (velocityX );
180
182
}
181
- handlePostTouchScrolling ();
183
+ handlePostTouchScrolling (velocityX , 0 );
182
184
}
183
185
184
186
@ Override
@@ -270,7 +272,7 @@ public void draw(Canvas canvas) {
270
272
* runnable that checks if we scrolled in the last frame and if so assumes we are still scrolling.
271
273
*/
272
274
@ TargetApi (16 )
273
- private void handlePostTouchScrolling () {
275
+ private void handlePostTouchScrolling (int velocityX , int velocityY ) {
274
276
// If we aren't going to do anything (send events or snap to page), we can early out.
275
277
if (!mSendMomentumEvents && !mPagingEnabled && !isScrollPerfLoggingEnabled ()) {
276
278
return ;
@@ -283,7 +285,7 @@ private void handlePostTouchScrolling() {
283
285
}
284
286
285
287
if (mSendMomentumEvents ) {
286
- ReactScrollViewHelper .emitScrollMomentumBeginEvent (this );
288
+ ReactScrollViewHelper .emitScrollMomentumBeginEvent (this , velocityX , velocityY );
287
289
}
288
290
289
291
mActivelyScrolling = false ;
0 commit comments