From aeb79eb45499edbd71ed799a8bdc0ca6a566ab58 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 09:49:04 -0700 Subject: fixed --- src/components/profile/Friends.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index d87b0fb0..0f5596d5 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -26,12 +26,10 @@ interface FriendsProps { } const Friends: React.FC = ({result, screenType, userId}) => { + const state: RootState = useStore().getState(); const dispatch = useDispatch(); + const {user: loggedInUser = NO_USER} = state; const navigation = useNavigation(); - const {user: loggedInUser = NO_USER} = useSelector( - (state: RootState) => state.user, - ); - const state = useStore().getState(); const [usersFromContacts, setUsersFromContacts] = useState< ProfilePreviewType[] >([]); @@ -141,7 +139,7 @@ const Friends: React.FC = ({result, screenType, userId}) => { screenType={screenType} /> - {loggedInUser.userId !== userId && ( + {loggedInUser.userId === userId && ( -- cgit v1.2.3-70-g09d2 From 65c5c5c461aa2a0551881774a16e4273c2d11023 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 10:02:31 -0700 Subject: adjusted find friends --- src/components/profile/Friends.tsx | 67 ++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 0f5596d5..51ba6c64 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -86,42 +86,39 @@ const Friends: React.FC = ({result, screenType, userId}) => { return ( <> - {loggedInUser.userId === userId || - (userId === undefined && ( - - - Add Friends - { - const permission = await checkPermission(); - if (permission === 'authorized') { - navigation.navigate('InviteFriendsScreen', { - screenType: ScreenType.Profile, - }); - } else { - Alert.alert( - '"Tagg" Would Like to Access Your Contacts', - 'This helps you quickly get in touch with friends on the app and more', - [ - { - text: "Don't Allow", - style: 'cancel', - }, - {text: 'Allow', onPress: () => Linking.openSettings()}, - ], - ); - } - }}> - - - Find Friends - - - - + {loggedInUser.userId === userId && ( + + + Add Friends + { + const permission = await checkPermission(); + if (permission === 'authorized') { + navigation.navigate('InviteFriendsScreen', { + screenType: ScreenType.Profile, + }); + } else { + Alert.alert( + '"Tagg" Would Like to Access Your Contacts', + 'This helps you quickly get in touch with friends on the app and more', + [ + { + text: "Don't Allow", + style: 'cancel', + }, + {text: 'Allow', onPress: () => Linking.openSettings()}, + ], + ); + } + }}> + + Find Friends + - ))} + + + )} Friends -- cgit v1.2.3-70-g09d2