Created
August 4, 2020 19:32
-
-
Save popeating/dfc20c620e831d72245e6d0c1ec24803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from 'react'; | |
import { View, StyleSheet } from 'react-native'; | |
import { Text, Button, Title, Paragraph } from 'react-native-paper'; | |
import mainContext from '../context/mainContext'; //Don't forget the context | |
import Firebase from '../Firebase'; | |
import loc from '../utils/localization'; | |
const HomeScreen = () => { | |
const { currentUser } = Firebase.auth(); //we are getting the user from Firebase | |
const { signOutUser } = useContext(mainContext); //we are getting these functions from the context so that can be used here | |
const { inHome } = useContext(mainContext); | |
return ( | |
<View style={styles.container}> | |
<View style={styles.box}> | |
<Title>Home Screen</Title> | |
</View> | |
<View style={styles.box}> | |
<Paragraph>{currentUser.email}</Paragraph> | |
</View> | |
<View style={styles.box}> | |
<Button onPress={() => signOutUser()} mode="contained" icon="logout"> | |
{loc.t('signout')} | |
</Button> | |
</View> | |
<View style={styles.box}> | |
<Button onPress={() => inHome()} icon="camera" mode="contained"> | |
{loc.t('theme')} | |
</Button> | |
</View> | |
</View> | |
); | |
}; | |
const styles = StyleSheet.create({ | |
inputContainer: { | |
width: '80%', | |
marginBottom: 20, | |
}, | |
container: { | |
flex: 1, | |
//backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
box: { | |
marginBottom: 20, | |
}, | |
}); | |
export default HomeScreen; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment