2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
2022-05-31 16:08:18 +00:00
|
|
|
import FastImage from 'react-native-fast-image';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
2022-06-27 21:27:22 +00:00
|
|
|
import { ICustomEmoji } from '../../definitions';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
const CustomEmoji = React.memo(
|
2022-06-27 21:27:22 +00:00
|
|
|
({ baseUrl, emoji, style, testID }: ICustomEmoji) => (
|
2021-09-13 20:41:05 +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}
|
2022-06-27 21:27:22 +00:00
|
|
|
testID={testID}
|
2021-09-13 20:41:05 +00:00
|
|
|
/>
|
|
|
|
),
|
|
|
|
(prevProps, nextProps) => {
|
|
|
|
const prevEmoji = prevProps.emoji.content || prevProps.emoji.name;
|
|
|
|
const nextEmoji = nextProps.emoji.content || nextProps.emoji.name;
|
|
|
|
return prevEmoji === nextEmoji;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
export default CustomEmoji;
|