-
-
Notifications
You must be signed in to change notification settings - Fork 241
Routing breaks when using Frame.goBack(to: BackstackEntry) #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @abinici, This is something expected when using FrameModules in this way in NativeScirpt Angular 2 project. Using frameModule for navigation is a concept used in NativeScirpt core project. Regarding this module, the purpose of In your case, when you are using NativeScript Angular 2 template, there is another way to making navigation. First of all to in this type of project you should use angular Navigate to another page.
Navigate to the previous page.
For further info, you could also review the documentation. |
From @abinici on March 23, 2017 9:55 Hi @tsonevn, I understand that the routing in Navigation Core and Angular is different. But Nativescript Angular is missing the functionality I needed. Thats why I began using Framemodule, because it had the method And to elaborate this, I dont want to go to previous page. I wish to go 2 or more pages back in history. So, when I navigate from page4 to page2, I want the pages page4 and page3 removed from the stack, in one single action. How can this be accomplished with Nativescript Angular? I am guessing that the only way resolve this with Nativescript Angular is by calling I think methods like these would help a lot: |
Hi @abinici,
For more info review the documentation. Hope this helps. |
From @abinici on March 28, 2017 13:34 Hi @tsonevn, I tried your suggestion, when navigating from page2 to page3, but then my back navigation button disappears on page3, which prevents the user from navigating back to page2. What I am trying to accomplish, is that the pages that the user navigates to, such as page2, page3 and page4, should all be put on the stack so that user is not prevented from navigating back from page4 to page3 and page2. But when hitting a button on page4, I would like the user to be taken back to page2 without having to visit page3. The function I am looking for is something like popToRoot in Ionic2: http://ionicframework.com/docs/v2/api/navigation/NavController/#popToRoot You use Currently, I am forced to use Maybe you could give me some directions so that I or someone else could implement this functionality in a PR, with something like |
From @abinici on March 28, 2017 14:15 Maybe this issue should be moved to https://github.com/NativeScript/nativescript-angular? |
Hi @abinici, In the meantime, you could call You could also keep track on the issue for further. |
From @phattranky on April 24, 2017 8:51 Need same feature like @abinici :) |
From @jogboms on July 12, 2017 21:32 This feature would make so much sense if added. I had to use a workaround when I needed a similar feature. Using the |
From @cindy-m on January 29, 2018 13:21 Is there any indication when this feature will be available? We would also really like to use it instead of using tricks with the clear history and self made back buttons or other hacks to get it to work as intended |
From @bhavincb on April 5, 2018 7:1 +1 |
From @ThunderAnimal on June 4, 2018 15:54 +1 |
From @ThunderAnimal on June 4, 2018 16:19 @abinici how is you pop method looks like? I want to solve the issue with the same workaround. But actually I have no Idea how to solve it, first i was thinking to just pop the state array, but it is not working pretty well :D One solution to extend the NSLocationSrategy without change the file itself could be that:
|
For our app we depended on back navigation to a specific page in history without editing any of the core classes. It took a while to figure out the exact choreography of all events that are triggered, but this is the solution we came up with:
We are still updating the code to move the check for largeBackStack outside the lambda method, but in the meantime this is a solution that works like a charm for us. Hope this works for you guys as well |
@FBorgonjen thanks for your code sharing. Meanwhile I just solved my problem by re-order my navigation structure and using The Navigation is now more straight forward and consistens for the users. But I saved your code, for one day when i really need to go back more the one page. So thanks! |
@ThunderAnimal it's more straightforward but haven't you lost animation when routing and the ability to swipe back? |
@PawelDziura yeah that's right, the native page animation disappeared. But with Angular you can just define own animations for router navigation. And so it looks - in my specific case - much better, because now only some content of the page will replaced with a nice animation and not the hole page. |
Is there any estimation on when this feature will be implemented? Our solution as proposed above is breaking when navigating back more than 3 pages. |
I am looking forward to use this feature, any updated? Thanks! |
I'm also waiting on this feature to be implemented. I'm currently using one of the hacks described above, but I would love to throw away the difficult-looking code and replace it with a simple |
I am trying to this exact thing for our application. I am trying to create a breadcrumbs that the user will be able to travel to any page they have previously been on. I am running into the same problem where if i travel back to a page i wont be able to navigate forward from that point on anymore. I'm going to try out @FBorgonjen's code and see if it helps me. |
@AliKalkandelen, as said on September 3rd the proposed method is not always working when navigating back more than 3 pages. But if that is not your case, it works :) Good luck implementing! @tsonevn, is there any news on this issue. Will it be fixed? I am actually quite surprised that Nativescript has reached version 5.0 (and NS-Angular 6+) and there are still basic navigation flows missing in the code. Especially since this feature is requested on March 21, 2017 20:39 |
Hi @FBorgonjen, |
Hi @tsonevn,
|
@tsonevn I'm currently working on an app that has many pages. But this bug hinders me in the development of the app. So I'm hoping you can give me some a time when this will be implemented. You have mentioned multiple times that the feature request is under review, but now it is already 3/4 year ago since your last mention on this. (And 2 years ago since the first time someone requested this feature.) I'll think with implementing this feature will serve the community. The first request is already from 2017, NativeScript/NativeScript#3848. And there are more people wanting this feature see for example #1167. Thank you for your effort in the project! |
If I log: So the name of the components is stored in locationStrategy, but I cannot work out how to access the names properly; I would assume they are held in some kind of list. Please, how do I do this? |
@room101b Each navigation is pushed into the current outlet and then popped out on back. If you want to keep track of the page you're in, I'd recommend listening to angular navigation events. If anyone is willing to contribute to this issue, this would be a good starting point. Bear in mind that |
Any update or workaround on this feature? |
From @abinici on March 21, 2017 20:39
Tell us about the problem
Lets say we have an app that consists of 4 pages, and lets name these pages page1, page2, page3 and page4. And lets say that we have navigated from page1 to page4, visiting page2 and page3 along the way.
Now, I wish to go back to page2 using
Frame.goBack(to: BackstackEntry)
by looking up page2 this wayframeModule.topmost().backStack[1]
. Then if I try to navigate to page3 nothing will happen. Navigating back to page1 works, but navigating forward still doesn't work.If, instead of navigating to page2, I navigate to page1 or page3, routing will not break.
Which platform(s) does your issue occur on?
Both
Please provide the following version numbers that your issue occurs with:
Please tell us how to recreate the issue in as much detail as possible.
I have created a sample app that reproduces this issue: https://github.com/abinici/ns-goback-issue
Copied from original issue: NativeScript/NativeScript#3848
The text was updated successfully, but these errors were encountered: