From 5d5cb7830061661a83d9ee30a24727104212f789 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 17 Jun 2021 23:01:42 -0700 Subject: Add comment count component --- src/components/comments/CommentsCount.tsx | 47 +++++++++++++++++++++++++++++++ src/components/moments/MomentPost.tsx | 15 +++++----- 2 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 src/components/comments/CommentsCount.tsx (limited to 'src') diff --git a/src/components/comments/CommentsCount.tsx b/src/components/comments/CommentsCount.tsx new file mode 100644 index 00000000..cb30fe76 --- /dev/null +++ b/src/components/comments/CommentsCount.tsx @@ -0,0 +1,47 @@ +import {useNavigation} from '@react-navigation/core'; +import React from 'react'; +import {Text} from 'react-native'; +import {TouchableOpacity} from 'react-native-gesture-handler'; +import CommentsIcon from '../../assets/icons/moment-comment-icon.svg'; +import {MomentPostType, ScreenType} from '../../types'; +import {normalize} from '../../utils'; + +interface CommentsCountProps { + moment: MomentPostType; + screenType: ScreenType; +} + +const CommentsCount: React.FC = ({moment, screenType}) => { + const navigation = useNavigation(); + return ( + + navigation.navigate('MomentCommentsScreen', { + moment_id: moment.moment_id, + screenType, + }) + }> + + + {moment.comments_count} + + + ); +}; + +export default CommentsCount; diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx index d87028e3..60cb16fa 100644 --- a/src/components/moments/MomentPost.tsx +++ b/src/components/moments/MomentPost.tsx @@ -83,13 +83,14 @@ const MomentPost: React.FC = ({ moment={moment} tags={tags} /> - + + + ); }; -- cgit v1.2.3-70-g09d2