-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to send the cancelation result? #69
Comments
Hi @margarita-v ! Thank you again for reporting! :) I remember thinking if this would ever be helpful when I was implementing the nav result feature. Turns out it is. Would this work for your use case?
sealed interface NavResult<out R> {
object Canceled: NavResult<Nothing>
data class Value<R>(val value: R): NavResult<R>
} //...
resultRecipient.onResult { confirmed ->
when (confirmed) {
is NavResult.Canceled -> println("canceled!!")
is NavResult.Value -> if (confirmed.value) {
navigator.navigate(SomeDestination)
}
}
} |
I think it would be perfect 👍 |
Hey @margarita-v ! So the new 1.3.5-beta release contains this new enhancement and deprecates the old |
Thank you, now it works perfectly 🔥 |
Now it's possible to use
resultNavigator.navigateBack
for sending confirmation result from screen. Is there any opportunity to send the cancelation result when the result screen composable is gone in order to handle both results in the same callback of recipient screen?For example:
This
DisposableEffect
forResultScreen
doesn't work too:Is there any best practice to solve it or should I use different callbacks for cancelation based on composable lifecycle and confirmation based on action?
The text was updated successfully, but these errors were encountered: