Gracefully handle backend failures in Expo app

This commit is contained in:
Adolfo Reyna
2026-02-20 19:25:38 -05:00
parent fe9fc8e3e4
commit 009f1ec792
14 changed files with 205 additions and 97 deletions

View File

@@ -6,12 +6,14 @@ import UserName from './UserName';
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
const ProfileSmallHeader = ({ profileObj }) => {
let photoUrl = profileObj.profile.photo ? 'https://social.emmint.com/' + profileObj.profile.photo : DefaultPhoto;
const safeProfileObj = profileObj || {};
const safeProfile = safeProfileObj.profile || {};
let photoUrl = safeProfile.photo ? 'https://social.emmint.com/' + safeProfile.photo : DefaultPhoto;
return (
<>
<Card.Title
title={<UserName profileid={profileObj._id} hideIcon={true} />}
subtitle={profileObj.profile.description}
title={<UserName profileid={safeProfileObj._id} hideIcon={true} />}
subtitle={safeProfile.description || ""}
left={(props) => <Avatar.Image {...props} source={{ uri: photoUrl}} />}
right={(props) => <IconButton {...props} icon="more-vert" onPress={() => { }} />}
/>
@@ -20,4 +22,4 @@ const ProfileSmallHeader = ({ profileObj }) => {
}
export default React.memo(ProfileSmallHeader);
export default React.memo(ProfileSmallHeader);