2018-01-16 18:48:05 +00:00
|
|
|
import React from 'react';
|
2019-09-17 13:18:36 +00:00
|
|
|
import FastImage from 'react-native-fast-image';
|
2018-01-16 18:48:05 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
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,
|
2019-05-22 20:15:35 +00:00
|
|
|
style: PropTypes.any
|
2018-01-16 18:48:05 +00:00
|
|
|
}
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2018-01-30 19:48:26 +00:00
|
|
|
shouldComponentUpdate() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2018-01-16 18:48:05 +00:00
|
|
|
render() {
|
|
|
|
const { baseUrl, emoji, style } = this.props;
|
|
|
|
return (
|
2019-09-17 13:18:36 +00:00
|
|
|
<FastImage
|
2018-01-16 18:48:05 +00:00
|
|
|
style={style}
|
2019-09-17 13:18:36 +00:00
|
|
|
source={{
|
|
|
|
uri: `${ baseUrl }/emoji-custom/${ encodeURIComponent(emoji.content || emoji.name) }.${ emoji.extension }`,
|
|
|
|
priority: FastImage.priority.high
|
|
|
|
}}
|
|
|
|
resizeMode={FastImage.resizeMode.contain}
|
2018-01-16 18:48:05 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|