2018-01-16 18:48:05 +00:00
|
|
|
import React from 'react';
|
2018-02-08 14:08:50 +00:00
|
|
|
import { ViewPropTypes } from 'react-native';
|
2018-01-16 18:48:05 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { CachedImage } from 'react-native-img-cache';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
@connect(state => ({
|
|
|
|
baseUrl: state.settings.Site_Url
|
|
|
|
}))
|
2018-02-08 14:08:50 +00:00
|
|
|
export default class CustomEmoji extends React.Component {
|
2018-01-16 18:48:05 +00:00
|
|
|
static propTypes = {
|
|
|
|
baseUrl: PropTypes.string.isRequired,
|
|
|
|
emoji: PropTypes.object.isRequired,
|
2018-02-08 14:08:50 +00:00
|
|
|
style: ViewPropTypes.style
|
2018-01-16 18:48:05 +00:00
|
|
|
}
|
2018-01-30 19:48:26 +00:00
|
|
|
shouldComponentUpdate() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-01-16 18:48:05 +00:00
|
|
|
render() {
|
|
|
|
const { baseUrl, emoji, style } = this.props;
|
|
|
|
return (
|
|
|
|
<CachedImage
|
|
|
|
style={style}
|
2018-01-30 19:48:26 +00:00
|
|
|
source={{ uri: `${ baseUrl }/emoji-custom/${ encodeURIComponent(emoji.content || emoji.name) }.${ emoji.extension }` }}
|
2018-01-16 18:48:05 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|