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';
|
|
|
|
|
2019-09-27 19:17:29 +00:00
|
|
|
const CustomEmoji = React.memo(({ baseUrl, emoji, style }) => (
|
|
|
|
<FastImage
|
|
|
|
style={style}
|
|
|
|
source={{
|
|
|
|
uri: `${ baseUrl }/emoji-custom/${ encodeURIComponent(emoji.content || emoji.name) }.${ emoji.extension }`,
|
|
|
|
priority: FastImage.priority.high
|
|
|
|
}}
|
|
|
|
resizeMode={FastImage.resizeMode.contain}
|
|
|
|
/>
|
|
|
|
), (prevProps, nextProps) => {
|
|
|
|
const prevEmoji = prevProps.emoji.content || prevProps.emoji.name;
|
|
|
|
const nextEmoji = nextProps.emoji.content || nextProps.emoji.name;
|
|
|
|
return prevEmoji === nextEmoji;
|
|
|
|
});
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2019-09-27 19:17:29 +00:00
|
|
|
CustomEmoji.propTypes = {
|
|
|
|
baseUrl: PropTypes.string.isRequired,
|
|
|
|
emoji: PropTypes.object.isRequired,
|
|
|
|
style: PropTypes.any
|
|
|
|
};
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2019-09-27 19:17:29 +00:00
|
|
|
export default CustomEmoji;
|