GoogleMap Composable breaks layout in Preview
See original GitHub issueA previous issue #128 and pull request #179 fix the Compose preview breaking when using a GoogleMap
composable.
But the layout in the preview is still incorrect as any of the modifiers passed to the GoogleMap
are discarded with the early return.
For example:
Column(Modifier.fillMaxSize()) {
GoogleMap(Modifier.weight(1f))
SomeExampleContent()
}
A possible fix could be instead of a bare return when in preview, GoogleMap
could return a Box
that keeps the modifiers.
// When in preview, early return a Box with the received modifier preserving layout
if (LocalInspectionMode.current) {
return Box(modifier = modifier)
}
I have a commit (7e103f584cf44bda8ceff47706e2578d811d943d) ready to go, but the pull request said to make an issue first.
Thanks
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Google Maps is Tricky with Jetpack Compose (VLOG) - YouTube
The best android courses on the planet: https://codingwithmitch.com/ Google maps + Jetpack Compose was a little trickier than I thought it ...
Read more >Events | Maps SDK for Android - Google Developers
Using the Maps SDK for Android, you can listen to events on the map. Code samples. The ApiDemos repository on GitHub includes samples...
Read more >Empty Composable does not render in the Studio preview ...
When updating to alpha04, we detected than rendering an empty preview breaks. ... Andrey suggested that this is possibly caused by measuring with ......
Read more >12L and new Android APIs and tools for large screens
We've been careful not to introduce any breaking changes for your apps, ... Later in the preview we plan to open up Android...
Read more >Android Studio Preview map from google maps API won't ...
Can you post your fragment and layout code? · It's unclear from your question...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@claytongreen that’s how I would fix it, too. Feel free to open a pull request with that fix.
🎉 This issue has been resolved in version 2.7.3 🎉
The release is available on:
v2.7.3
Your semantic-release bot 📦🚀