diff options
Diffstat (limited to 'src/components/taggs')
-rw-r--r-- | src/components/taggs/TaggsBar.tsx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index a9c428b2..567b58de 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} from 'react-redux'; +import {useDispatch, useSelector, useStore} from 'react-redux'; import { INTEGRATED_SOCIAL_LIST, PROFILE_CUTOUT_BOTTOM_Y, @@ -12,6 +12,7 @@ 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; @@ -22,7 +23,6 @@ interface TaggsBarProps { screenType: ScreenType; whiteRing: boolean | undefined; linkedSocials?: string[]; - allowNavigation?: boolean; } const TaggsBar: React.FC<TaggsBarProps> = ({ y, @@ -31,14 +31,14 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ screenType, whiteRing, linkedSocials, - allowNavigation = true, }) => { let [taggs, setTaggs] = useState<Object[]>([]); let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true); - - const {user} = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.user); + 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(); @@ -81,7 +81,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} whiteRing={whiteRing ? whiteRing : undefined} - allowNavigation={allowNavigation} + allowNavigation={allowTaggsNavigation} />, ); i++; @@ -99,7 +99,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ userXId={userXId} user={user} whiteRing={whiteRing ? whiteRing : undefined} - allowNavigation={allowNavigation} + allowNavigation={allowTaggsNavigation} />, ); i++; |