Using Redux, firebase, and react native when a user successfully signs in I want to retrieve and display a user's first name from firebase.
Instead of hard coding a temp name inside my Account.js file, I want to display a user's first name. I don't know the proper syntax to do this and I'm not sure if this requires Redux but if it does I definitely require help haha.
If I can see how this is done I can figure out how to to fetch and display other user information like address, inventory, and etc.
'SignInScreen.js'
firebase
.auth()
.signInAndRetrieveDataWithCredential(credential)
.then((result) => {
console.log('User is signed in');
if (result.additionalUserInfo.isNewUser)
{
firebase
.database()
.ref(/users/${result.user.uid}
)
.set({
gmail: result.user.email,
profile_picture: result.additionalUserInfo.profile.picture,
locale: result.additionalUserInfo.profile.locale,
first_name: result.additionalUserInfo.profile.given_name,
last_name: result.additionalUserInfo.profile.family_name,
created_at: Date.now()
})
'Account.js'
render() {
const {
navigation: { navigate }
} = this.props;
return (
style={[commonStyles.alignSelfcenter, {
...ifIphoneX(
{marginTop: 50},
{ marginTop: 30} )
}]}
>
style={[
styles.TextColor,
commonStyles.font18,
commonStyles.textBold
]}
>
My Account
/>
style={[
commonStyles.textWhite,
commonStyles.font16,
commonStyles.textBold
]}
>
Hussnain_sarwar(Temp Name)
Top comments (0)