-
Notifications
You must be signed in to change notification settings - Fork 3k
/
RoomAvatar.js
31 lines (26 loc) · 945 Bytes
/
RoomAvatar.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
import React, {PureComponent} from 'react';
import {StyleSheet} from 'react-native';
import PropTypes from 'prop-types';
import ActiveRoomAvatar from '../../assets/images/avatars/room.svg';
import DeletedRoomAvatar from '../../assets/images/avatars/deleted-room.svg';
const propTypes = {
/** Extra styles to pass to Image */
avatarStyle: PropTypes.arrayOf(PropTypes.object),
/** Whether the room this avatar is for is deleted or not */
isArchived: PropTypes.bool,
};
const defaultProps = {
avatarStyle: [],
isArchived: false,
};
class RoomAvatar extends PureComponent {
render() {
return (this.props.isArchived
? <DeletedRoomAvatar style={StyleSheet.flatten(this.props.avatarStyle)} />
: <ActiveRoomAvatar style={StyleSheet.flatten(this.props.avatarStyle)} />
);
}
}
RoomAvatar.defaultProps = defaultProps;
RoomAvatar.propTypes = propTypes;
export default RoomAvatar;