Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion resources/android/ModalRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -85,7 +86,10 @@ object ModalRenderer {
Column(modifier = Modifier.fillMaxSize()) {
if (dismissible) {
Row(
modifier = Modifier.fillMaxWidth().padding(8.dp),
modifier = Modifier
.fillMaxWidth()
.statusBarsPadding()
.padding(8.dp),
horizontalArrangement = Arrangement.End,
) {
IconButton(onClick = {
Expand Down
17 changes: 17 additions & 0 deletions tests/ModalRendererTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

test('applies the status bar inset before padding the Android modal close button', function () {
$rendererPath = dirname(__DIR__).'/resources/android/ModalRenderer.kt';

expect($rendererPath)->toBeFile();

$renderer = file_get_contents($rendererPath);
$closeButtonModifierPattern = '/if \(dismissible\) \{\s*Row\(\s*modifier = Modifier\s*'
.'\.fillMaxWidth\(\)\s*'
.'\.statusBarsPadding\(\)\s*'
.'\.padding\(8\.dp\),/s';

expect($renderer)
->toBeString()
->toMatch($closeButtonModifierPattern);
});