diff options
author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2020-11-02 10:22:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 13:22:38 -0500 |
commit | eba538802b4cb82d3ed8e0065eb848e78d0ac458 (patch) | |
tree | 9b94ab86200cc055a6fbc057f41498ecc731db14 /src/screens | |
parent | c115fd43c8adb31f1266306974711a3bbe18d20c (diff) |
[TMA - 324] Display the correct profile picture when viewing someone's Taggs. (#88)
* Display the correct profile picture when viewing someone's profile
* sc
Diffstat (limited to 'src/screens')
-rw-r--r-- | src/screens/profile/SocialMediaTaggs.tsx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx index f43c30df..34ad7f48 100644 --- a/src/screens/profile/SocialMediaTaggs.tsx +++ b/src/screens/profile/SocialMediaTaggs.tsx @@ -1,8 +1,9 @@ import {RouteProp} from '@react-navigation/native'; -import React from 'react'; +import React, {useEffect} from 'react'; import {ScrollView, StatusBar, StyleSheet, View} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import { + AvatarTitle, SocialMediaInfo, TabsGradient, TaggPost, @@ -12,17 +13,27 @@ import {AVATAR_GRADIENT} from '../../constants'; import {AuthContext, ProfileContext, ProfileStackParams} from '../../routes'; import {SimplePostType, TwitterPostType} from '../../types'; import {headerBarHeightWithImage, SCREEN_HEIGHT} from '../../utils'; +import {StackNavigationProp} from '@react-navigation/stack'; type SocialMediaTaggsRouteProp = RouteProp< ProfileStackParams, 'SocialMediaTaggs' >; +type SocialMediaTaggsNavigationProp = StackNavigationProp< + ProfileStackParams, + 'SocialMediaTaggs' +>; + interface SocialMediaTaggsProps { route: SocialMediaTaggsRouteProp; + navigation: SocialMediaTaggsNavigationProp; } -const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({route}) => { +const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ + route, + navigation, +}) => { const {socialMediaType, isProfileView} = route.params; const context = isProfileView ? React.useContext(ProfileContext) @@ -34,6 +45,18 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({route}) => { const headerHeight = headerBarHeightWithImage(); let accountData = socialAccounts[socialMediaType]; + /** + * Skip setting the header while defining routes and instead let the component itself handle it. + * This lets us pass props dynamically to the header. + */ + useEffect(() => { + navigation.setOptions({ + headerTitle: () => { + return <AvatarTitle isProfileView={isProfileView} />; + }, + }); + }, []); + return ( <LinearGradient useAngle={true} |