-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using rememberCameraPositionState and observing it via a lambda, makes entire map recompose instead of just of the lambda #216
Comments
That behavior is expected—this is why you can't set a camera change listener on the |
I could find out that the culprit was another unstable parameter in my composable wrapper around GoogleMap |
@arriolac Thanks for your answer, but exposing |
I would have to see more of your implementation here like how is |
I finally removed the callback, and exposed a wrapper around the
where my
And then in my
The main idea is that any dependency related to maps or maps-compose should not be needed outside this current module (where the map resides) to keep the dependencies clean However I still feel, taking a |
I think I have the same issue. This is especially a problem with TileOverlay, as it gets needlessly recomposed (=tiles removed & added) every time as the parent composable (GoogleMap) recomposes. Is there any way to prevent that, while still being able to observe changes to camera's position, which is needed to load more markers? EDIT: Passing the TileOverlay as a parameter from the parent composable fixed my issue. At this point I don't really understand what's going on and why it works, but keeping the TileOverlay hierarchically "above" the component that manages map's state was the fix for me. |
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you! |
I am using the
rememberCameraPositionState
like so, and then exposing a callback from my custom google map wrapper to observe the stateHowever when I try to use this map, and trigger an operation from the viewModel, it recomposes infinitely
What am I doing wrong, or is it just a Google Map issue?
The text was updated successfully, but these errors were encountered: