Is it possible to make a clearing of View Stack to a certain view which was open in the past?
For example, there is a stack A → B → C → D → E → F and I want with one step get back right away to C (so, the newer View Stack state will be like that A → B → C).
To achieve this you could use the navigate.replace("path")
function.
Please see this section of the documentation for further details on replace
and other view navigation functions.
Yes, I read the documentation before I posted that question.
For example: A → B ⇌ C will result in
[A, C]on the view stack. A → B ⇌ C ⇌ D ⇌ B will result in
[A, B] on the view stack.
As I understand that function, replace
replaces only last view. But I need to go forward and only if a condition is true, then jumps on some of previous views.
A → B → C → D → E → F
…
click on back, some condition is true
then… A → B → C
else… just dismiss to A → B → C → D → E
I can’t use clear, because it will be just C
after that, but I need to have A → B → C
.
navigate.dismiss(A)
is what you are looking for @khilda
Thanks!
For my example:
A → B → C → D → E → F
…
click on back, some condition is true
then… A → B → C
else… just dismiss to A → B → C → D → E
It should be
navigate.dismiss(C)
and
navigate.dismiss(E)
respectively.
Also, I see that a notice has appeared in the documentation:
Closing multiple views, for instance to return to a top level view, use the
dismiss action specifying a view path, navigate.dismiss('view_path').