diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-20 16:40:31 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-20 16:40:31 -0400 |
commit | e797361b81778a08de2bc81038196ba62126fc59 (patch) | |
tree | ddae3b099e281c3d4e3b7b2841886e07f41b700a /src/components/common | |
parent | 3fd9c10aadb874a0fd0c0c206c8a4a9d83e939a0 (diff) |
Revert change to avatar, using another design
Diffstat (limited to 'src/components/common')
-rw-r--r-- | src/components/common/Avatar.tsx | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/components/common/Avatar.tsx b/src/components/common/Avatar.tsx index 46a3814c..fa80f121 100644 --- a/src/components/common/Avatar.tsx +++ b/src/components/common/Avatar.tsx @@ -4,28 +4,33 @@ 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, uri, - // loading = false, - // loadingStyle, + loading = false, + loadingStyle, }) => { - return ( - // <ImageBackground - // style={style} - // defaultSource={require('../../assets/images/avatar-placeholder.png')} - // source={{uri, cache: 'reload'}}> - // {loading && ( + return loading ? ( + <ImageBackground + style={style} + defaultSource={require('../../assets/images/avatar-placeholder.png')} + source={{uri, cache: 'reload'}}> + {loading && ( + <Image + source={require('../../assets/gifs/loading-animation.gif')} + style={loadingStyle} + /> + )} + </ImageBackground> + ) : ( <Image defaultSource={require('../../assets/images/avatar-placeholder.png')} source={{uri, cache: 'reload'}} style={style} /> - // )} - // </ImageBackground> ); }; |