Created
April 2, 2020 22:12
-
-
Save asumansenol/f8038bbcd79e0da4fdeaf870975ce1dc 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 from 'react'; | |
import { StyleSheet, Text, View, SafeAreaView, Button } from 'react-native'; | |
import firebase from 'firebase'; | |
class HomeScreen extends React.Component { | |
state = { user: {} }; | |
componentDidMount() { | |
firebase.auth().onAuthStateChanged((user) => { | |
if (user != null) { | |
this.setState({user: user}); | |
} | |
}) | |
} | |
render() { | |
return ( | |
<SafeAreaView style={{ flex: 1 }}> | |
<View style={styles.container}> | |
<Text>{this.state.user.email}</Text> | |
<Button title="Log Off" onPress={() => { | |
firebase.auth().signOut(); | |
/* analytics.identify("test", { | |
email: "this.state.email" | |
});*/ | |
}}/> | |
</View> | |
</SafeAreaView> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
alignItems: 'center', | |
justifyContent: 'center' | |
} | |
}); | |
export default HomeScreen; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment