From 49a1412401e99912569748b6f3898f56ee38bf9d Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 31 Mar 2021 16:49:08 -0400 Subject: fixed unable to press --- src/components/taggs/Tagg.tsx | 18 ++++++++++-------- src/components/taggs/TaggsBar.tsx | 12 ++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 4e4987fb..ddb9c264 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -17,13 +17,15 @@ import { registerNonIntegratedSocialLink, } from '../../services'; import {SmallSocialIcon, SocialIcon, SocialLinkModal} from '../common'; -import {UserType} from '../../types'; +import {ScreenType, UserType} from '../../types'; import { ERROR_LINK, ERROR_UNABLE_TO_FIND_PROFILE, SUCCESS_LINK, } from '../../constants/strings'; -import {normalize} from '../../utils'; +import {canViewProfile, normalize} from '../../utils'; +import {RootState} from '../../store/rootReducer'; +import {useStore} from 'react-redux'; interface TaggProps { social: string; @@ -34,7 +36,7 @@ interface TaggProps { userXId: string | undefined; user: UserType; whiteRing: boolean | undefined; - allowNavigation?: boolean; + screenType: ScreenType; } const Tagg: React.FC = ({ @@ -44,11 +46,12 @@ const Tagg: React.FC = ({ setTaggsNeedUpdate, setSocialDataNeedUpdate, userXId, + screenType, user, whiteRing, - allowNavigation = true, }) => { const navigation = useNavigation(); + const state: RootState = useStore().getState(); const [modalVisible, setModalVisible] = useState(false); const youMayPass = isLinked || userXId; @@ -71,9 +74,9 @@ const Tagg: React.FC = ({ */ const modalOrAuthBrowserOrPass = async () => { - if (youMayPass) { + if (youMayPass && canViewProfile(state, userXId, screenType)) { if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) { - navigation.push('SocialMediaTaggs', { + navigation.navigate('SocialMediaTaggs', { socialMediaType: social, userXId, }); @@ -147,8 +150,7 @@ const Tagg: React.FC = ({ + onPress={modalOrAuthBrowserOrPass}> {pickTheRightRingHere()} diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index 567b58de..06acadc1 100644 --- a/src/components/taggs/TaggsBar.tsx +++ b/src/components/taggs/TaggsBar.tsx @@ -2,7 +2,7 @@ import React, {Fragment, useEffect, useState} from 'react'; import {StyleSheet} from 'react-native'; import Animated from 'react-native-reanimated'; import {useSafeAreaInsets} from 'react-native-safe-area-context'; -import {useDispatch, useSelector, useStore} from 'react-redux'; +import {useDispatch, useSelector} from 'react-redux'; import { INTEGRATED_SOCIAL_LIST, PROFILE_CUTOUT_BOTTOM_Y, @@ -12,7 +12,6 @@ import {getLinkedSocials} from '../../services'; import {loadIndividualSocial, updateSocial} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; import {ScreenType} from '../../types'; -import {canViewProfile} from '../../utils'; import Tagg from './Tagg'; const {View, ScrollView, interpolate, Extrapolate} = Animated; @@ -32,15 +31,12 @@ const TaggsBar: React.FC = ({ whiteRing, linkedSocials, }) => { + const dispatch = useDispatch(); let [taggs, setTaggs] = useState([]); let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true); const {user} = useSelector((state: RootState) => userXId ? state.userX[screenType][userXId] : state.user, ); - const state: RootState = useStore().getState(); - const allowTaggsNavigation = canViewProfile(state, userXId, screenType); - - const dispatch = useDispatch(); /** * Updates the individual social that needs update @@ -75,13 +71,13 @@ const TaggsBar: React.FC = ({ key={i} social={social} userXId={userXId} + screenType={screenType} user={user} isLinked={true} isIntegrated={INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1} setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} whiteRing={whiteRing ? whiteRing : undefined} - allowNavigation={allowTaggsNavigation} />, ); i++; @@ -97,9 +93,9 @@ const TaggsBar: React.FC = ({ setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} userXId={userXId} + screenType={screenType} user={user} whiteRing={whiteRing ? whiteRing : undefined} - allowNavigation={allowTaggsNavigation} />, ); i++; -- cgit v1.2.3-70-g09d2 From 097b515066f1a0c38cb7fb69cf78b16b945594e5 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 31 Mar 2021 18:29:33 -0400 Subject: fixed bug --- src/components/taggs/Tagg.tsx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index ddb9c264..5d26539b 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -74,20 +74,22 @@ const Tagg: React.FC = ({ */ const modalOrAuthBrowserOrPass = async () => { - if (youMayPass && canViewProfile(state, userXId, screenType)) { - if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) { - navigation.navigate('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 (youMayPass) { + if (canViewProfile(state, userXId, screenType)) { + if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) { + navigation.navigate('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) { -- cgit v1.2.3-70-g09d2 From 9e3e66575243b11f896a79717be5ab64162a4719 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 9 Apr 2021 17:36:15 -0400 Subject: fixed taggs --- src/components/suggestedPeople/SPTaggsBar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/suggestedPeople/SPTaggsBar.tsx b/src/components/suggestedPeople/SPTaggsBar.tsx index adac6dcf..29c58cce 100644 --- a/src/components/suggestedPeople/SPTaggsBar.tsx +++ b/src/components/suggestedPeople/SPTaggsBar.tsx @@ -70,7 +70,7 @@ const TaggsBar: React.FC = ({ setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} whiteRing={true} - allowNavigation={allowTaggsNavigation} + screenType={screenType} />, ); i++; @@ -88,7 +88,7 @@ const TaggsBar: React.FC = ({ userXId={userXId} user={user} whiteRing={true} - allowNavigation={allowTaggsNavigation} + screenType={screenType} />, ); i++; -- cgit v1.2.3-70-g09d2