Is there any correct (effective) way to use CustomView (with or without androidx.compose.ui.viewinterop.AndroidView) inside LazyColumn?

Viewed 327

What is the problem?

Now I am trying to use my custom android view inside LazyColumn. In my opinion, because of recreating my custom views every time I scrolling, picture is very laggy. So, is there any way to make it smoother, other than implementing view with Compose?

My code

   LazyColumn{
      items(events){ event ->
        EventItem(event, callBack)
      }
    }

  @Composable
  private fun EventItem(
    event: EventOverviewUiModel,
    callBack : (EventsAdapterEvent) -> Unit
  ){
    AndroidView(
      modifier = Modifier.fillMaxWidth(),
      factory = { context ->
        EventOverviewView(context)
      },
      update = { view ->
        view.bind(event)
      }
    )
  }
0 Answers
Related