Skip to content

Commit

Permalink
Fix GoogleMap in preview early return breaking preview layout
Browse files Browse the repository at this point in the history
  • Loading branch information
claytongreen committed Oct 18, 2022
1 parent 623bb11 commit 7e103f5
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -18,6 +18,7 @@ import android.content.ComponentCallbacks
import android.content.res.Configuration
import android.location.Location
import android.os.Bundle
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composition
Expand Down Expand Up @@ -87,9 +88,9 @@ public fun GoogleMap(
contentPadding: PaddingValues = NoPadding,
content: (@Composable @GoogleMapComposable () -> Unit)? = null,
) {
// Early return if in preview
// When in preview, early return a Box with the received modifier preserving layout
if (LocalInspectionMode.current) {
return
return Box(modifier = modifier)
}

val context = LocalContext.current
Expand Down

0 comments on commit 7e103f5

Please sign in to comment.