Two questions about `nav3` now that I started to u...
# compose
g
Two questions about
nav3
now that I started to use it more deeply: 1. There's only one SceneStrategy parameter on
NavDisplay
, what if I want to use multiple ones on different screens, meaning sometimes I need dialogs, sometimes bottom sheets, sometimes list-detail, etc... 2. Using the bottom sheet recipe in addition to the ResultEventBus recipe, how can I be notified that the bottom sheet is dismissed so I can trigger a Result on the screen that opened it? Thank you in advance!
g
Why isn't the API receiving a list? The order matters I guess?
j
Both are ordered. I guess that's a design decision.
👍 1
i
The order definitely matters. The best analog is Modifier.then() where it needs to be super clear which scene gets priority:
dialogStrategy then bottomSheetStrategy
is unambiguous
👍 1
Re: sending results when a bottom sheet closes - that sounds like sending the result in the
onDispose
of a
DisposableEffect
inside the bottom sheet? That will get called when the sheet is removed from composition (like when it is popped)
mind blown 1
g
Thank you @Ian Lake, I wasn't sure that would be the right way, but it is so simple yet elegant 😁
k
Wouldn’t using
LaunchWhenResumed
instead of
LaunchedEffect
also cover this use case? So, observing the event only if the `ResultEffect`’s user is in at least a resumed state
i
The underlying screen's lifecycle is not affected by overlays like bottom sheets and dialogs, so it would be resumed the entire time
k
Thanks for the clarification