https://kotlinlang.org logo
a

Anton Shilov

10/04/2022, 8:29 AM
Hey, folks! I’m creating heavy AndroidViews (ads) inside
LazyVerticalGrid
and noticed that factory param in
AndroidView
Composable is called each time an item loses and obtains visibility. It’s not ideal, as creating and destroying heavy Views makes scroll not smooth due to janky frames. Is there any mechanism in Compose that would allow me recycle Views inside LazyVerticalGrid apart from creating a pool of Views and managing it myself?
z

Zach Klippenstein (he/him) [MOD]

10/05/2022, 5:15 PM
Which version of compose are you using?
Are the composables otherwise the same? With the same
contentType
? The lazy lists in general try to re-use as much as possible, but it seems possible we might need to do more work to reuse android views as well.
a

Anton Shilov

10/10/2022, 8:28 AM
I'm using Compose 1.2.1. Yep, composables with the android view are the same and using the same
contentType
z

Zach Klippenstein (he/him) [MOD]

10/11/2022, 6:25 PM
Could you file a bug for this? Might be something special required to reuse android views inside lazy lists
r

rishabhsinghbisht

11/14/2022, 5:35 PM
Did you found any solution for this? Facing the same problem.
4 Views