googlemaps / googlemaps/android-maps-compose
Polyline doesn't recompose when points change
- Dominant language
- Kotlin
- Stars
- 1.3k
- Forks
- 181
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
#### Environment details
Android API 26
com.google.maps.android:maps-compose:2.1.0
#### Steps to reproduce
1. Create a map with a MutableStateList of points
2. Use the points to draw markers and a polyline between them
3. Add functionality to add or remove points from the list
4. Observe that the markers update, but the polyline does not
#### Code example
```
@Composable
fun MapScreen(){
val waypoints = remember{ mutableStateListOf()}
Map(waypoints) {
waypoints.add(it)
}
}
@Composable
private fun Map(
waypoints: List,
modifier: Modifier = Modifier,
onMapClicked: (latlng: LatLng) -> Unit
){
GoogleMap(
modifier = modifier,
onMapClick = onMapClicked,
){
waypoints.forEach {
Marker(state = MarkerState(position = it))
}
Polyline(waypoints)
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.