Skip to content

Commit

Permalink
Merge pull request #48 from JosephSemrai/fix-initial-render
Browse files Browse the repository at this point in the history
Fix Landing Screen Firebase
  • Loading branch information
AsithaIndrajith authored Jan 14, 2020
2 parents d51a169 + 7b64a73 commit ee4d1fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MobileApp/src/screens/LandingScreen/LandingScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ import auth from '@react-native-firebase/auth';
import {LOGO} from '../../images/index';

class LandingScreen extends React.Component {
componentDidMount() {
auth().onAuthStateChanged(user => {
async componentWillMount() {

await auth().onAuthStateChanged(user => {
if (user) {
this.props.navigation.navigate('App');
} else {
this.props.navigation.navigate('SignIn');
}
}).catch(() => {
this.setState({ error: 'Authentication Failed.' });
this.props.navigation.navigate('SignIn');
});
}

Expand Down

0 comments on commit ee4d1fd

Please sign in to comment.