2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import FastImage from '@rocket.chat/react-native-fast-image';
|
|
|
|
|
2022-02-17 15:27:01 +00:00
|
|
|
import { ICustomEmoji } from '../../definitions/IEmoji';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
const CustomEmoji = React.memo(
|
|
|
|
({ baseUrl, emoji, style }: ICustomEmoji) => (
|
|
|
|
<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;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
export default CustomEmoji;
|