I am trying to make a breadcrumb for folder traversal. I built a breadcrumb component by horizontal flatlist, and I was using scrollToEnd() method to scroll to end when new item added into the list. I achieved until this by the following code:
<FlatList
keyExtractor={(item, index) => item + '' + index}
contentContainerStyle={{
backgroundColor
}}
style={{}}
bounces={false}
data={list.slice()}
horizontal={true}
onContentSizeChange={() => {
(listRef.current as any).scrollToEnd({ animated: true });
}}
showsHorizontalScrollIndicator={false}
renderItem={renderBreadCrumb}
ItemSeparatorComponent={renderItemSeparator}
ref={listRef}
/>
But I got stuck into another problem. When I am clicking the breadcrumb item decreasingly, it moves the list towards the right of the view. It occurs in Android only, iOS works fine.
I tried, scrollToOffset() for making the list in the correct position. but it doesn't work.