diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-18 13:00:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-18 13:00:14 -0400 |
commit | c8487348e1026a3a2c1a147d3eefe3ee0cc6528c (patch) | |
tree | 72061e400748adce01ad90b2b5943e135fa25323 /src/components/common | |
parent | efc84a7a5af59bcaf219d2ecb6767a3b29d01fae (diff) | |
parent | 4aca9fc0916240ce5e4284d625f240998db17bff (diff) |
Merge pull request #429 from brian-tagg/tma844-bugfix-plus-sign
[TMA-844] Plus sign for profile and header in profile
Diffstat (limited to 'src/components/common')
-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> ); }; |