Tyler
Tyler

Reputation: 907

How to maintain position in scrollable view when elements load above the current position?

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?

Upvotes: 8

Views: 1585

Answers (1)

gentlee
gentlee

Reputation: 3717

It is hard to answer without any code example.

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

Upvotes: 4

Related Questions