ResetStack

Here you’ll find ResetStack description and its attribute.

What is it?

What is it? Opens a screen with an informed route of a new flow and cleans the pile of previous loaded screens.

Your structure is represented by the attribute below:

AttributeTypeRequiredDefinition
routeRouteNavigation route.

How to use it?

On the example below, three screens were used. The two first used PushView to add the screens to the piles and the last one uses ResetStack and reopens the first screen.

You will need three endpoints to test:

  1. The first endpoint will be what your frontend will call to render the screen zero.
  2. The second endpoint must be mapped "/firstScreen", because this will be the chosen URL of the screen 0 button’s navigation and for that the endpoint must return the screen 1.
  3. The third point must be mapped**"/secondScreen",** because this will be the chosen URL of the screen 1 button’s navigation and for that this endpoint must return the screen 2. On the screen 2, the passed route must be the screen endpoint that you want to return when the application restarts. In this case, it is **"/home"** that it is screen’s 0 endpoint.

How to call the screen zero

Screen(
    child = Container(
        children = listOf(
            Text(
                "First Screen on Stack"
            ),
            Button(
                text = "Click me!",
                onPress = listOf(
                    Navigate.PushView(
                        Route.Remote(
                            url = "SecondScreenonResetStack.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 = "resetStack.json"
                        )
                    )
                )
            )
        )
    )
)

How to call the screen 2

Screen(
    child = Container(
        children = listOf(
            Text(
                "Third Screen on Stack"
            ),
            Button(
                text = "Click me  to reset stack",
                onPress = listOf(
                    Navigate.ResetStack(
                        route = Route.Remote("firstScreenonResetStack.json")
                    )
                )
            )
        )
    )
)

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