aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/taggs/Tagg.tsx18
-rw-r--r--src/components/taggs/TaggsBar.tsx12
2 files changed, 14 insertions, 16 deletions
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<TaggProps> = ({
@@ -44,11 +46,12 @@ const Tagg: React.FC<TaggProps> = ({
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<TaggProps> = ({
*/
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<TaggProps> = ({
<View style={whiteRing ? styles.spcontainer : styles.container}>
<TouchableOpacity
style={styles.iconTap}
- onPress={modalOrAuthBrowserOrPass}
- disabled={!allowNavigation}>
+ onPress={modalOrAuthBrowserOrPass}>
<SocialIcon style={styles.icon} social={social} whiteRing />
{pickTheRightRingHere()}
</TouchableOpacity>
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<TaggsBarProps> = ({
whiteRing,
linkedSocials,
}) => {
+ const dispatch = useDispatch();
let [taggs, setTaggs] = useState<Object[]>([]);
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<TaggsBarProps> = ({
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<TaggsBarProps> = ({
setTaggsNeedUpdate={setTaggsNeedUpdate}
setSocialDataNeedUpdate={handleSocialUpdate}
userXId={userXId}
+ screenType={screenType}
user={user}
whiteRing={whiteRing ? whiteRing : undefined}
- allowNavigation={allowTaggsNavigation}
/>,
);
i++;