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"
|
||||
: "login"}/>}
|
||||
onPress={isLoggedIn
|
||||
? () => this.props.navigation.navigate("services", {
|
||||
screen: 'index'
|
||||
})
|
||||
: () => this.props.navigation.navigate("login")}
|
||||
? () => this.props.navigation.navigate("profile")
|
||||
: () => this.props.navigation.navigate("login", {nextScreen: "profile"})}
|
||||
style={styles.list}
|
||||
/>
|
||||
</Card>
|
||||
|
|
|
@ -50,11 +50,27 @@ class LoginScreen extends React.Component<Props, State> {
|
|||
onPasswordChange: Function;
|
||||
passwordInputRef: Object;
|
||||
|
||||
nextScreen: string | null;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onEmailChange = this.onInputChange.bind(this, true);
|
||||
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) =>
|
||||
|
@ -65,7 +81,12 @@ class LoginScreen extends React.Component<Props, State> {
|
|||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue