Hey Composers! I have an issue with Maps and navi...
# compose
a
Hey Composers! I have an issue with Maps and navigation in Compose. Suppose I have a MapScreen that shows a Compose Google Map, and a button that opens a MapInfoScreen. When I navigate back to map, the state (map zoom and position) is restored as expected, but the map tiles load from scracth, and this looks not ideal. See the attached video in the thread. In my sample I use Jetpack Navigation, but the issue persists with Decompose and other Map implementation as well. I understand why this is so from the technical point - the MapView is destroyed when the MapScreen leaves composition, and is created from scratch when I navigate back. But it's hard to say that this is good UX - for example, if both screens were Activites, there would be no such problem, as both Views wouldn't be destroyed. Any ideas on how to make the map not reload its tiles and look nice?
google map compose sample.mp4
l
Why not make the detail screen a fullscreen dialog? It's kind of a hack but should prevent recomposition
a
@Lukas Anda It's a simplified example. In my real app the map screen is a root of all navigation, and all other screens open from the map screen.
l
Still you can "hack" it to use dialogs haha
Hm but does it reload the tiles even if you do "rememberMovableContentOf" ?
a
I didn't try
rememberMovableContentOf
, will check it out, thanks.