Created
December 24, 2019 14:21
-
-
Save zsoltk/e7183639ef78b609d15151706668d238 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class Routing { | |
object ChildScreen1 : Routing() | |
object ChildScreen2 : Routing() | |
data class ChildScreen3(val foo: Bar) : Routing() | |
} | |
@Composable | |
fun MyParentComposable(defaultRouting: Routing) { | |
BackHandler(defaultRouting) { backStack -> | |
// backStack contains elements of Routing | |
when (val routing = backStack.last()) { | |
// compose further based on current routing | |
// manipulate backStack with push/replace/etc. operations to trigger recompose | |
// use back press on device to pop backstack and trigger recompose | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment