GetStream/react-native-bidirectional-infinite-scroll

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

sourabhkheterpal opened this issue · 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 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 Same problem on Android 😕

@vishalnarkhede I have tested it on Android Only.

@joesermon @sourabhkheterpal could you please try upgrading to @stream-io/flat-list-mvcp@0.10.0-beta.1? I have fixed the native implementation of that module. Please let me know if you are still able to see the issue!!