forked from vergnet/application-amicale
Improved amicale home button and post login behavior
This commit is contained in:
parent
fe9089881a
commit
f2acb59ea7
2 changed files with 24 additions and 5 deletions
|
@ -44,10 +44,8 @@ class ActionsDashBoardItem extends React.Component<Props> {
|
||||||
? "chevron-right"
|
? "chevron-right"
|
||||||
: "login"}/>}
|
: "login"}/>}
|
||||||
onPress={isLoggedIn
|
onPress={isLoggedIn
|
||||||
? () => this.props.navigation.navigate("services", {
|
? () => this.props.navigation.navigate("profile")
|
||||||
screen: 'index'
|
: () => this.props.navigation.navigate("login", {nextScreen: "profile"})}
|
||||||
})
|
|
||||||
: () => this.props.navigation.navigate("login")}
|
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -50,11 +50,27 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
onPasswordChange: Function;
|
onPasswordChange: Function;
|
||||||
passwordInputRef: Object;
|
passwordInputRef: Object;
|
||||||
|
|
||||||
|
nextScreen: string | null;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.onEmailChange = this.onInputChange.bind(this, true);
|
this.onEmailChange = this.onInputChange.bind(this, true);
|
||||||
this.onPasswordChange = this.onInputChange.bind(this, false);
|
this.onPasswordChange = this.onInputChange.bind(this, false);
|
||||||
|
this.props.navigation.addListener('focus', this.onScreenFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
onScreenFocus = () => {
|
||||||
|
this.handleNavigationParams();
|
||||||
|
};
|
||||||
|
|
||||||
|
handleNavigationParams () {
|
||||||
|
if (this.props.route.params != null) {
|
||||||
|
if (this.props.route.params.nextScreen != null)
|
||||||
|
this.nextScreen = this.props.route.params.nextScreen;
|
||||||
|
else
|
||||||
|
this.nextScreen = null;
|
||||||
|
}
|
||||||
|
console.log(this.nextScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
showErrorDialog = (error: number) =>
|
showErrorDialog = (error: number) =>
|
||||||
|
@ -65,7 +81,12 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
hideErrorDialog = () => this.setState({dialogVisible: false});
|
hideErrorDialog = () => this.setState({dialogVisible: false});
|
||||||
|
|
||||||
handleSuccess = () => this.props.navigation.goBack();
|
handleSuccess = () => {
|
||||||
|
if (this.nextScreen == null)
|
||||||
|
this.props.navigation.goBack();
|
||||||
|
else
|
||||||
|
this.props.navigation.replace(this.nextScreen);
|
||||||
|
};
|
||||||
|
|
||||||
onResetPasswordClick = () => Linking.openURL(RESET_PASSWORD_PATH);
|
onResetPasswordClick = () => Linking.openURL(RESET_PASSWORD_PATH);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue