React Native - Flatlist - onEndReached not called and Infinite Scroll

时间:2017-10-17 14:09:34

标签: react-native react-native-flatlist

我在平面列表上实现无限滚动时遇到了一些麻烦。

我的平面列表有三列," onEndReached"在加载平面列表时,只会调用两次props,但在滚动到结尾时再也不会再调用。 我注意到,如果我只有一列,它可以正常工作。 有没有错误或我错过了什么?

我读了这个视频教程:https://www.youtube.com/watch?time_continue=99&v=rY0braBBlgw 唯一的区别是我不使用fetch而是axios,我有3列。

我还尝试使用Scrollview而不是Flatlist,以及this.props.myStore.getMyData().then((response) => { // getMyData is an axios request this.props.myStore.data = [...this.props.myStore.data.peek(), ...response.data]; this.props.myStore.offset = this.props.myStore.data.length; this.setState({loading: false}) }).catch(() => { this.setState({loading: false}) this.props.myStore.data = null; }); 和道具,它工作正常,但是平面列表中的图像是"闪烁"何时将新项目添加到平面列表数据中。 以下是我正在做的示例代码:

this.props.myStore.data

Flatlist数据为<input>

感谢。

0 个答案:

没有答案
相关问题