If my `LazyRow` shows 5 items on screen, can I som...
# compose
k
If my
LazyRow
shows 5 items on screen, can I somehow render 5 items before and after too? Some items have overflow text that I'd like to be visible before item itself comes on screen?
s
Does the text go outside of the bounds of the item itself? Having a hard time visualizing what that means
k
Yea. So for example if I have rendered index 5-10 on screen, and index 4 is out of screen, index 4 might have overflow text that I still want to show cause it goes over rendered index 5 item.
s
Maybe you can go with a HorizontalPager instead, which lets you pass
beyondBoundsPageCount
which does exactly what you mean here? Otherwise, not sure if you can control this in a LazyRow 🤔 it does not expose the
beyondBoundsItemCount
parameter from
LazyList
itself. And I am not sure if there’s any other API which does.
k
Would this render all items or just the amount you've passed into HorizontalPager, and other items would lazily be rendered?
s
HorizontalPager also is a lazy row, and it exposes the parameter which lets you pick how many more (which are currently out of bounds) should be drawn even if they are not in the viewport. I feel like this is what you want here, but again, I gotta admit I am having a bit hard time understanding what your UI will look like afterwards, some screenshots would be nice to see here.
k
I don't wanna post companies designs here, but maybe you can imagine it to be a timeline where some work would be spanned across multiple days, and line needs to be shown.
Line can have more content like rounded corners, text etc.
s
Yeah not sure I follow 100%, sounds like then you’d have things painting over one another 🤷‍♂️ Try the pager thing if you’d like to see what I mean about rendering off-screen items
k
Thanks! 🙂
Pager doesn't scroll like a regular LazyRow, but goes page by page?
Nvm, I think I understand behavior of VerticalPager, it's not something I need. I need smooth scrolling, item by item and to be indefinite.