1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import {useNavigation} from '@react-navigation/native';
import React from 'react';
import {StyleSheet, Text} from 'react-native';
import {TouchableOpacity} from 'react-native-gesture-handler';
import {MomentPostType, ScreenType} from '../../types';
import {normalize} from '../../utils';
interface MomentCommentPreviewProps {
moment: MomentPostType;
screenType: ScreenType;
}
const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({
moment,
screenType,
}) => {
const navigation = useNavigation();
const commentCountText =
moment.comments_count === 0
? 'No Comments'
: moment.comments_count + ' comments';
return (
<TouchableOpacity
style={styles.commentsPreviewContainer}
onPress={() =>
navigation.push('MomentCommentsScreen', {
moment_id: moment.moment_id,
screenType,
})
}>
<Text style={styles.commentCount}>{commentCountText}</Text>
<Text>TODO: Add comment preview here</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
commentsPreviewContainer: {
flexDirection: 'column',
marginHorizontal: '5%',
marginBottom: '2%',
borderWidth: 1,
},
commentCount: {
fontWeight: '700',
color: 'white',
fontSize: normalize(12),
},
});
export default MomentCommentPreview;
|