No Description

App.js 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <<<<<<< HEAD
  2. import { StatusBar } from 'expo-status-bar';
  3. import React from 'react';
  4. import { StyleSheet, Text, View } from 'react-native';
  5. export default function App() {
  6. return (
  7. <View style={styles.container}>
  8. <Text>"Hello world!"</Text>
  9. <StatusBar style="auto" />
  10. </View>
  11. );
  12. =======
  13. import React, { Component } from 'react';
  14. import firebase from 'firebase'
  15. import { NavigationContainer } from '@react-navigation/native';
  16. import { createStackNavigator } from '@react-navigation/stack';
  17. import RegisterScreen from './screens/RegisterScreen';
  18. import LoginScreen from './screens/LoginScreen';
  19. import { firebaseConfig } from './config/firebaseConfig';
  20. import { Text, View } from 'react-native';
  21. import { styles } from './config/styles';
  22. /*const seConfig = {
  23. apiKey: "AIzaSyDW-ABAQ3r_WR7C7WC_3VprL77NcAoitJI",
  24. authDomain: "freehand-d8ecd.firebaseapp.com",
  25. projectId: "freehand-d8ecd",
  26. storageBucket: "freehand-d8ecd.appspot.com",
  27. messagingSenderId: "48371388186",
  28. appId: "1:48371388186:web:9a5a4bf1218e17ac6326a3"
  29. };
  30. */
  31. // Initialize Firebase
  32. //const app = firebase.initializeApp(seConfig);
  33. if (firebase.apps.length === 0) {
  34. firebase.initializeApp(firebaseConfig)
  35. >>>>>>> master
  36. }
  37. const Stack = createStackNavigator();
  38. export default class App extends Component {
  39. constructor(props){
  40. super(props);
  41. this.state = {
  42. loaded: false,
  43. }
  44. }
  45. componentDidMount(){
  46. firebase.auth().onAuthStateChanged((user) => {
  47. if (!user){
  48. this.setState({
  49. loggedIn: false,
  50. loaded: true,
  51. })
  52. }
  53. else{
  54. this.setState({
  55. loggedIn: true,
  56. loaded: true,
  57. })
  58. }
  59. })
  60. }
  61. render() {
  62. const { loggedIn, loaded } = this.state
  63. if(!loaded){
  64. return(
  65. <View style={styles.regcontainer}>
  66. <Text>Hopper</Text>
  67. </View>
  68. );
  69. }
  70. if(!loggedIn){
  71. return (
  72. <NavigationContainer>
  73. <Stack.Navigator>
  74. <Stack.Screen name={" "} options={{headerShown: false}} component={LoginScreen}/>
  75. <Stack.Screen name={"Register"} options={{headerTransparent: true, headerTitle: " "}} component={RegisterScreen}/>
  76. </Stack.Navigator>
  77. </NavigationContainer>
  78. );
  79. }
  80. return(
  81. <View style={styles.regcontainer}>
  82. <Text>Cheese</Text>
  83. </View>
  84. );
  85. }
  86. }