Colton Idle
05/24/2022, 8:03 AMvar list = mutableStateListOf<Location>()
but my map never updates until I reload that page.
I believe I'm doing everything correclty, because if I comment out my MapView code and replace it with a Column + forEach then all of my items show when the network call completes. Is there some sort of thing you need to hook into with AndroidView + mapView to have it respond to mutableState?Adam Powell
05/24/2022, 1:07 PMColton Idle
05/24/2022, 1:23 PMyschimke
05/24/2022, 3:00 PMColton Idle
05/25/2022, 1:35 AMyschimke
05/25/2022, 8:02 AMAndroidView(
modifier = Modifier.fillMaxSize(), // Occupy the max size in the Compose UI tree
factory = { context ->
// Creates custom view
CustomView(context).apply {
// Sets up listeners for View -> Compose communication
myView.setOnClickListener {
selectedItem.value = 1
}
}
},
update = { view ->
// View's been inflated or state read in this block has been updated
// Add logic here if necessary
// As selectedItem is read here, AndroidView will recompose
// whenever the state changes
// Example of Compose -> View communication
view.coordinator.selectedItem = selectedItem.value
}