vn-verdnaturachat/app/containers/message/User.js

67 lines
1.3 KiB
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { View, Text, StyleSheet } from 'react-native';
import moment from 'moment';
const styles = StyleSheet.create({
username: {
color: '#0C0D0F',
fontWeight: '600',
fontSize: 16,
lineHeight: 22
},
usernameView: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: 2
},
alias: {
fontSize: 14,
color: '#9EA2A8',
paddingLeft: 6,
lineHeight: 16
},
time: {
fontSize: 14,
color: '#9EA2A8',
paddingLeft: 10,
fontWeight: '300',
lineHeight: 16
}
});
2017-11-24 20:44:52 +00:00
export default class User extends React.PureComponent {
static propTypes = {
timeFormat: PropTypes.string.isRequired,
username: PropTypes.string,
alias: PropTypes.string,
ts: PropTypes.instanceOf(Date),
temp: PropTypes.bool,
Beta (#265) * Fabric iOS * Fabric configured on iOS and Android * - react-native-fabric configured - login tracked * README updated * Run scripts from README updated * README scripts * get rooms and messages by rest * user status * more improves * more improves * send pong on timeout * fix some methods * more tests * rest messages * Room actions (#266) * Toggle notifications * Search messages * Invite users * Mute/Unmute users in room * rocket.cat messages * Room topic layout fixed * Starred messages loading onEndReached * Room actions onEndReached * Unnecessary login request * Login loading * Login services fixed * User presence layout * ïmproves on room actions view * Removed unnecessary data from SelectedUsersView * load few messages on open room, search message improve * fix loading messages forever * Removed state from search * Custom message time format * secureTextEntry layout * Reduce android app size * Roles subscription fix * Public routes navigation * fix reconnect * - New login/register, login, register * proguard * Login flux * App init/restore * Android layout fixes * Multiple meteor connection requests fixed * Nested attachments * Nested attachments * fix check status * New login layout (#269) * Public routes navigation * New login/register, login, register * Multiple meteor connection requests fixed * Nested attachments * Button component * TextInput android layout fixed * Register fixed * Thinner close modal button * Requests /me after login only one time * Static images moved * fix reconnect * fix ddp * fix custom emoji * New message layout (#273) * Grouping messages * Message layout * Users typing animation * Image attachment layout
2018-04-24 19:34:03 +00:00
onPress: PropTypes.func
}
render() {
const {
username, alias, ts, temp
} = this.props;
const extraStyle = {};
if (temp) {
extraStyle.opacity = 0.3;
}
const aliasUsername = alias ? (<Text style={styles.alias}>@{username}</Text>) : null;
const time = moment(ts).format(this.props.timeFormat);
return (
<View style={styles.usernameView}>
<Text onPress={this.props.onPress} style={styles.username}>
{alias || username}
</Text>
{aliasUsername}
<Text style={styles.time}>{time}</Text>
</View>
);
}
}