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

Not Maintaining Viewable Position of Item when getItemLayout Props passed in FlatList

Open sourabhkheterpal opened this issue 3 years ago • 4 comments

Code: Lib Version: 0.3.2 React Native: 0.61.5

import { FlatList } from "react-native-bidirectional-infinite-scroll";

<FlatList
       ref={(ref) => { flatListRef = ref }}
       getItemLayout={getItemLayout}
       style={styles.sectionList}
       data={formattedList}
       keyExtractor={(item, index) => item.id}
       renderItem={({ item, index }) => renderDateWise(item, index)}
       showsVerticalScrollIndicator={false}
       onMomentumScrollBegin={() => {
         onEndReachedCalledDuringMomentum = false;
       }}
       onEndReached={onListEndReached}
       onStartReached={onListTopReached}
       activityIndicatorColor={colors.themeColor} // optional
     />

when we scroll down or up -> new data comes from API -> list moved to the top of the content not maintaining viewable content position.

Works fine when we don't pass getItemLayout Props in FlatList.

Thanks in advance!

sourabhkheterpal avatar Mar 23 '21 07:03 sourabhkheterpal

@sourabhkheterpal thanks for bringing this up. Let me take a look and get back soonish. Are you seeing this issue only on android or iOS as well?

vishalnarkhede avatar Mar 23 '21 14:03 vishalnarkhede

@vishalnarkhede Same problem on Android 😕

joesermon avatar Mar 24 '21 10:03 joesermon

@vishalnarkhede I have tested it on Android Only.

sourabhkheterpal avatar Mar 24 '21 10:03 sourabhkheterpal

@joesermon @sourabhkheterpal could you please try upgrading to @stream-io/[email protected]? I have fixed the native implementation of that module. Please let me know if you are still able to see the issue!!

vishalnarkhede avatar Apr 04 '21 08:04 vishalnarkhede