Generic question: How can I pass a lambda for a screen using Navigation? š¤
Specific explanation: Iām creating a Generic Error screen which should have an option to āRetryā.
So my plan was
if (error) navController.navigate(ERROR_SCREEN)
, but Iām stuck in how to pass this action to the ErrorScreenā¦
Any thoughts?
z
Zun
06/04/2021, 1:32 PM
I don't think navigating to a screen is a good idea (because it requires you to navigate back to retry)
Instead, create a Composable error screen, and display that with a retry callback function
Zun
06/04/2021, 1:34 PM
I am still learning Compose but this is how I do this
n
nglauber
06/04/2021, 1:34 PM
Make sense⦠That was my initial idea, I just didnāt want to handle the back press manually⦠But I guess itās better