@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mOnScrollDispatchHelper.onScrollChanged(l, t)) {
getReactContext().getNativeModule(UIManagerModule.class).getEventDispatcher()
.dispatchEvent(ScrollEvent.obtain(
getId(),
ScrollEventType.SCROLL,
0, /* offsetX = 0, horizontal scrolling only */
computeVerticalScrollOffset(),
mOnScrollDispatchHelper.getXFlingVelocity(),
mOnScrollDispatchHelper.getYFlingVelocity(),
getWidth(),
computeVerticalScrollRange(),
getWidth(),
getHeight()));
}
final int firstIndex = ((LinearLayoutManager) getLayoutManager()).findFirstVisibleItemPosition();
final int lastIndex = ((LinearLayoutManager) getLayoutManager()).findLastVisibleItemPosition();
if (firstIndex != mFirstVisibleIndex || lastIndex != mLastVisibleIndex) {
getReactContext().getNativeModule(UIManagerModule.class).getEventDispatcher()
.dispatchEvent(new VisibleItemsChangeEvent(
getId(),
SystemClock.nanoTime(),
firstIndex,
lastIndex));
mFirstVisibleIndex = firstIndex;
mLastVisibleIndex = lastIndex;
}
}
RecyclerViewBackedScrollView.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:react-native-recyclerview-list
作者:
评论列表
文章目录