/
ChatMessageDate.js
54 lines (47 loc) · 1.19 KB
/
ChatMessageDate.js
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
import React from 'react';
import { View } from 'react-native';
import { withStyles } from '@ui-kitten/components';
import PropTypes from 'prop-types';
import CustomText from '../../../components/Text';
const styles = theme => ({
mainView: {
flex: 1,
flexDirection: 'row',
textAlign: 'center',
alignItems: 'center',
justifyContent: 'center',
},
dateView: {
padding: 8,
marginTop: 2,
marginBottom: 6,
borderRadius: 8,
backgroundColor: theme['color-background-date'],
},
text: {
fontSize: theme['font-size-extra-small'],
},
});
const ChatMessageDateComponent = ({ date, eva: { style } }) => {
return (
<View style={style.mainView}>
<View style={style.dateView}>
<CustomText style={style.text}>{date}</CustomText>
</View>
</View>
);
};
const propTypes = {
date: PropTypes.string,
eva: PropTypes.shape({
style: PropTypes.object,
theme: PropTypes.object,
}).isRequired,
};
const defaultProps = {
date: null,
};
ChatMessageDateComponent.defaultProps = defaultProps;
ChatMessageDateComponent.propTypes = propTypes;
const ChatMessageDate = withStyles(ChatMessageDateComponent, styles);
export default ChatMessageDate;