2019-10-30 14:14:41 +00:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { Text } from 'react-native';
|
|
|
|
|
2022-03-31 22:39:24 +00:00
|
|
|
import { IEmoji } from '../../../definitions/IEmoji';
|
2019-12-11 19:00:38 +00:00
|
|
|
import shortnameToUnicode from '../../../utils/shortnameToUnicode';
|
2019-10-30 14:14:41 +00:00
|
|
|
import CustomEmoji from '../../EmojiPicker/CustomEmoji';
|
2022-03-31 22:39:24 +00:00
|
|
|
import MessageboxContext from '../Context';
|
|
|
|
import styles from '../styles';
|
2019-10-30 14:14:41 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IMessageBoxMentionEmoji {
|
|
|
|
item: IEmoji;
|
|
|
|
}
|
|
|
|
|
|
|
|
const MentionEmoji = ({ item }: IMessageBoxMentionEmoji) => {
|
2019-10-30 14:14:41 +00:00
|
|
|
const context = useContext(MessageboxContext);
|
|
|
|
const { baseUrl } = context;
|
|
|
|
|
|
|
|
if (item.name) {
|
2021-09-13 20:41:05 +00:00
|
|
|
return <CustomEmoji style={styles.mentionItemCustomEmoji} emoji={item} baseUrl={baseUrl} />;
|
2019-10-30 14:14:41 +00:00
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
return <Text style={styles.mentionItemEmoji}>{shortnameToUnicode(`:${item}:`)}</Text>;
|
2019-10-30 14:14:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default MentionEmoji;
|