diff options
Diffstat (limited to 'src/components/moments/MomentCommentPreview.tsx')
-rw-r--r-- | src/components/moments/MomentCommentPreview.tsx | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/components/moments/MomentCommentPreview.tsx b/src/components/moments/MomentCommentPreview.tsx index 94fcb008..092f8936 100644 --- a/src/components/moments/MomentCommentPreview.tsx +++ b/src/components/moments/MomentCommentPreview.tsx @@ -3,50 +3,52 @@ import React from 'react'; import {Image, StyleSheet, Text, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; import {useDispatch, useStore} from 'react-redux'; -import {MomentPostType, ScreenType, UserType} from '../../types'; +import {MomentCommentPreviewType, ScreenType, UserType} from '../../types'; import {navigateToProfile, normalize} from '../../utils'; import {mentionPartTypes, renderTextWithMentions} from '../../utils/comments'; interface MomentCommentPreviewProps { - moment: MomentPostType; + momentId: string; + commentsCount: number; + commentPreview: MomentCommentPreviewType | null; screenType: ScreenType; } const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({ - moment, + momentId, + commentsCount, + commentPreview, screenType, }) => { const navigation = useNavigation(); const state = useStore().getState(); const commentCountText = - moment.comments_count === 0 - ? 'No Comments' - : moment.comments_count + ' comments'; + commentsCount === 0 ? 'No Comments' : commentsCount + ' comments'; return ( <TouchableOpacity style={styles.commentsPreviewContainer} onPress={() => navigation.push('MomentCommentsScreen', { - moment_id: moment.moment_id, + moment_id: momentId, screenType, }) }> <Text style={styles.whiteBold}>{commentCountText}</Text> - {moment.comment_preview !== null && ( + {commentPreview !== null && ( <View style={styles.previewContainer}> <Image source={{ - uri: moment.comment_preview.commenter.thumbnail_url, + uri: commentPreview.commenter.thumbnail_url, }} style={styles.avatar} /> <Text style={styles.whiteBold} numberOfLines={1}> <Text> </Text> - <Text>{moment.comment_preview.commenter.username}</Text> + <Text>{commentPreview.commenter.username}</Text> <Text> </Text> {renderTextWithMentions({ - value: moment.comment_preview.comment, + value: commentPreview.comment, styles: styles.normalFont, partTypes: mentionPartTypes('commentPreview'), onPress: (user: UserType) => @@ -88,7 +90,6 @@ const styles = StyleSheet.create({ borderRadius: 99, }, normalFont: { - // top: -5, fontWeight: 'normal', }, }); |