Some UI improvements

This commit is contained in:
Adolfo Reyna
2023-07-17 17:08:32 -04:00
parent 940bd14d6e
commit 919cd4be3b
3 changed files with 70 additions and 45 deletions
+7 -4
View File
@@ -2,12 +2,13 @@ import React, { useState, useEffect } from 'react';
import { Avatar } from 'react-native-paper';
import { View, StyleSheet, Text } from 'react-native';
import API from './../API.js';
import { useNavigation } from '@react-navigation/native';
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
const ProfileHeader = ({ profileid, withName = false, small = false }) => {
let [profile, setProfile] = useState({});
const navigation = useNavigation();
useEffect(() => {
let subscribed = true;
let getData = async () => {
@@ -22,14 +23,16 @@ const ProfileHeader = ({ profileid, withName = false, small = false }) => {
}, [profileid]);
let photoUrl = profile.profile && profile.profile.photo ? 'https://social.emmint.com/' + profile.profile.photo : DefaultPhoto;
const fullName = " " + profile.profile?.firstName + " " + profile.profile?.lastName;
console.log(photoUrl);
const onPress = () => {
return navigation.navigate('Profile', { profileid })
}
return (
<View style={styles.container}>
<View style={styles.avatarContainer}>
<Avatar.Image size={small ? 20 : 30} source={{ uri: photoUrl }} />
<Avatar.Image size={small ? 20 : 30} source={{ uri: photoUrl }} onPress={onPress} />
</View>
<View style={styles.textContainer}>
<Text style={small ? styles.smallProfileName : styles.profileName}>{fullName}</Text>
<Text style={small ? styles.smallProfileName : styles.profileName} onPress={onPress}>{fullName}</Text>
</View>
</View>
);