Skip to content
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

Page onNavigatingFrom should allow for canceling #583

Open
jkappel71 opened this issue Aug 13, 2015 · 4 comments
Open

Page onNavigatingFrom should allow for canceling #583

jkappel71 opened this issue Aug 13, 2015 · 4 comments

Comments

@jkappel71
Copy link

jkappel71 commented Aug 13, 2015

Say you have a data entry form that a user has filled out, but they have not filled out all required fields. Pressing the back button (on android) causes the app to go back, no way to cancel it at all. If the form is not properly filled out, you can't save the data so it's just lost.

We need to be able to respond to the onNavigatingFrom event in some manner that will cause the navigation event to be cancelled.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@stonecourier
Copy link

Was just about to raise this as an issue also. I would like to see this implemented.

@N3ll N3ll added this to the 1.5 (Under Review) milestone Oct 12, 2015
@hshristov hshristov modified the milestones: 1.6 (Under Review), 1.5 (Under Review) Oct 16, 2015
@sitefinitysteve
Copy link
Contributor

+1

@NathanaelA

This comment was marked as abuse.

@hshristov hshristov modified the milestones: 1.7.0 (Under Review), 1.6.0 Feb 8, 2016
@valentinstoychev valentinstoychev modified the milestone: 1.7.0 (Under Review) Feb 24, 2016
@enchev enchev mentioned this issue May 25, 2016
5 tasks
@enchev enchev added the feature label Aug 9, 2016
@spierala
Copy link

spierala commented Apr 13, 2018

I think on Android there are (in the meantime) some good ways to cancel back navigation:

On iOS as far as I know the only solution is to hide the BackButton (NavigationButton) with visibility="collapsed" and mimic the Back Button by adding a custom ActionItem which can have an icon and tap action of your choice.
The tap action can then cancel or allow the navigation based on some condition.
You can navigate programatically by using this.routerExtensions.backToPreviousPage() (also see: https://docs.nativescript.org/core-concepts/angular-navigation).
The biggest challenge is then to style the custom back button the same way as the default back button. E.g. I am still on the search for the back button icon on iOS :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants