aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/FollowCount.tsx
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2020-11-09 12:16:44 -0800
committerGitHub <noreply@github.com>2020-11-09 15:16:44 -0500
commitf347ef180ece9235380f2225243beddaececa949 (patch)
tree02ae7739ae16f68fb47a574420c1c497fb5f06ac /src/components/profile/FollowCount.tsx
parentd7ed9541f47c22d93c43a32baf3bf33d68d823c8 (diff)
[FOR MASS REVIEW] Multiple contexts(Searched user gets replaced) (#97)
* First commit towards clean code * Tested things * Some final touch * View updates posts * Cleaned up followers / following * You won't believe but it works * Pass avatar uri via props * Small change * Small change * Removed unnecessary jargon Co-authored-by: Ivan Chen <ivan@thetaggid.com>
Diffstat (limited to 'src/components/profile/FollowCount.tsx')
-rw-r--r--src/components/profile/FollowCount.tsx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/components/profile/FollowCount.tsx b/src/components/profile/FollowCount.tsx
index 80d56de4..3e270428 100644
--- a/src/components/profile/FollowCount.tsx
+++ b/src/components/profile/FollowCount.tsx
@@ -2,6 +2,7 @@ import React from 'react';
import {View, Text, StyleSheet, ViewProps} from 'react-native';
import {TouchableOpacity} from 'react-native-gesture-handler';
import {useNavigation} from '@react-navigation/native';
+import {AuthContext, ProfileContext} from '../../routes';
interface FollowCountProps extends ViewProps {
mode: 'followers' | 'following';
@@ -15,6 +16,10 @@ const FollowCount: React.FC<FollowCountProps> = ({
count,
isProfileView,
}) => {
+ const {followers, following} = isProfileView
+ ? React.useContext(ProfileContext)
+ : React.useContext(AuthContext);
+
const navigation = useNavigation();
const displayed: string =
count < 5e3
@@ -28,8 +33,8 @@ const FollowCount: React.FC<FollowCountProps> = ({
<TouchableOpacity
onPress={() =>
navigation.push('FollowersListScreen', {
- isProfileView: isProfileView,
isFollowers: mode === 'followers',
+ list: mode === 'followers' ? followers : following,
})
}>
<View style={[styles.container, style]}>