forked from osdio/noder-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommentOverlay.js
More file actions
82 lines (70 loc) · 1.32 KB
/
CommentOverlay.js
File metadata and controls
82 lines (70 loc) · 1.32 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React, {
View,
StyleSheet,
Component,
Text,
PropTypes
} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import OverlayButton from './base/OverlayButton';
const overlaySize = 45;
const iconSize = 12;
class CommentOverlay extends Component {
static propTypes = {
onPress: PropTypes.func,
replyCount: PropTypes.number
};
static defaultProps = {
replyCount: 0
};
_renderCommentReplyCount(count) {
if (count > 999) {
return '1k+'
}
return count
}
render() {
return (
<OverlayButton
position={styles.position}
onPress={this.props.onPress}>
<View style={styles.content}>
<Icon
name='chatbox'
size={13}
color='white'
style={styles.commentIcon}
/>
<Text style={styles.commentText}>
{this._renderCommentReplyCount(this.props.replyCount)}
</Text>
</View>
</OverlayButton>
)
}
}
const styles = StyleSheet.create({
position: {
right: 20,
bottom: 20
},
commentText: {
textAlign: 'center',
color: 'white',
fontSize: 12,
paddingLeft: 4
},
content: {
height: overlaySize,
width: overlaySize,
borderRadius: overlaySize / 2,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center'
},
commentIcon: {
height: iconSize,
width: iconSize,
}
});
export default CommentOverlay;