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...

Комментарии • 9

  • @wadewalker25
    @wadewalker25 3 года назад +2

    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!

  • @weichen3994
    @weichen3994 3 года назад

    Great solution for list items with dynamic sizes! It works for my situation. Thanks!

  • @edsonmagombe4293
    @edsonmagombe4293 2 года назад

    Ahhhh bro! You saved my day

  • @patlagoon
    @patlagoon 3 года назад

    such a useful video, thanks a lot

  • @umeshbhagwat8787
    @umeshbhagwat8787 2 года назад

    Sir plz make full playlist of react native Tutorial and plz try to make it in React native with Redux-Toolkit

  • @LucasFeijo
    @LucasFeijo 3 года назад

    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.

  • @immohanraj
    @immohanraj 3 года назад

    thank you

  • @madhurijadhav315
    @madhurijadhav315 4 года назад

    This was really helpful in case of Flatlist. Can you please also post for Section list scrollToLocation scenario in case of dynamic height?

    • @syntaxbyte
      @syntaxbyte  4 года назад

      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).