Thread
#compose
    Chris Fillmore

    Chris Fillmore

    1 year ago
    I have filed a bug with Accompanist re: navigation-materialhttps://github.com/google/accompanist/issues/617
    i

    Ian Lake

    1 year ago
    Can you explain what user experience you're trying to accomplish by putting a bottom sheet over an empty screen (since there's no destination below the bottom sheet)?
    jossiwolf

    jossiwolf

    1 year ago
    Apart from that - the issue here is the bottom sheet being empty 🙂
    Chris Fillmore

    Chris Fillmore

    1 year ago
    My use case is in a camera Activity. The camera preview is on the screen at all times, so it sits outside the NavHost, like this:
    setContent {
      CameraPreview()
      NavHost(...) {
        ...
      }
    }
    Aha, Jossi is right. That didn’t occur to me, because in my actual app I have a bunch of stuff in the bottom sheet. But the code amounted to something like this:
    bottomSheet(...) {
      for (item in <empty list>) {
        ...
      }
    }
    My bad.
    Jossi, is it practical to add support for bottom sheets as start destinations? I see the issue now that, without being able to pop the stack, dismissing the modal would go nowhere. perhaps the
    BottomSheetNavigator.Destination
    could accept a fallback route to navigate to, in cases where the bottom sheet is itself at the bottom of the stack? Or, instead, add some behaviour where the bottom sheet can be set as startDestination, with another destination underneath? Reason I ask is, on iOS we have roughly this capability, by opening a bottom-sheet-style modal in a
    viewDidLoad
    callback. I’d like to have some similar capability on Android, so that I can open a bottom sheet when an Activity initially starts.
    jossiwolf

    jossiwolf

    1 year ago
    I don't think that makes a ton of sense.
    BottomSheetNavigator
    is only aware of entries on its state's back stack, which means there are only entries with BottomSheetNavigator.Destinations on there. The
    NavController
    keeps track of the global back stack but the navigator isn't aware of the
    NavController
    . I think it would make more sense to have your Activity (or whatever is under the sheet) as startDestination and then navigate when the Activity starts. But cc @Ian Lake cause I'd love to hear his thoughts about
    FloatingWindow
    destinations as start destinations
    Chris Fillmore

    Chris Fillmore

    1 year ago
    Thanks for the feedback. Yeah I’m open to suggestions on how to handle this use case
    i

    Ian Lake

    1 year ago
    It sounds like your
    CameraPreview
    should be the start destination of your graph