Guilherme Almeida
08/02/2023, 4:57 PMGuilherme Almeida
08/02/2023, 4:57 PMSubcomposeLayout
for it as it allows me to measure how many rows and columns fit into the current view port and then subcompose
them. At the moment I am just trying to scroll vertically, so I am measuring how many rows fit into the received constraints and what is the first row I am seeing when scrolling. These two values then allow me to determine the items I need to show on screen, which for me is a IntRange
(wrapped in a State
) with Int being indexes that I need to render.
My issue is the scroll freezes for a moment when a new row is composed. I understand that when this IntRange
changes (as soon as I scroll up or down and a new row needs to be shown) I trigger the measure phase again (where I am calling subcompose
), so I suspect I am doing something there that is overloading what was supposed to be lazy on my end.
Any dos or don’ts regarding using SubcomposeLayout
? Any obvious mistakes I should avoid? I also considered using LazyLayout
but for my case I found it weird to represent this data as a List, considering the views should be generated as I scroll (possibly for a very long time), the data for them solely relies on scroll position.Kirill Grouchnikov
08/02/2023, 5:01 PMGuilherme Almeida
08/02/2023, 5:19 PMMinaBox
, also by the same author!
But before adopting it I would really like to understand what I am doing wrong in my approach, so I can evaluate if it is worth it to add and learn this new library 😅