Skip to content

How to Implement Replace behaviour like fragment transactions with navigator? #247

Closed Answered by Tlaster
farhazulMullick asked this question in Q&A
Discussion options

You must be logged in to vote

No, popUpTo does not clear all backstacks, here is an working example you can try:

NavHost(
    navigator = navigator,
    initialRoute = "/a",
) {
    scene("/a") {
        Column {
            Text("A")
            Button(onClick = {
                navigator.navigate("/b")
            }) {
                Text("Go to B")
            }
        }
    }
    scene("/b") {
        Column {
            Text("B")
            Button(onClick = {
                navigator.navigate("/c")
            }) {
                Text("Go to C")
            }
            Button(onClick = {
                navigator.goBack()
            }) {
                Text("Goback")
            }
        }
    }
    s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@farhazulMullick
Comment options

@Tlaster
Comment options

Answer selected by farhazulMullick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants