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
bug: React navigation back and history.goBack() #29130
Comments
Thanks for the issue! This issue has been labeled as Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed. If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue. For a guide on how to create a good reproduction, see our Contributing Guide. |
I don't think it need reproduction because clearly push and navigate adds one history entry intro the stack, but the docs of this and the goBack from ionRouter is poorly. |
We ask for a reproduction so we can be sure that we are verifying the same issue that you are reporting. Routing issues can be sometimes complex to debug, so a reproduction is very helpful here too. |
This issue is being closed due to lack of a reproduction. If this is still a problem in the latest version of Ionic, please open a new issue and ensure the template is fully filled out. Thank you! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
v7.x
Current Behavior
Hello!
Right know if u:
go from HOME-> A -> B -> C
then from C do
navigation("/B", "back", "pop")
then from B do
navigation("/A", "back", "pop")
the from A do
history.goBack()
A goes to B instead of HOMEI know that u would ask why are u doing that? but i have a custom goBack that uses the
pushedByRoute
from therouteInfo
in theuseIonRouter
something like this:
But clarly
push(routePushed.current, "back", "pop");
does not behave like anhistory.goBack()
in terms of history stackit would be nice if it is explained a litle bit more what does really do "pop" and also in other hand, what is the main difference between
history.goBack()
andgoBack()
fromuseIonRouter
that in the docs only saysbut not fully explains what "Navigates backwards in history, using the IonRouter to determine history" means
EDIT: I fount that either push and navigates always push the next route into the stack, and pop only pops the current path from the stack
Expected Behavior
I dont know if it is the expected behavior, but someone would think that
push(/route, "back", "pop");
ornavigate(/route, "back", "pop");
(if used from NavContext) will behave like ahistory.goBack()
Steps to Reproduce
Is explained before
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 7.1.1
Ionic Framework : @ionic/react 7.7.4
Capacitor:
Capacitor CLI : 5.2.3
@capacitor/android : 5.2.3
@capacitor/core : 5.2.3
@capacitor/ios : 5.2.3
Utility:
cordova-res : 0.15.1
native-run : 1.7.2
System:
NodeJS : v18.16.0
npm : 9.5.1
OS : Windows 10
Additional Information
No response
The text was updated successfully, but these errors were encountered: