From 37b37f296a59aea43e73f615ae6cb042b2242e87 Mon Sep 17 00:00:00 2001
From: Brian Kim <brian@tagg.id>
Date: Fri, 14 May 2021 19:33:03 -0700
Subject: Bug fixes

---
 src/components/common/Avatar.tsx | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

(limited to 'src/components/common/Avatar.tsx')

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>
   );
 };
 
-- 
cgit v1.2.3-70-g09d2

