【发布时间】:2018-04-20 08:15:55
【问题描述】:
我正在使用带有 Firebase 的 React Native,并且我正在尝试在我的 Listview 上使用无限滚动(加载更多),如果第一次获取可以填充整个屏幕高度的列表,那么一切正常,因为 onEndReached 是但是当元素很少并且屏幕上根本没有填充列表视图时,不会触发 onEndReached ,因此它不会下载并填充下一条记录。任何人都可以帮我处理这种情况吗? 提前致谢。
return (
<View style={{flex:1}}>
<ListView
dataSource={this.state.userDataSource}
renderRow={this.renderRow.bind(this)}
style={{paddingTop: 10, paddingBottom: 10}}
enableEmptySections={true}
renderFooter={this.renderFooter.bind(this)}
onEndReached={this.infScrollFetch.bind(this)}
onEndReachedThreshold={0.1}
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this._onRefresh.bind(this)}
title="Pull to refresh" tintColor="#fff" titleColor="#fff" colors={["#FEC200"]}
/>
}
/>
</View>
);
第一次 fetch 是在 componentDidMount() 上调用的
【问题讨论】:
标签: javascript firebase react-native infinite-scroll