上拉加载更多加载不出来
来源:9-13 上拉加载更多

Jack_WJQ
2021-03-30
一直是正在加载中
const mapStateToProps = ({home, loading}: RootState) => ({
carousels: home.carousels,
channels: home.channels,
hasMore: home.pagination.hasMore,
loading: loading.effects['home/fetchChannels'],
});
onEndReached = () => {
const {dispatch, loading, hasMore} = this.props;
console.log(loading, hasMore);
if (loading || !hasMore) {
return;
}
dispatch({
type: 'home/fetchChannels',
payload: {
loadMore: true,
},
});
};
get footer() {
const {hasMore, loading, channels} = this.props;
if (!hasMore) {
return (
<View style={styles.end}>
<Text>--我是有底线的--</Text>
</View>
);
}
if (loading && hasMore && channels.length > 0) {
return (
<View style={styles.loading}>
<Text>正在加载中...</Text>
</View>
);
}
}
get empty() {
const {loading} = this.props;
if (loading) {
return;
}
return (
<View style={styles.empty}>
<Text>暂无数据</Text>
</View>
);
}
loading一开始是false,但是上拉刷新后就一直为true了,拿到了数据也显示不出
写回答
1回答
-
今朝
2021-03-30
试试给FlatList添加属性
extraData={loading}
如果不行的话,在model里面看看请求是否已返回
012021-03-31
相似问题