Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LazyColumn to not recompose some items

With RecyclerView, I can make some ViewHolder not recyclable (follow some answers in I want my RecyclerView to not recycle some items).
Can I make LazyColumn to not recompose some items (similar to make RecyclerView don't recycle some ViewHolder)? I have few items in LazyColumn with some big images, it recompose after scrolling down and up so scroll is not smooth.

like image 294
Linh Avatar asked Oct 20 '25 10:10

Linh


1 Answers

You can do this by using the PinnableContainer interface. LazyColumn implements this interface on its items.

 item {
    val handle = LocalPinnableContainer.current?.pin() //won't recompose offscreen
    handle.release() //when you are done
 }

PinnableContainer

like image 172
MobDev Avatar answered Oct 22 '25 00:10

MobDev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!