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

Michał Diner

06/17/2021, 2:26 PM
Hi everyone, did anyone came up with proper way of combining bottomSheet with bottomNavBar? My current scenario requires opening BottomSheet in several places with different content, so the solution has to be somewhat generic. Implementation I did looks like this:
Copy code
BottomSheet(navController) {
    BottomNavigationBar(
        navController,
        navHost)
}
Copy code
ModalBottomSheetLayout(
    sheetState = bottomSheetScaffoldState,
    sheetContent = {...}
    content = {
        bottomNavigationBar()
Unaccaptable alternatives: 1. BottomSheet opened up by navigation -> replaces current screen and is above the BottomNavBar 2. BottomSheet initialised on currently displayed screen -> shows up above the BottomNavBar. Any ideas how to improve this or is this it?
n

nitrog42

06/17/2021, 2:39 PM
so... If I understand correctly what you want, what I would suggest is just use a BottomSheetDialogFragment 😄
m

Michał Diner

06/17/2021, 2:41 PM
Thanks @nitrog42, but I'm only interested in Compose UI components.
☝️ 1
n

nitrog42

06/17/2021, 2:41 PM
you can still provide the content of the fragment through a ComposeView, but if you want your current screen to provide the content of the dialog (not defined by an enum passed to the dialog, and the enum define the content) well It won't work 😞
i

Ian Lake

06/17/2021, 3:21 PM
You might be interested to see the WIP integration between bottom sheets and NavController: https://github.com/androidx/androidx/pull/173
❤️ 4
2 Views