diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-20 16:40:31 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-21 16:30:49 -0400 |
commit | bb909b57897b306239f2fa0d18f42342f796c19e (patch) | |
tree | 0ee715332a1f5f3f39d8bcc869e981fbb4989e5d /src/components/common | |
parent | 837783915ed6156a3d6d130d5c44cf810e501994 (diff) |
Revert change to avatar, using another design
# Conflicts:
# src/components/common/Avatar.tsx
Diffstat (limited to 'src/components/common')
-rw-r--r-- | src/components/common/Avatar.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/components/common/Avatar.tsx b/src/components/common/Avatar.tsx index 86ebedf3..fa80f121 100644 --- a/src/components/common/Avatar.tsx +++ b/src/components/common/Avatar.tsx @@ -4,8 +4,8 @@ import {Image, ImageStyle, StyleProp, ImageBackground} from 'react-native'; type AvatarProps = { style: StyleProp<ImageStyle>; uri: string | undefined; - loading: boolean; - loadingStyle: StyleProp<ImageStyle> | undefined; + loading?: boolean; + loadingStyle?: StyleProp<ImageStyle> | undefined; }; const Avatar: FC<AvatarProps> = ({ style, @@ -13,7 +13,7 @@ const Avatar: FC<AvatarProps> = ({ loading = false, loadingStyle, }) => { - return ( + return loading ? ( <ImageBackground style={style} defaultSource={require('../../assets/images/avatar-placeholder.png')} @@ -25,6 +25,12 @@ const Avatar: FC<AvatarProps> = ({ /> )} </ImageBackground> + ) : ( + <Image + defaultSource={require('../../assets/images/avatar-placeholder.png')} + source={{uri, cache: 'reload'}} + style={style} + /> ); }; |