From a13dcb5110245bb554d79e779c4942e6f5aaf18a Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Tue, 27 Apr 2021 10:46:17 -0400
Subject: refactored avatar

---
 src/components/taggs/TwitterTaggPost.tsx | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

(limited to 'src/components/taggs/TwitterTaggPost.tsx')

diff --git a/src/components/taggs/TwitterTaggPost.tsx b/src/components/taggs/TwitterTaggPost.tsx
index 0a6f53d8..a64fea20 100644
--- a/src/components/taggs/TwitterTaggPost.tsx
+++ b/src/components/taggs/TwitterTaggPost.tsx
@@ -11,7 +11,7 @@ import {
 } from '../../constants';
 import {TwitterPostType} from '../../types';
 import {handleOpenSocialUrlOnBrowser, SCREEN_WIDTH} from '../../utils';
-import {DateLabel, PostCarousel} from '../common';
+import {Avatar, DateLabel, PostCarousel} from '../common';
 
 interface TwitterTaggPostProps {
   ownerHandle: string;
@@ -31,14 +31,7 @@ const TwitterTaggPost: React.FC<TwitterTaggPostProps> = ({
       )}
       {/* Post header (avatar and handle) */}
       <View style={styles.header}>
-        <Image
-          style={styles.avatar}
-          source={
-            post.profile_pic
-              ? {uri: post.profile_pic}
-              : require('../../assets/images/avatar-placeholder.png')
-          }
-        />
+        <Avatar style={styles.avatar} uri={post.profile_pic} />
         <Text
           style={styles.headerText}
           onPress={() => handleOpenSocialUrlOnBrowser(post.handle, 'Twitter')}>
@@ -84,14 +77,7 @@ const TwitterTaggPost: React.FC<TwitterTaggPostProps> = ({
                 <View style={styles.replyHeader}>
                   {post.in_reply_to.text !== 'This tweet is unavailable' && (
                     <>
-                      <Image
-                        style={styles.replyAvatar}
-                        source={
-                          post.in_reply_to.profile_pic
-                            ? {uri: post.in_reply_to.profile_pic}
-                            : require('../../assets/images/avatar-placeholder.png')
-                        }
-                      />
+                      <Avatar style={styles.avatar} uri={post.in_reply_to.profile_pic} />
                       <Text
                         style={styles.replyHandleText}
                         onPress={() =>
-- 
cgit v1.2.3-70-g09d2

