first commit in repo
This commit is contained in:
40
App.js
40
App.js
@@ -1,21 +1,33 @@
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import React from 'react';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { StyleSheet, Text, View, TextInput } from 'react-native';
|
||||
import API from './API.js';
|
||||
import LoginForm from './components/Login.js';
|
||||
import Feed from './components/Feed.js';
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text>Open up App.js to start working on your app!</Text>
|
||||
<StatusBar style="auto" />
|
||||
</View>
|
||||
);
|
||||
let [isLoggedIn, setIsLoggedIn] = useState(false);
|
||||
|
||||
useEffect(async () => {
|
||||
let r = await API.isLoggedIn();
|
||||
setIsLoggedIn(r);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text>EMI Social LOGO</Text>
|
||||
{!isLoggedIn && <LoginForm />}
|
||||
{isLoggedIn && <Feed />}
|
||||
<StatusBar style="auto" />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#fff',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#fff',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user