react-native-bidirectional-infinite-scroll icon indicating copy to clipboard operation
react-native-bidirectional-infinite-scroll copied to clipboard

OnStartReached method is triggered frequently

Open zhangwen9229 opened this issue 3 years ago • 7 comments

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 avatar Jun 24 '21 13:06 zhangwen9229

@zhangwen9229 Did you solve this issue? Same here

dolphinflow86 avatar Aug 17 '21 05:08 dolphinflow86

@zhangwen9229 Did you solve this issue?

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

zhangwen9229 avatar Aug 17 '21 06:08 zhangwen9229

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

dolphinflow86 avatar Aug 17 '21 08:08 dolphinflow86

@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 avatar Aug 17 '21 08:08 zhangwen9229

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

zhangwen9229 avatar Aug 17 '21 08:08 zhangwen9229

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

SiSa68 avatar Sep 30 '21 11:09 SiSa68

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.

preukschat avatar May 13 '22 14:05 preukschat