System padding on Huawei devices when used Jetpack Compose

338 Views Asked by At

After refactoring old solution my QA found problem with bottom navigation and modalbottomsheetdialog below him on Huawei devices also the dialog is shifted down, i dont know how fix this, because on Pixel 7, Samsung A13, emulator - all perfect, but on huawei i get this result. Current settings for paddings:

Scaffold(
...
     },
        contentWindowInsets = WindowInsets(0,0,0,0)
    ) { localPadding ->
        NavHost(
            modifier = Modifier
                .padding(paddingValues = localPadding)
                .consumeWindowInsets(paddingValues = localPadding)
                .windowInsetsPadding(
                    WindowInsets.safeDrawing.only(
                        WindowInsetsSides.Horizontal,
                    ),
                )
                .systemBarsPadding(),
            navController = navController,
            startDestination = startDestination
        ) {
...

huawei device Samsung A13

Top dialog on huawei Top dialog on A13

Somebody knowns what's main problem of this behavior, or had similar problem. How you fix this in your app?

Update from 1 December, 2023:

On current time i'm use Compose BOM: 2023.10.01 and for currect usage bottomSheet, i should do this:

ModalBottomSheet(
   modifier = Modifier.fillMaxHeight(),
   sheetState = sheetState,
   onDismissRequest = { },
   windowInsets = WindowInsets.ime
       .union(WindowInsets.statusBars)
       .union(WindowInsets.navigationBars)
) { 
  // content here
}
0

There are 0 best solutions below