I am using a simple function to scroll to index in section list in react native;
let sectionIndex = route.params.index;
sectionListRef?.current?.scrollToLocation({
sectionIndex,
itemIndex: 0,
});
where sectionIndex in coming from route params. Though I though that may be causing the problem, but i created a button to scroll to a particular index and even gave a number as the index instead of using the one coming from route params. But it doesn't work, it is just ignoring the sectionIndex and always scrolling to top (if not at the top).
There is no more relevant code but anyways, here is my sectionList:
<SectionList
ref={sectionListRef}
refreshing={isFetching}
onRefresh={refetch}
sections={boards ?? []}
renderItem={renderItem}
ListEmptyComponent={
!isFetching ? <NoBoards screenname="board" /> : null
}
ListFooterComponent={<VStack padding="5" />}
renderSectionHeader={Sectionheader}
stickySectionHeadersEnabled
/>