The PopToView
action navigates to a screen that was rendered before the current screen, which is on the same stack. For example, if the application displays a screen that is the third
screen in a stack, when navigating to the first
, the second
and third
screens will be destroyed.
The structure of PopToView
is:
Attribute | Type | Required | Definition |
---|---|---|---|
route | String | ✓ | Route of a screen that is on the stack. |
navigationContext | NavigationContext | Context to be saved on the target screen. |
To test, we will use three screens:
PopToView
action will be triggered. The url listed in the PopToView
action should be "/firstscreen"Below we list the codes to test this action:
Screen(
child = Container(
children = listOf(
Text(
"First Screen on Stack"
),
Button(
text = "Click me!",
onPress = listOf(
Navigate.PushView(
Route.Remote(
url = "/secondscreen"
)
)
)
)
)
)
)
Screen(
child = Container(
children = listOf(
Text(
"Second Screen on Stack"
),
Button(
text = "Click me!",
onPress = listOf(
Navigate.PushView(
Route.Remote(
url = "/thirdscreen"
)
)
)
)
)
)
)
Screen(
child = Container(
children = listOf(
Text(
"Third Screen on Stack"
),
Button(
text = "Click me to go to first screen",
onPress = listOf(
Navigate.PopToView(
route = "/firstscreen"
)
)
)
)
)
)
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.