How would I use `BottomSheetScaffold` with the nav...
# compose
j
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
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
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
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
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
j
@Ian Lake Do you have a rough idea of how much work would be required to PR this? Is
FloatingWindow
support a substantial change