首页 > 解决方案 > react native onEndReached中的Recyclerlistview不断触发

问题描述

在滚动一次时,只要列表中有新数据,onEndReached 就会一直触发。这是我的代码

<RecyclerListView
        style={AppStyle.flexOne}
        onEndReached={this.onScrollTillEnd}
        onEndReachedThreshold={Globals.LIST_SCROLL_THRESHOLD}
        layoutProvider={this.layoutProvider}
        dataProvider={this.state.dataProvider}
        rowRenderer={this.rowRenderer}
        scrollViewProps={{
          refreshControl: (
            <RefreshControl
              refreshing={initialFetch}
              onRefresh={this.onRefresh}
            />
          )
        }}
      />

这是 onEndReached 触发的函数

onScrollTillEnd = async () => {
  await this.fetchVisitorList();
}

而 onEndReachThreshold 为 0.1 并尝试更改值但没有效果。请帮忙

标签: javascriptreact-nativecross-platformrecyclerlistview

解决方案


推荐阅读