React Native FlatList scrollToIndex with Fixed or Variable Row Size
HTML-код
- Опубликовано: 9 фев 2025
- In this video, I show you how to use the scrollToIndex function to scroll to a row with a certain index in a ReactNative FlatList. First I show how to implement getItemLayout to get the function working on a list with items of a fixed size, and then how to use onScrollToIndexFailed to get scrollToIndex working on a list where the list items are of a variable dynamic size.
Source code: syntaxbytetuto...
Dude, that was a great tutorial and explanation of how to scroll flatlists! Just now what I'm trying to figure out and here u are to save my day! Thank you sir!
Great solution for list items with dynamic sizes! It works for my situation. Thanks!
Ahhhh bro! You saved my day
such a useful video, thanks a lot
Sir plz make full playlist of react native Tutorial and plz try to make it in React native with Redux-Toolkit
You just didn't cover the scenario where you implement getItemLayout while having rows with dynamic height. Nice trick with the scroll error callback though.
thank you
This was really helpful in case of Flatlist. Can you please also post for Section list scrollToLocation scenario in case of dynamic height?
Looks like you could implement the same way using onScrollToIndexFailed, but use scrollToLocation rather than scrollToIndex for the initial call (you should still be able to use scrollToIndex if you would prefer as SectionList still extends from VirtualizedList, but scrollToLocation is probably easier to use).