Hi!
my app looks like:
<Navigator default="loginPage">
loginPage
homePage
pageOne
pageTwo
</Navigator>
when the login is correct:
router.goto("home")
so now the path is: “home” and router.back() would do nothing.
when i navigate to pageOne:
router.push("pageOne")
the path would be: “home”, “pageOne” so when i do router.back() it navigates back to the homePage
if then i navigate to pageTwo:
router.push("pageTwo")
the path would be: “home”, “pageTwo” so when i do router.back() it navigates back to the homePage
the problem i have is that from pageOne i can navigate directly to pageTwo but i want the back in pageTwo to ALWAYS navigate back to homePage.
is that possible?
I’m sorry if i’m not understanding correctly, but what you should do is just a goTo() from page2 to home page, I don’t know its via a button or not but that should work fine. When you use goTo() you are clearing the path completely so you can’t go use goBack()
the “goto” navigates to the “homePage” but the problem is that the navigation animation is diferent so it’s quite weird (As the loginPage navigates to the “homePage” with a different navigation than the one used in the “router.back()”)
That’s why i would like to know if there is something like: “router.backToFirstElement()”
Zaulin, from page one when you need to go to page two, do the following.
router.goBack(); router.push(“pageTwo”);
Now when the user clicks back on pageTwo, will end up on home.
it works!
i thought that when doing that i would get 2 navigations.
Thnx.