Skip to content

Commit 8a15a61

Browse files
authored
Merge pull request #1419 from android/av/fix-state-loss-with-workaround
Fix state loss with workaround
2 parents b0007bb + 488b97a commit 8a15a61

File tree

1 file changed

+8
-7
lines changed
  • app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui

1 file changed

+8
-7
lines changed

app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaApp.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,14 @@ internal fun NiaApp(
219219
}
220220

221221
Box(
222-
modifier = if (shouldShowTopAppBar) {
223-
Modifier.consumeWindowInsets(
224-
WindowInsets.safeDrawing.only(WindowInsetsSides.Top),
225-
)
226-
} else {
227-
Modifier
228-
},
222+
// Workaround for https://issuetracker.google.com/338478720
223+
modifier = Modifier.consumeWindowInsets(
224+
if (shouldShowTopAppBar) {
225+
WindowInsets.safeDrawing.only(WindowInsetsSides.Top)
226+
} else {
227+
WindowInsets(0, 0, 0, 0)
228+
},
229+
),
229230
) {
230231
NiaNavHost(
231232
appState = appState,

0 commit comments

Comments
 (0)