0

I have a SectionList, when i try to append data on reaches the end list moves to the 1st data. I'm using react native 0.72.3.

the code is look like this.

  const [list, setList] = useState<ExpenseDetails[]>([]);
setList(old => {
   return [...old, ...data.getPaginatedExpenseList.details];
});
<SectionList
            style={styles.container}
            sections={list}
            keyExtractor={(item, index) => `${item.id}` + index}
            renderItem={({item, section}) => (
              <View
                style={styles.container}>
                <TimelineList
                  key={item.id}
                  data={item}
                  sectionData={section.data}
                  handleCardClick={handleCardClick}
                />
              </View>
            )}
            renderSectionHeader={({section: {title}}) => (
              <TimelineTitle title={title} key={title} />
            )}
            stickySectionHeadersEnabled
            ListFooterComponent={<Footer />}
            onEndReachedThreshold={0.1}
            onEndReached={loadMoreData}
          />

It shouldn't scroll to new position when I add new items to list, and should keep latest position. i tried to add maintainVisibleContentPosition but it is not worked.

0 Answers0