List of usage examples for com.facebook.react.views.scroll ReactScrollViewHelper emitScrollEndDragEvent
public static void emitScrollEndDragEvent(ViewGroup scrollView, float xVelocity, float yVelocity)
From source file:com.rnnestedscrollview.ReactNestedScrollView.java
License:MIT License
@Override public boolean onTouchEvent(MotionEvent ev) { if (!mScrollEnabled) { return false; }/* w w w . j a va 2 s. com*/ mVelocityHelper.calculateVelocity(ev); int action = ev.getAction() & MotionEvent.ACTION_MASK; if (action == MotionEvent.ACTION_UP && mDragging) { float velocityX = mVelocityHelper.getXVelocity(); float velocityY = mVelocityHelper.getYVelocity(); ReactScrollViewHelper.emitScrollEndDragEvent(this, velocityX, velocityY); mDragging = false; // After the touch finishes, we may need to do some scrolling afterwards either as a result // of a fling or because we need to page align the content handlePostTouchScrolling(Math.round(velocityX), Math.round(velocityY)); } return super.onTouchEvent(ev); }