From ab7fa09af967e0a8cf2ca53dfb24f8bc8a6886f7 Mon Sep 17 00:00:00 2001
From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com>
Date: Sun, 18 Oct 2020 16:37:32 -0700
Subject: [TMA 279] Ability to search and view someone's profile (#58)

* Batch one : major changes

* WIP checkpoint

* The one before the final touch

* Probable final touch

* ran yarn lint D:

* linter broke something

* fixed a small bug

* Addressed a small nitpick

* Well abstracted now

Co-authored-by: Ivan Chen <ivan@thetaggid.com>
---
 src/components/common/AvatarTitle.tsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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

diff --git a/src/components/common/AvatarTitle.tsx b/src/components/common/AvatarTitle.tsx
index 8c82dca9..e9998113 100644
--- a/src/components/common/AvatarTitle.tsx
+++ b/src/components/common/AvatarTitle.tsx
@@ -2,13 +2,19 @@ import React from 'react';
 import {Image, StyleSheet} from 'react-native';
 import LinearGradient from 'react-native-linear-gradient';
 import {AVATAR_DIM, AVATAR_GRADIENT_DIM, TAGGS_GRADIENT} from '../../constants';
-import {AuthContext} from '../../routes/authentication';
+import {AuthContext, ProfileContext} from '../../routes/';
 
 /**
  * An image component that returns the <Image> of the icon for a specific social media platform.
  */
-const AvatarTitle: React.FC = () => {
-  const {avatar} = React.useContext(AuthContext);
+
+type AvatarTitleProps = {
+  isProfileView: boolean;
+};
+const AvatarTitle: React.FC<AvatarTitleProps> = ({isProfileView}) => {
+  const {avatar} = isProfileView
+    ? React.useContext(ProfileContext)
+    : React.useContext(AuthContext);
   return (
     <LinearGradient
       colors={[TAGGS_GRADIENT.start, TAGGS_GRADIENT.end]}
-- 
cgit v1.2.3-70-g09d2

