From 64f8829ab55bfe6851f10ca933043877769c56bf Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 26 Mar 2021 17:28:23 -0400 Subject: show taggsbar, prevent taggsbar navigation on profile and SP --- src/components/taggs/Tagg.tsx | 30 +++++++++++++++++------------- src/components/taggs/TaggsBar.tsx | 4 ++++ 2 files changed, 21 insertions(+), 13 deletions(-) (limited to 'src/components/taggs') diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 547a77cb..ae9ab091 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -34,6 +34,7 @@ interface TaggProps { userXId: string | undefined; user: UserType; whiteRing: boolean | undefined; + allowNavigation?: boolean; } const Tagg: React.FC = ({ @@ -45,6 +46,7 @@ const Tagg: React.FC = ({ userXId, user, whiteRing, + allowNavigation = true, }) => { const navigation = useNavigation(); const [modalVisible, setModalVisible] = useState(false); @@ -70,19 +72,21 @@ const Tagg: React.FC = ({ const modalOrAuthBrowserOrPass = async () => { if (youMayPass) { - if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) { - navigation.push('SocialMediaTaggs', { - socialMediaType: social, - userXId, - }); - } else { - getNonIntegratedURL(social, user.userId).then((socialURL) => { - if (socialURL) { - Linking.openURL(socialURL); - } else { - Alert.alert(ERROR_UNABLE_TO_FIND_PROFILE); - } - }); + if (allowNavigation) { + if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) { + navigation.push('SocialMediaTaggs', { + socialMediaType: social, + userXId, + }); + } else { + getNonIntegratedURL(social, user.userId).then((socialURL) => { + if (socialURL) { + Linking.openURL(socialURL); + } else { + Alert.alert(ERROR_UNABLE_TO_FIND_PROFILE); + } + }); + } } } else { if (isIntegrated) { diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index f952c53f..a9c428b2 100644 --- a/src/components/taggs/TaggsBar.tsx +++ b/src/components/taggs/TaggsBar.tsx @@ -22,6 +22,7 @@ interface TaggsBarProps { screenType: ScreenType; whiteRing: boolean | undefined; linkedSocials?: string[]; + allowNavigation?: boolean; } const TaggsBar: React.FC = ({ y, @@ -30,6 +31,7 @@ const TaggsBar: React.FC = ({ screenType, whiteRing, linkedSocials, + allowNavigation = true, }) => { let [taggs, setTaggs] = useState([]); let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true); @@ -79,6 +81,7 @@ const TaggsBar: React.FC = ({ setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} whiteRing={whiteRing ? whiteRing : undefined} + allowNavigation={allowNavigation} />, ); i++; @@ -96,6 +99,7 @@ const TaggsBar: React.FC = ({ userXId={userXId} user={user} whiteRing={whiteRing ? whiteRing : undefined} + allowNavigation={allowNavigation} />, ); i++; -- cgit v1.2.3-70-g09d2