@SDP1966 wrote:
I'm attempting to remove the two most recent pages from the navigation stack such that the navbar back button will take the user back to three pages. The stack is as follows:
Index 0 - CleintListpage
Index 1 - AddClentPage
Index 2 - AddLocationPage
Index 3 - ClientDetailPageAfter working through index 1 and 2 the user is taken to page showing their newly entered user. Obviously I don't want them to have to navigate back through those two pages to get back to the client list.
I've tried removing the two views inside the many NavController lifecycle events with strange results on all of them. The results vary from wrong pages removed to a view array with no views. When I use the setRoot method inside the onPageWillLeave the stack works as intended, the back button takes me back to index 0 and it's the only view in the array. The issue here is rather than animating back to index 0 is just appears, after which all is well.
If I use the remove method within another method on index 3 and execute that with a button on the page it removes the correct pages from the stack, then when I tap the back button in animates smoothly to index 0. That obviously is a non-starter for production.
Cliffs notes version: How do I remove views from the navigation stack such that the navbar back button will function properly?
Posts: 1
Participants: 1