diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-19 17:37:03 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-19 17:37:03 -0400 |
commit | 2531a2b672bb60e871d419453ae8558f0869bce3 (patch) | |
tree | b23f79f6378384cffff9e032d12066014e9dafff /src/components/common/Avatar.tsx | |
parent | 1a4113ee3e47be229e28fc5a935ada174781b00b (diff) | |
parent | cddcfef3c32e08aedef1e4908bd477e45bef1974 (diff) |
Merge branch 'master' into tma858-remind-users
# Conflicts:
# src/components/friends/InviteFriendTile.tsx
Diffstat (limited to 'src/components/common/Avatar.tsx')
-rw-r--r-- | src/components/common/Avatar.tsx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/components/common/Avatar.tsx b/src/components/common/Avatar.tsx index 831cf906..86ebedf3 100644 --- a/src/components/common/Avatar.tsx +++ b/src/components/common/Avatar.tsx @@ -1,17 +1,30 @@ import React, {FC} from 'react'; -import {Image, ImageStyle, StyleProp} from 'react-native'; +import {Image, ImageStyle, StyleProp, ImageBackground} from 'react-native'; type AvatarProps = { style: StyleProp<ImageStyle>; uri: string | undefined; + loading: boolean; + loadingStyle: StyleProp<ImageStyle> | undefined; }; -const Avatar: FC<AvatarProps> = ({style, uri}) => { +const Avatar: FC<AvatarProps> = ({ + style, + uri, + loading = false, + loadingStyle, +}) => { return ( - <Image + <ImageBackground style={style} defaultSource={require('../../assets/images/avatar-placeholder.png')} - source={{uri, cache: 'reload'}} - /> + source={{uri, cache: 'reload'}}> + {loading && ( + <Image + source={require('../../assets/gifs/loading-animation.gif')} + style={loadingStyle} + /> + )} + </ImageBackground> ); }; |