aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/FollowCount.tsx
diff options
context:
space:
mode:
authorKingsley-swe <71396041+Kingsley-swe@users.noreply.github.com>2020-10-24 20:52:28 -0400
committerGitHub <noreply@github.com>2020-10-24 20:52:28 -0400
commit80a5b47d9fef940604d729ff5c428e16aa4be37a (patch)
tree8088322f15e89dd7347b1940cc59ad9efc974bfa /src/components/profile/FollowCount.tsx
parent84d283b44f2b6cecb757edcd94e717a36c3ba3c3 (diff)
[TMA 27] Followers list (#69)
* "Followers list " * Mended followers list * fix export error Co-authored-by: Ashm Walia <ashmwalia@outlook.com> Co-authored-by: Husam Salhab <47015061+hsalhab@users.noreply.github.com>
Diffstat (limited to 'src/components/profile/FollowCount.tsx')
-rw-r--r--src/components/profile/FollowCount.tsx30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/components/profile/FollowCount.tsx b/src/components/profile/FollowCount.tsx
index 72817e7a..a3f9f34d 100644
--- a/src/components/profile/FollowCount.tsx
+++ b/src/components/profile/FollowCount.tsx
@@ -1,12 +1,20 @@
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';
interface FollowCountProps extends ViewProps {
mode: 'followers' | 'following';
count: number;
+ isProfileView: boolean;
}
-const FollowCount: React.FC<FollowCountProps> = ({style, mode, count}) => {
+const FollowCount: React.FC<FollowCountProps> = ({
+ style,
+ mode,
+ count,
+ isProfileView,
+}) => {
const displayed: string =
count < 5e3
? `${count}`
@@ -15,13 +23,21 @@ const FollowCount: React.FC<FollowCountProps> = ({style, mode, count}) => {
: count < 1e6
? `${(count / 1e3).toFixed(0)}k`
: `${count / 1e6}m`;
+ const navigation = useNavigation();
return (
- <View style={[styles.container, style]}>
- <Text style={styles.count}>{displayed}</Text>
- <Text style={styles.label}>
- {mode === 'followers' ? 'Followers' : 'Following'}
- </Text>
- </View>
+ <TouchableOpacity
+ onPress={() =>
+ navigation.navigate('FollowersListScreen', {
+ isProfileView: isProfileView,
+ })
+ }>
+ <View style={[styles.container, style]}>
+ <Text style={styles.count}>{displayed}</Text>
+ <Text style={styles.label}>
+ {mode === 'followers' ? 'Followers' : 'Following'}
+ </Text>
+ </View>
+ </TouchableOpacity>
);
};