react-native-bidirectional-infinite-scroll
react-native-bidirectional-infinite-scroll copied to clipboard
OnStartReached method is triggered frequently
https://user-images.githubusercontent.com/5137377/123269304-70f2b480-d531-11eb-97b7-e787c1fe0945.mov
React Native version: 0.59.9
<SafeAreaView style={{ flex: 1}}>
<FlatList
style={{ flex: 1 }}
data={this.state.data}
inverted
onEndReached={this.loadMoreOlderMessages}
onStartReached={this.loadMoreRecentMessages}
renderItem={this.renderItem}
</SafeAreaView>
loadMoreOlderMessages = async () => {
const newMessages = await queryMoreMessages(10);
const { data } = this.state;
this.setState({
data: [].concat(data).concat(newMessages)
});
};
loadMoreRecentMessages = async () => {
const newMessages = await queryMoreMessages(10);
const { data } = this.state;
this.setState({
data: [].concat(newMessages).concat(data)
});
};
renderItem = ({ item }) => {
if (item.isMyMessage) {
return (
<View
key={`${item.id}`}
style={[styles.messageBubble, styles.myMessageBubble]}
>
<Text style={styles.myMessageText}>{item.text}</Text>
</View>
);
}
return (
<View key={`${item.id}`} style={styles.messageBubble}>
<Text style={styles.messageText}>{item.text}</Text>
</View>
);
}
Is it the version 0.59.9 I am using? Who can help look at it? Thanks ~~~
@zhangwen9229 Did you solve this issue? Same here
@zhangwen9229 Did you solve this issue?
No, this question, I gave up. I think my rn version is lower.
@zhangwen9229 It also happens in 0.63.4, could you open this issue again? By the way, are you still using RN or changed to another(native, flutter or something else)? Because I cannot find the proper solution for this..
@zhangwen9229 It also happens in 0.63.4, could you open this issue again? By the way, are you still using RN or changed to another(native, flutter or something else)? Because I cannot find the proper solution for this..
Ok, but this question has been on for a long time
@zhangwen9229 It also happens in 0.63.4, could you open this issue again? By the way, are you still using RN or changed to another(native, flutter or something else)? Because I cannot find the proper solution for this..
I still use RN. Pull to load data, I think you can use loading, and add data directly.
Any update on this?! I have same problem..
i had this issue when my renderItem took a long time to render for the first time. i changed it to a much simpler component and load in more stuff after its rendered for the first time and now i do not get this issue anymore.
nevertheless, should be adressed in this library to not request more while the previously requested component still isn't mounted.