2019-03-27 20:06:57 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { StyleSheet } from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2019-03-29 19:36:07 +00:00
|
|
|
import { STATUS_COLORS, COLOR_TEXT_DESCRIPTION, COLOR_WHITE } from '../../../constants/colors';
|
2019-03-27 20:06:57 +00:00
|
|
|
import { CustomIcon } from '../../../lib/Icons';
|
|
|
|
import Status from '../../../containers/Status/Status';
|
|
|
|
import { isIOS } from '../../../utils/deviceInfo';
|
|
|
|
|
|
|
|
const ICON_SIZE = 18;
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
type: {
|
|
|
|
width: ICON_SIZE,
|
|
|
|
height: ICON_SIZE,
|
|
|
|
marginRight: 8,
|
2019-03-29 19:36:07 +00:00
|
|
|
color: isIOS ? COLOR_TEXT_DESCRIPTION : COLOR_WHITE
|
2019-03-27 20:06:57 +00:00
|
|
|
},
|
|
|
|
status: {
|
|
|
|
marginRight: 8
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const Icon = React.memo(({ type, status }) => {
|
|
|
|
if (type === 'd') {
|
|
|
|
return <Status size={10} style={styles.status} status={status} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
const icon = type === 'c' ? 'hashtag' : 'lock';
|
|
|
|
return (
|
|
|
|
<CustomIcon
|
|
|
|
name={icon}
|
|
|
|
size={ICON_SIZE * 1}
|
|
|
|
style={[
|
|
|
|
styles.type,
|
|
|
|
{
|
|
|
|
width: ICON_SIZE * 1,
|
|
|
|
height: ICON_SIZE * 1
|
|
|
|
},
|
|
|
|
type === 'd' && { color: STATUS_COLORS[status] }
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
Icon.propTypes = {
|
|
|
|
type: PropTypes.string,
|
|
|
|
status: PropTypes.string
|
|
|
|
};
|
|
|
|
export default Icon;
|