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

Jason Ankers

02/16/2021, 3:27 AM
How would I use
BottomSheetScaffold
with the navigation component? My app consists of a typical bottom-tab layout which is using
Scaffold bottomBar = { .. }
like in the docs, but I want to launch bottom sheets from inside my tabs. The sheets should overlay on top of the bottom tabs and I would like to be able to call
navController.navigate(..)
to open them. Anyone know of any example apps which have achieved this?
i

Ian Lake

02/16/2021, 3:51 AM
There's nothing built in that would allow you to do that. In theory it would be possible to build a custom Navigator and add that to the
NavController
, but I don't think there's any good examples of that
I suspect integration with a
BottomSheetScaffold
would be similar in scope, but perhaps very little overlap
I'd definitely be supportive of filing a separate issue for it though
j

Jason Ankers

02/16/2021, 3:57 AM
Cool, thanks! I’ll file an issue for it
@Ian Lake I attempted to create a custom
BottomSheetNavigator
today, and got about 90% of the way there. I’m stuck on getting content from two destinations to render at the same time (so you can partially swipe the bottom sheet and peek the content behind it). I need to prevent the NavHost from removing the previous screens content when a bottom sheet is launched. Do you have any tips on how this might be achievable?
i

Ian Lake

03/02/2021, 5:32 AM
I don't
NavHost
as it is written now takes into account destinations that implement the
FloatingWindow
interface (which any overlay destination should do). That interface would be the one it should check against to know not to remove the previous screen
j

Jason Ankers

03/02/2021, 5:56 AM
Great thanks, I couldn’t implement a custom NavHost because
content
on regular compose destinations is internal. Any idea if theres plans for
NavHost
to support
FloatingWindow
in the near future?
i

Ian Lake

03/02/2021, 6:43 AM
j

Jason Ankers

04/09/2021, 3:39 PM
@Ian Lake Do you have a rough idea of how much work would be required to PR this? Is
FloatingWindow
support a substantial change
3 Views