question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GoogleMap Composable breaks layout in Preview

See original GitHub issue

A 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()
}

result

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:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
arriolaccommented, Oct 19, 2022

@claytongreen that’s how I would fix it, too. Feel free to open a pull request with that fix.

0reactions
googlemaps-botcommented, Nov 21, 2022

🎉 This issue has been resolved in version 2.7.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found