With `m3.NavigationBar` Whats the right way to app...
# compose
x
With
m3.NavigationBar
Whats the right way to apply
windowInsetsPadding
to bottom
NavigationBar
? I'm doing this right now
Copy code
NavigationBar(
  modifier = Modifier
    .windowInsetsPadding(WindowInsets.navigationBars),
) {
  pages.forEach { page ->
    NavigationBarItem(..)
  } 
}
It looks all wrong 🤔
o
In our app we used a “trick” from Accompanist and wrap
NavigationBar
in the `Surface`:
Copy code
// Wrap with surface to "extend" navigation bar below the system navigation bar
Surface(
    color = NavigationBarDefaults.containerColor,
    tonalElevation = NavigationBarDefaults.Elevation,
    modifier = modifier,
) {
    NavigationBar(
        tonalElevation = 0.dp,
        modifier = Modifier.navigationBarsPadding(),
    ) {
        ...
    }
}
Also note, that tonal elevation is “moved” from
NavigationBar
to the
Surface
j
There's built in support for insets in material3 since 1.0.0-beta01, it should just work, no custom modifier or surface tricks required anymore https://developer.android.com/jetpack/androidx/releases/compose-material3#1.0.0-beta01
x
Nice - im using compose-multiplatform and will wait for the next stable release for compose 1.3 which i hope will bundle this change in
@Oleksandr Balan
NavigationBarDefaults
is internal right 🤔 is there way for us to extend these?
o
We have 1.3.0 version and
NavigationBarDefaults
is public there 🤷