import React, { Component } from 'react'; import firebase from 'firebase' import thunk from 'redux-thunk'; import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { createDrawerNavigator } from '@react-navigation/drawer'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import AvailabilityScreen from './screens/AvailabilityScreen'; import MailScreen from './screens/MailScreen'; //import RegisterScreen from './screens/RegisterScreen'; import RegisterScreen from './screens/auth/RegisterScreen'; //import LoginScreen from './screens/LoginScreen'; import LoginScreen from './screens/auth/LoginScreen'; // import HomeScreen from './screens/HomeScreen'; //import Loading from './components/Loading'; import Loading from './screens/main/Loading'; import { firebaseConfig } from './config/firebaseConfig'; import rootReducer from './redux/reducers' import HomeScreen from './screens/main/Home_page'; import RoomScreen from './screens/main/RoomScreen'; import Calendario from './screens/main/Calendar'; import Time from './screens/main/StateTime'; import Search from './screens/main/Search'; if (firebase.apps.length === 0) { firebase.initializeApp(firebaseConfig) } const Stack = createStackNavigator(); const Drawer = createDrawerNavigator(); const store = createStore(rootReducer, applyMiddleware(thunk)); 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, }) } }); } createHomeStack = () => render() { const { loggedIn, loaded } = this.state if(!loaded){ return( ); } if(!loggedIn){ return ( ); } return( ({ title: route.params.thread.name })} /> ); } }