You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using com.google.maps.android:maps-compose:5.0.3 with build.gradle.kts in Kotlin 2.0 and latest compiler and Compose.
I'm developing an app where I attached a marker to each object I'm giving as input to a Composable which calls GoogleMap composable.
I'm composing MarkerComposable in two ways:
All objects as input that the user hasn't selected
The object as input the user has selected
To complicate a bit things, I am keeping state regarding which object is the currently selected one in ViewModel.
When a user clicks on the marker in the Map in UI on the device (Android phone, for example), the currently selected object is updated to that marker.
I was updating state even if the Marker was currently the selected one. Removing this code and leaving code to update the currently selected object only in MarkerComposable that are not matching the currently selected seems to have solved the issue where duplicate MarkerComposable were created.
As this is a strange fix for me and one that doesn't really make sense, I've to ask: does GoogleMap call onClick on MarkerComposable during composition?
The text was updated successfully, but these errors were encountered:
Could you explain a bit further? and your fix? Because I think this might be an issue I am facing.
For me clicking on a marker correctly triggers and updates the state... its just the wrong markee gets the onclick. I am not sure if its a bug from my code or google maps compose
Hi,
I'm using
com.google.maps.android:maps-compose:5.0.3
withbuild.gradle.kts
in Kotlin 2.0 and latest compiler and Compose.I'm developing an app where I attached a marker to each object I'm giving as input to a Composable which calls GoogleMap composable.
I'm composing
MarkerComposable
in two ways:To complicate a bit things, I am keeping state regarding which object is the currently selected one in ViewModel.
When a user clicks on the marker in the Map in UI on the device (Android phone, for example), the currently selected object is updated to that marker.
I was updating state even if the Marker was currently the selected one. Removing this code and leaving code to update the currently selected object only in
MarkerComposable
that are not matching the currently selected seems to have solved the issue where duplicateMarkerComposable
were created.As this is a strange fix for me and one that doesn't really make sense, I've to ask: does GoogleMap call onClick on MarkerComposable during composition?
The text was updated successfully, but these errors were encountered: