diff options
Diffstat (limited to 'src/components/common/Avatar.tsx')
-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> ); }; |