2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Text } from 'react-native';
|
|
|
|
|
2022-06-06 14:17:51 +00:00
|
|
|
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
|
2021-09-13 20:41:05 +00:00
|
|
|
import CustomEmoji from '../EmojiPicker/CustomEmoji';
|
|
|
|
import { IMessageEmoji } from './interfaces';
|
|
|
|
|
|
|
|
const Emoji = React.memo(
|
|
|
|
({ content, baseUrl, standardEmojiStyle, customEmojiStyle, getCustomEmoji }: IMessageEmoji) => {
|
|
|
|
const parsedContent = content.replace(/^:|:$/g, '');
|
|
|
|
const emoji = getCustomEmoji(parsedContent);
|
|
|
|
if (emoji) {
|
|
|
|
return <CustomEmoji key={content} baseUrl={baseUrl} style={customEmojiStyle} emoji={emoji} />;
|
|
|
|
}
|
|
|
|
return <Text style={standardEmojiStyle}>{shortnameToUnicode(content)}</Text>;
|
|
|
|
},
|
|
|
|
() => true
|
|
|
|
);
|
|
|
|
|
|
|
|
Emoji.displayName = 'MessageEmoji';
|
|
|
|
|
|
|
|
export default Emoji;
|