PopToView

Here you’ll find PopToView description and its attribute.

What is it?

Returns to a specific screen and cleans the navigation that was generated from that screen.

Your structure is represented by the attribute below:

AttributeTypeRequiredDefinition
route​StringRoute of a screen that it’s on the pile.

How to use it?

On the example below, three screens were used: two first used PushView to add the screens to the piles, the last one use PopToView to return to the first.

To test, you will need three endpoints:

  1. The first endpoint will be what your frontend will call to render the screen zero.
  2. The second endpoint should be mapped as "/firstScreen", because this will be the chosen URL to the navigation of the button on the screen 0 and for that, this endpoint must return the screen 1.
  3. The third endpoint must be mapped "/secondScreen", because this will be the chose URL to the navigation of the button on the screen 1, for that, this endpoint must return the screen 2. It is through the screen 2 that it passes a route where the endpoint of the screen must return. In this case, “/home” is the endpoint of the zero screen.

How to call the screen 0

Screen(
    child = Container(
        children = listOf(
            Text(
                "First Screen on Stack"
            ),
            Button(
                text = "Click me!",
                onPress = listOf(
                    Navigate.PushView(
                        Route.Remote(
                            url = "secondScreenNavigate.json"
                        )
                    )
                )
            )
        )
    )
)

How to call the screen 1

Screen(
    child = Container(
        children = listOf(
            Text(
                "Second Screen on Stack"
            ),
            Button(
                text = "Click me!",
                onPress = listOf(
                    Navigate.PushView(
                        Route.Remote(
                            url = "popToView.json"
                        )
                    )
                )
            )
        )
    )
)

How to call the screen 2

Screen(
    child = Container(
        children = listOf(
            Text(
                "Third Screen on Stack"
            ),
            Button(
                text = "Click me to go to first screen",
                onPress = listOf(
                    Navigate.PopToView(
                        route = "firstScreenNavigate.json"
                    )
                )
            )
        )
    )
)

Last modified February 11, 2021: create content (#298) (43225e15)