jjzjj

javascript - react native ListView onEndReached 多次调用

coder 2025-02-27 原文

我在使用 React Native 中的 ListView onEndReached 组件时遇到了一些问题。

渲染代码:

@autobind
  _fetchMoreHistory(){

    console.log("Fetch more history called");

  }

<View style={[styles.Ctr]}>
   <ListView dataSource={this.state.txHistorySource}
         renderRow={ this._renderRow }
         onEndReached ={ this._fetchMoreHistory }
         onEndReachedThreshold  = {10}/>
</View>

我打开屏幕的那一刻 _fetchMoreHistory 被调用了两次并且在到达 onEndReached 之后正常工作。有人可以帮助调试吗?

最佳答案

我遇到了同样的问题并进行了很多搜索但没有找到任何答案,所以我使用了一个条件来检查第一个请求是否得到了我再次触发的数据,否则我没有

例子 //onEndReached 如果(条件){ 调用电话

关于javascript - react native ListView onEndReached 多次调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41297034/

有关javascript - react native ListView onEndReached 多次调用的更多相关文章

随机推荐