2018-05-18 16:41:47 +00:00
|
|
|
import React from 'react';
|
2018-08-31 16:46:33 +00:00
|
|
|
import { Image, StyleSheet } from 'react-native';
|
2018-05-18 16:41:47 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2019-04-08 12:35:28 +00:00
|
|
|
import { CustomIcon } from '../lib/Icons';
|
|
|
|
import { COLOR_TEXT_DESCRIPTION } from '../constants/colors';
|
2018-05-18 16:41:47 +00:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
2018-08-31 16:46:33 +00:00
|
|
|
style: {
|
|
|
|
marginRight: 7,
|
2019-07-18 17:44:02 +00:00
|
|
|
marginTop: 3
|
|
|
|
},
|
|
|
|
imageColor: {
|
|
|
|
tintColor: COLOR_TEXT_DESCRIPTION
|
|
|
|
},
|
|
|
|
iconColor: {
|
2019-04-08 12:35:28 +00:00
|
|
|
color: COLOR_TEXT_DESCRIPTION
|
|
|
|
},
|
|
|
|
discussion: {
|
|
|
|
marginRight: 6
|
2018-05-18 16:41:47 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-03-01 16:49:11 +00:00
|
|
|
const RoomTypeIcon = React.memo(({ type, size, style }) => {
|
2018-05-24 20:17:45 +00:00
|
|
|
if (!type) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
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-07-18 17:44:02 +00:00
|
|
|
return <CustomIcon name='chat' size={13} style={[styles.style, styles.iconColor, styles.discussion]} />;
|
2019-04-08 12:35:28 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 16:46:33 +00:00
|
|
|
if (type === 'c') {
|
2019-07-18 17:44:02 +00:00
|
|
|
return <Image source={{ uri: 'hashtag' }} style={[styles.style, styles.imageColor, style, { width: size, height: size }]} />;
|
|
|
|
} if (type === 'd') {
|
|
|
|
return <CustomIcon name='at' size={13} style={[styles.style, styles.iconColor, styles.discussion]} />;
|
2018-08-31 16:46:33 +00:00
|
|
|
}
|
2019-07-18 17:44:02 +00:00
|
|
|
return <Image source={{ uri: 'lock' }} style={[styles.style, styles.imageColor, style, { width: size, height: size }]} />;
|
2019-03-01 16:49:11 +00:00
|
|
|
});
|
2018-05-18 16:41:47 +00:00
|
|
|
|
|
|
|
RoomTypeIcon.propTypes = {
|
2018-05-24 20:17:45 +00:00
|
|
|
type: PropTypes.string,
|
2018-08-31 16:46:33 +00:00
|
|
|
size: PropTypes.number,
|
|
|
|
style: PropTypes.object
|
2018-05-18 16:41:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
RoomTypeIcon.defaultProps = {
|
2018-08-31 16:46:33 +00:00
|
|
|
size: 10
|
2018-05-18 16:41:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default RoomTypeIcon;
|