Fixed login redirection error
This commit is contained in:
parent
0c71a78b22
commit
92fce1d425
1 changed files with 4 additions and 18 deletions
|
@ -6,15 +6,16 @@ import {Avatar, Button, Card, HelperText, Paragraph, TextInput, withTheme} from
|
||||||
import ConnectionManager from "../../managers/ConnectionManager";
|
import ConnectionManager from "../../managers/ConnectionManager";
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import ErrorDialog from "../../components/Dialogs/ErrorDialog";
|
import ErrorDialog from "../../components/Dialogs/ErrorDialog";
|
||||||
import {CommonActions} from "@react-navigation/native";
|
|
||||||
import {withCollapsible} from "../../utils/withCollapsible";
|
import {withCollapsible} from "../../utils/withCollapsible";
|
||||||
import {Collapsible} from "react-navigation-collapsible";
|
import {Collapsible} from "react-navigation-collapsible";
|
||||||
import CustomTabBar from "../../components/Tabbar/CustomTabBar";
|
import CustomTabBar from "../../components/Tabbar/CustomTabBar";
|
||||||
|
import type {CustomTheme} from "../../managers/ThemeManager";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
route: Object,
|
route: Object,
|
||||||
collapsibleStack: Collapsible,
|
collapsibleStack: Collapsible,
|
||||||
|
theme: CustomTheme
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -45,32 +46,17 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
dialogError: 0,
|
dialogError: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
colors: Object;
|
|
||||||
|
|
||||||
onEmailChange: Function;
|
onEmailChange: Function;
|
||||||
onPasswordChange: Function;
|
onPasswordChange: Function;
|
||||||
passwordInputRef: Object;
|
passwordInputRef: Object;
|
||||||
|
|
||||||
nextScreen: string;
|
|
||||||
|
|
||||||
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.colors = props.theme.colors;
|
|
||||||
|
|
||||||
this.props.navigation.addListener('focus', this.onScreenFocus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onScreenFocus = () => {
|
|
||||||
if (this.props.route.params !== undefined && this.props.route.params.nextScreen !== undefined) {
|
|
||||||
this.nextScreen = this.props.route.params.nextScreen;
|
|
||||||
this.props.navigation.dispatch(CommonActions.setParams({nextScreen: 'profile'}));
|
|
||||||
} else
|
|
||||||
this.nextScreen = 'profile';
|
|
||||||
};
|
|
||||||
|
|
||||||
showErrorDialog = (error: number) =>
|
showErrorDialog = (error: number) =>
|
||||||
this.setState({
|
this.setState({
|
||||||
dialogVisible: true,
|
dialogVisible: true,
|
||||||
|
@ -79,7 +65,7 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
hideErrorDialog = () => this.setState({dialogVisible: false});
|
hideErrorDialog = () => this.setState({dialogVisible: false});
|
||||||
|
|
||||||
handleSuccess = () => this.props.navigation.replace(this.nextScreen);
|
handleSuccess = () => this.props.navigation.goBack();
|
||||||
|
|
||||||
onResetPasswordClick = () => this.props.navigation.navigate('amicale-website', {
|
onResetPasswordClick = () => this.props.navigation.navigate('amicale-website', {
|
||||||
screen: 'amicale-website',
|
screen: 'amicale-website',
|
||||||
|
@ -239,7 +225,7 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
left={(props) => <Avatar.Icon
|
left={(props) => <Avatar.Icon
|
||||||
{...props}
|
{...props}
|
||||||
icon={"help"}
|
icon={"help"}
|
||||||
color={this.colors.primary}
|
color={this.props.theme.colors.primary}
|
||||||
style={{backgroundColor: 'transparent'}}/>}
|
style={{backgroundColor: 'transparent'}}/>}
|
||||||
/>
|
/>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
|
|
Loading…
Reference in a new issue