Reputation: 3658
I have multiple steps(steps are dynamic let's say its 4) mobile screens in which I can $navigateBack()
from step 4 to step 3, step 3 to step 2, step 2 to step 1 on the back arrow tap. so it's working fine.
Now after completing each step I can $navigateTo()
the main screen (from where I navigate to steps) directly, But after I tap on back arrow its navigating to previous back stack entry that means the last step 4. I want to prevent this and want to navigate to extract the previous screen of the main screen.
If I use clearHistory
flag on $navigateTo()
then it completely clears the navigation history.
If I use backstackVisible
flag then it stops internal back steps navigation.
Is there any way in which after finishing the last step I can navigate to the main screen and then on back tap I can land on the correct previous screen of the main screen? After complete step 4, How can I clear stack of all dynamic steps only?
Can someone explain me how options and backStackEntry is working in $navigateBack(options, backstackEntry = null) because no details added in https://nativescript-vue.org/en/docs/routing/manual-routing/#navigateback
Any help will be appreciated.
Upvotes: 2
Views: 2048
Reputation: 897
In your particular case, I think it would make more sense to open the steps in a modal that has it's own frame. This way the navigation stack within the modal is completely separate from your main navigation stack, and allows you to navigate forwards/backwards as needed. When you're done with the steps, you can close the modal and return the result, and your main navigation stack will be unaffected!
I've created a minimal demo of the proposed solution here: https://play.nativescript.org/?template=play-vue&id=SJdejN
Upvotes: 1
Reputation: 2075
I think for your scenario you could use Modal View Navigation - from the main screen you open Modal View, then in this Modal View you guide user throw your steps, and when from last step you need to return to the main screen, you close Modal View.
Upvotes: 0