Hey guys, I've been trying to get the BottomSheetM...
# compose
a
Hey guys, I've been trying to get the BottomSheetModal from Compose Material 3 to behave properly with window insets but no luck so far, I started by following the docs and adding the following to my activity onCreate:
Copy code
WindowCompat.setDecorFitsSystemWindows(window, false)
and this to the activity in the manifest:
Copy code
android:windowSoftInputMode="adjustResize"
and adding
Modifier.safeDrawingPadding()
to my layout, this ended up with the bottom nav bar height being cropped from the actual screen (first image), my assumption is it's because
setDecorFitsSystemWindows
only allowed drawing behind the status bar but not the nav bar. So I tried removing the nav bar insets cause I can probably handle those even if as not as gracefully as promised by the WindowInsets api, so I replaced `safeDrawingPadding with:
Copy code
Modifier.consumeWindowInsets(WindowInsets.systemBars.only(WindowInsetsSides.Bottom))
.systemBarsPadding()
and everything was fine until I decided to add a textfield to my bottom sheet, so on my Android 8 device the bottom sheet doesn't care about the ime appearing at all and ends up living behind it (second image), and on my api 30 emulator i'm getting double insets when the ime is visible (third image) this's from a kmp project but the bottom sheet lives entirely in androidMain and uses the following dependencies
Copy code
api("androidx.compose.material3:material3:1.1.1")
api("androidx.compose.material3:material3-window-size-class:1.1.1")
am I doing something wrong here? if it's a bug any workarounds? thank you!
better quality 3rd and 2nd image
i
Note that it was Compose Material3 1.2.0-alpha02 that added insets support to
ModalBottomSheet
, so you'll want to upgrade first and ensure that you're using those APIs: https://developer.android.com/jetpack/androidx/releases/compose-material3#1.2.0-alpha02
a
@Ian Lake Thank you for the response, just tried 1.2.0-alpha02 and 1.2.0-alpha05, the bottom nav bar padding issue is fixed there, but the ime padding issue stays exactly the same
i
If you have a sample project that reproduces your issue, it would be great if you could file an issue with it so that the team that works on it can take a look and fix it: https://issuetracker.google.com/issues/new?component=742043&template=1590761
a
@Ian Lake ook, will work on that, thank you!
b
a
@Benjamin Mohr Yes, those have the same exact issue I'm facing, just voted, thank you!