35 lines
944 B
JavaScript
35 lines
944 B
JavaScript
import { StatusBar } from 'expo-status-bar';
|
|
import React, { useEffect, useState } from 'react';
|
|
import { StyleSheet, Text, View, TextInput, SafeAreaView } 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 (
|
|
<SafeAreaView style={styles.container}>
|
|
<Text>EMI Social LOGO</Text>
|
|
{!isLoggedIn && <LoginForm />}
|
|
{isLoggedIn && <Feed />}
|
|
<StatusBar style="auto" />
|
|
</SafeAreaView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: '#fff',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
marginTop: 30,
|
|
},
|
|
});
|