GetStream / react-native-bidirectional-infinite-scroll

📜 React Native - Bidirectional Infinite Smooth Scroll
https://getstream.github.io/react-native-bidirectional-infinite-scroll/
MIT License
236 stars 27 forks source link

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

Open sourabhkheterpal opened 3 years ago

sourabhkheterpal commented 3 years ago

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!

vishalnarkhede commented 3 years ago

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

joesermon commented 3 years ago

@vishalnarkhede Same problem on Android 😕

sourabhkheterpal commented 3 years ago

@vishalnarkhede I have tested it on Android Only.

vishalnarkhede commented 3 years ago

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