A ação PopToView
faz a navegação para uma tela anterior a tela atual, que esteja na mesma pilha de telas. Ao realizar a ação, qualquer tela posterior a tela para a qual se navegou será destruída. Por exemplo, se a aplicação exibe uma tela que é a terceira
tela em uma pilha, ao navegar para a primeira, a segunda e terceira telas serão destruídas.
A estrutura da PopToView
é:
Atributo | Tipo | Obrigatório | Definição |
---|---|---|---|
route | String | ✓ | Rota de alguma tela que está na pilha. |
navigationContext | NavigationContext | Contexto salvo na tela destino. |
Para testar, iremos utilizar três telas:
PopToView
será executa com o clique de um botão. A url listada na ação PopToView deverá ser "/firstscreen"A seguir listamos os códigos das telas de teste:
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.