Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnStartReached method is triggered frequently #22

Open
zhangwen9229 opened this issue Jun 24, 2021 · 7 comments
Open

OnStartReached method is triggered frequently #22

zhangwen9229 opened this issue Jun 24, 2021 · 7 comments

Comments

@zhangwen9229
Copy link

2021-06-24.9.15.16.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 ~~~

@dolphinflow86
Copy link

dolphinflow86 commented Aug 17, 2021

@zhangwen9229 Did you solve this issue?
Same here

@zhangwen9229
Copy link
Author

@zhangwen9229 Did you solve this issue?

No, this question, I gave up. I think my rn version is lower.

@dolphinflow86
Copy link

dolphinflow86 commented Aug 17, 2021

@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
Copy link
Author

@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 zhangwen9229 reopened this Aug 17, 2021
@zhangwen9229
Copy link
Author

@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.

@SiSa68
Copy link

SiSa68 commented Sep 30, 2021

Any update on this?!
I have same problem..

@preukschat
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants