android-maps-compose
android-maps-compose copied to clipboard
GoogleMap Compose view is drawn outside of clipping area
It seems the GoogleMap composable view doesn't fully respect the parent nor its own clip area (unless there is a background).
Version: 2.5.0 of com.google.maps.android:maps-compose Android 12
Steps to reproduce
- Put a GoogleMap inside a Card or Dialog with rounded corners where the map fills out to each side. The map will be drawn outside of the rounded corners where there is no background layer, no matter if you put Modifier.clip on the map itself or the parent Composable.
Code example
Card(modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(24.dp))) {
GoogleMap(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(24.dp)),
uiSettings = MapUiSettings(),
properties = MapProperties(),
cameraPositionState = CameraPositionState(),
contentPadding = PaddingValues(20.dp),
)
}
Here is an example from a Dialog with the same corner radius. Clipping can be seen as working at the bottom of the map, but on the top the map, content is drawn outside of the dialog. I put in some padding on the top of the map to show that there is some kind of clipping but it's still spilling out behind the dialog