8

I have a react-native SectionList that contains multiple FlatLists in the view. When a user touches one of the elements in the bottom FlatList, some of the FlatLists above will load new data causing the user's current view to seem be pushed up. In other words, the user's y-position remains the same but the content that was previously in view now has a greater y-position.

How can I keep the user's y-position in sync with the elements they had in view before the elements in the other FlatLists above were added?

Tyler
  • 827
  • 2
  • 11
  • 25

1 Answers1

3

It is hard to answer without any code example.

Seems scrollToLocation method with animated: false after data was changed should do the trick.

Alexander Danilov
  • 3,038
  • 1
  • 30
  • 35
  • Exactly facing the problem ([here](https://stackoverflow.com/questions/50330439/flatlist-keep-the-scrollview-content-position-at-same-place)). Couldn't able to find `scrollToLocation`. Please help me out. – Balasubramanian May 14 '18 at 12:58
  • @Balasubramanian for FlatList you should look at scrollToOffset method. https://facebook.github.io/react-native/docs/flatlist.html#scrolltooffset – Alexander Danilov May 15 '18 at 14:24