vn-verdnaturachat/app/containers/RoomTypeIcon.js

53 lines
1.5 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { Image, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
2019-04-08 12:35:28 +00:00
import { CustomIcon } from '../lib/Icons';
2019-12-04 16:39:53 +00:00
import { themes } from '../constants/colors';
const styles = StyleSheet.create({
style: {
marginRight: 7,
2019-07-18 17:44:02 +00:00
marginTop: 3
},
2019-04-08 12:35:28 +00:00
discussion: {
marginRight: 6
}
});
2019-12-04 16:39:53 +00:00
const RoomTypeIcon = React.memo(({
type, size, style, theme
}) => {
if (!type) {
return null;
}
2019-12-04 16:39:53 +00:00
const color = themes[theme].auxiliaryText;
2019-04-08 12:35:28 +00:00
if (type === 'discussion') {
// FIXME: These are temporary only. We should have all room icons on <Customicon />, but our design team is still working on this.
2019-12-04 16:39:53 +00:00
return <CustomIcon name='chat' size={13} style={[styles.style, styles.iconColor, styles.discussion, { color }]} />;
2019-04-08 12:35:28 +00:00
}
if (type === 'c') {
2019-12-04 16:39:53 +00:00
return <Image source={{ uri: 'hashtag' }} style={[styles.style, style, { width: size, height: size, tintColor: color }]} />;
2019-07-18 17:44:02 +00:00
} if (type === 'd') {
2019-12-04 16:39:53 +00:00
return <CustomIcon name='at' size={13} style={[styles.style, styles.discussion, { color }]} />;
2020-02-07 13:24:16 +00:00
} if (type === 'l') {
return <CustomIcon name='livechat' size={13} style={[styles.style, styles.discussion, { color }]} />;
}
2019-12-04 16:39:53 +00:00
return <Image source={{ uri: 'lock' }} style={[styles.style, style, { width: size, height: size, tintColor: color }]} />;
});
RoomTypeIcon.propTypes = {
2019-12-04 16:39:53 +00:00
theme: PropTypes.string,
type: PropTypes.string,
size: PropTypes.number,
style: PropTypes.object
};
RoomTypeIcon.defaultProps = {
size: 10
};
export default RoomTypeIcon;