2018-01-16 18:48:05 +00:00
|
|
|
import React from 'react';
|
2020-07-17 17:39:06 +00:00
|
|
|
import FastImage from '@rocket.chat/react-native-fast-image';
|
2021-07-19 15:06:45 +00:00
|
|
|
import {TEmoji} from "./index";
|
2018-01-16 18:48:05 +00:00
|
|
|
|
2021-07-15 23:15:59 +00:00
|
|
|
interface ICustomEmoji {
|
|
|
|
baseUrl: string,
|
2021-07-19 15:06:45 +00:00
|
|
|
emoji: TEmoji,
|
2021-07-15 23:15:59 +00:00
|
|
|
style: any
|
|
|
|
}
|
|
|
|
|
|
|
|
const CustomEmoji = React.memo(({ baseUrl, emoji, style }: ICustomEmoji) => (
|
2019-09-27 19:17:29 +00:00
|
|
|
<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
|
|
|
export default CustomEmoji;
|