import React from 'react'; import PropTypes from 'prop-types'; import { View, Text, StyleSheet } from 'react-native'; import { CachedImage } from 'react-native-img-cache'; import Markdown from 'react-native-easy-markdown'; import { emojify } from 'react-emojione'; const styles = StyleSheet.create({ message: { padding: 12, paddingTop: 6, paddingBottom: 6, flexDirection: 'row', transform: [{ scaleY: -1 }] }, avatarContainer: { backgroundColor: '#eee', width: 40, height: 40, marginRight: 10, borderRadius: 5 }, avatar: { width: 40, height: 40, borderRadius: 5 }, texts: { flex: 1 }, msg: { flex: 1 }, username: { fontWeight: 'bold', marginBottom: 5 } }); export default class Message extends React.PureComponent { static propTypes = { item: PropTypes.object.isRequired, baseUrl: PropTypes.string.isRequired } render() { const extraStyle = {}; if (this.props.item.temp) { extraStyle.opacity = 0.3; } const msg = emojify(this.props.item.msg || 'asd', { output: 'unicode' }); return ( {this.props.item.u.username} {msg} ); } }