import React, { Component } from 'react';
import firebase from 'firebase'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import RegisterScreen from './screens/RegisterScreen';
import LoginScreen from './screens/LoginScreen';
import { firebaseConfig } from './config/firebaseConfig';
import { Text, View } from 'react-native';
import { styles } from './config/styles';
if (firebase.apps.length === 0) {
firebase.initializeApp(firebaseConfig)
}
const Stack = createStackNavigator();
export default class App extends Component {
constructor(props){
super(props);
this.state = {
loaded: false,
}
}
componentDidMount(){
firebase.auth().onAuthStateChanged((user) => {
if (!user){
this.setState({
loggedIn: false,
loaded: true,
})
}
else{
this.setState({
loggedIn: true,
loaded: true,
})
}
})
}
render() {
const { loggedIn, loaded } = this.state
if(!loaded){
return(
Hopper
);
}
if(!loggedIn){
return (
);
}
return(
Cheese
);
}
}