42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
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';
|
|
import { Provider as PaperProvider } from 'react-native-paper';
|
|
import AwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
|
|
|
export default function App() {
|
|
let [isLoggedIn, setIsLoggedIn] = useState(false);
|
|
|
|
useEffect(async () => {
|
|
let r = await API.isLoggedIn();
|
|
setIsLoggedIn(r);
|
|
}, []);
|
|
|
|
return (
|
|
<PaperProvider settings={{
|
|
icon: props => <AwesomeIcon {...props} />,
|
|
}}>
|
|
<SafeAreaView style={styles.container}>
|
|
<Text>EMI Social LOGO</Text>
|
|
{!isLoggedIn && <LoginForm />}
|
|
{isLoggedIn && <Feed />}
|
|
<StatusBar style="auto" />
|
|
</SafeAreaView>
|
|
</PaperProvider>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
marginTop: 25,
|
|
paddingTop: 10,
|
|
backgroundColor: "#edf2f7"
|
|
},
|
|
});
|