-
Notifications
You must be signed in to change notification settings - Fork 56
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
Prop for alerting the user before exiting app #167
base: master
Are you sure you want to change the base?
Prop for alerting the user before exiting app #167
Conversation
? |
Thank you @nmquebb, I'll review this soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution and sorry for the delay.
The back button will only exit the current application if it's the last route in the stack, it's the expected behaviour.
However, it could be nice to have this, but I would highly prefer a callback or something more customizable than a hardcoded alert that can't be translated.
@@ -17,6 +18,7 @@ const propTypes = { | |||
currentRoute: PropTypes.object.isRequired, | |||
customAction: PropTypes.func, | |||
handleBackAndroid: PropTypes.bool, | |||
alertAndroidExit: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: alphabetical order
@@ -70,10 +72,19 @@ class NavBarContainer extends React.Component { | |||
BackAndroid.addEventListener('hardwareBackPress', () => { | |||
if (this.props.currentRoute.index > 0) { | |||
this.goBack(); | |||
return true; | |||
} else { | |||
console.log('dsa') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These console.log
should not be commited.
@@ -23,6 +23,7 @@ const propTypes = { | |||
customAction: PropTypes.func, | |||
firstRoute: PropTypes.object.isRequired, | |||
handleBackAndroid: PropTypes.bool, | |||
alertAndroidExit: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: alphabetical order
I've been getting some complaints from user's about the app just exiting. I'm not an Android user so I don't know if that's expected behavior or not, but I thought it would be nice to add an option alert before leaving the app.