123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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';
-
-
- /*const seConfig = {
- apiKey: "AIzaSyDW-ABAQ3r_WR7C7WC_3VprL77NcAoitJI",
- authDomain: "freehand-d8ecd.firebaseapp.com",
- projectId: "freehand-d8ecd",
- storageBucket: "freehand-d8ecd.appspot.com",
- messagingSenderId: "48371388186",
- appId: "1:48371388186:web:9a5a4bf1218e17ac6326a3"
- };
- */
- // Initialize Firebase
- //const app = firebase.initializeApp(seConfig);
- 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(
- <View style={styles.regcontainer}>
- <Text>Hopper</Text>
- </View>
- );
- }
-
- if(!loggedIn){
- return (
- <NavigationContainer>
- <Stack.Navigator>
- <Stack.Screen name={" "} options={{headerShown: false}} component={LoginScreen}/>
- <Stack.Screen name={"Register"} options={{headerTransparent: true, headerTitle: " "}} component={RegisterScreen}/>
- </Stack.Navigator>
- </NavigationContainer>
- );
- }
-
- return(
- <View style={styles.regcontainer}>
- <Text>Cheese</Text>
- </View>
- );
- }
- }
|