From f347ef180ece9235380f2225243beddaececa949 Mon Sep 17 00:00:00 2001 From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com> Date: Mon, 9 Nov 2020 12:16:44 -0800 Subject: [FOR MASS REVIEW] Multiple contexts(Searched user gets replaced) (#97) * First commit towards clean code * Tested things * Some final touch * View updates posts * Cleaned up followers / following * You won't believe but it works * Pass avatar uri via props * Small change * Small change * Removed unnecessary jargon Co-authored-by: Ivan Chen --- src/components/taggs/Tagg.tsx | 12 +++++++++++- src/components/taggs/TaggsBar.tsx | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/components/taggs') diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 9418405d..d9c35b27 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -1,5 +1,5 @@ import {useNavigation} from '@react-navigation/native'; -import React, {Fragment, useState} from 'react'; +import React, {Fragment, useContext, useState} from 'react'; import {Alert, Linking, StyleSheet, TouchableOpacity, View} from 'react-native'; import PurpleRingPlus from '../../assets/icons/purple_ring+.svg'; import PurpleRing from '../../assets/icons/purple_ring.svg'; @@ -16,6 +16,7 @@ import { registerNonIntegratedSocialLink, } from '../../services'; import {SocialIcon, SocialLinkModal} from '../common'; +import {AuthContext, ProfileContext} from '../../routes'; interface TaggProps { social: string; @@ -39,6 +40,11 @@ const Tagg: React.FC = ({ const navigation = useNavigation(); const [modalVisible, setModalVisible] = useState(false); const youMayPass = isLinked || isProfileView; + const { + profile: {name}, + socialAccounts, + avatar, + } = isProfileView ? useContext(ProfileContext) : useContext(AuthContext); /* case isProfileView: @@ -64,6 +70,10 @@ const Tagg: React.FC = ({ navigation.push('SocialMediaTaggs', { socialMediaType: social, isProfileView: isProfileView, + userId: userId, + name: name, + accountData: socialAccounts[social], + avatar: avatar, }); } else { getNonIntegratedURL(social, userId).then((socialURL) => { diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index f2622011..aac68e99 100644 --- a/src/components/taggs/TaggsBar.tsx +++ b/src/components/taggs/TaggsBar.tsx @@ -79,7 +79,8 @@ const TaggsBar: React.FC = ({ * TODO : Figure out a better way to get the updates social posts for the profile being visited. * Have an event triggered from ProfileProvider based on which we could make a call to backedn to get updated posts. */ - socialsNeedUpdate(INTEGRATED_SOCIAL_LIST); + //We may need the line below in future ? + // socialsNeedUpdate(INTEGRATED_SOCIAL_LIST); loadData(); } }, [isProfileView, taggsNeedUpdate, user.userId]); -- cgit v1.2.3-70-g09d2