Files
EMI-ExpoAPP/components/UserName.js
2022-03-05 23:51:26 -08:00

23 lines
598 B
JavaScript

import React, { useState, useEffect } from 'react';
import { Text, View, ScrollView, Button, StyleSheet } from 'react-native';
import API from './../API.js';
let UserName = (props) => {
let [profile, setProfile] = useState({});
useEffect(async () => {
let p = await API.getUserProfile(props.profileid).catch(()=>{return {}});
setProfile(p);
}, [props.profileid]);
return (
<Text>{profile.profile && profile.profile.firstName} {profile.profile && profile.profile.lastName}</Text>
);
}
export default UserName;
const styles = StyleSheet.create({
});