Files
EMI-ExpoAPP/App.js
2022-03-05 20:51:45 -08:00

34 lines
891 B
JavaScript

import { StatusBar } from 'expo-status-bar';
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() {
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',
},
});