https://kotlinlang.org logo
#compose
Title
# compose
s

Satyam G

04/28/2022, 8:51 AM
f

Filip Wiesner

04/28/2022, 9:20 AM
From the way you wrote your SO question and from the comment by Ian I think you already know "How to display the ModalBottomSheetLayout in such a way it will hide the BottomBar" Comment from Ian:
"I don't want to add ModalBottomSheet to Activity instead I have added ModalBottomSheet inside 3rd Screen Composable." - it sounds like you know exactly what your problem is. Your 3rd screen composable doesn't go over the bottom bar, so nothing within that is going to ever go over the bottom bar.
You have to structure your screen like this:
Copy code
BottomSheetLayout {
  Screen()
  BottomNavBar()   
}
I agree that it's not ideal but that's how bottom sheets work in Compose. You could also try out Bottom Sheet Destinations from Accompanist if your bottom nav bar is inside your navigation routes.
s

Satyam G

04/28/2022, 9:22 AM
Cool, Thanks 😊
c

Colton Idle

04/28/2022, 12:52 PM
I think I submitted a bug report for this or something and could have sworn that it's being considered for the bottom sheet rewrite. i.e. You can declare a modal dialog in a screen and that modal dialog will cover the bottom bar. but a modal bottom sheet does not. That just seems like a bug because the word modal now has two different meanings. but yes. as of right now, there is not much you can do.
t

tad

04/29/2022, 2:16 AM
I wrote a
BottomSheetHost
composable, similar to how Snackbar works, which decouples where the bottom sheet is "shown" from where it lives in the composition.
s

Satyam G

04/29/2022, 4:03 AM
Can you share the github link or anything I can refer ??
c

Colton Idle

04/29/2022, 3:38 PM
@tad ooooh. Please share if possible. hahaha. that sounds amazing.
basically throw
BottomSheetHost { myAppContent() }
at the top level, then wherever you want a BottomSheet, call
BottomSheet()
in the composition
Ah, there's some extra stuff in there you won't need from another implementation I did. Scrim, isn't needed, for instance, as ModalBottomSheetLayout handles that already.
c

Colton Idle

05/03/2022, 1:05 AM
way cool. cheers
368 Views