2019-10-30 14:14:41 +00:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { Text } from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2019-12-11 19:00:38 +00:00
|
|
|
import shortnameToUnicode from '../../../utils/shortnameToUnicode';
|
2019-10-30 14:14:41 +00:00
|
|
|
import styles from '../styles';
|
|
|
|
import MessageboxContext from '../Context';
|
|
|
|
import CustomEmoji from '../../EmojiPicker/CustomEmoji';
|
|
|
|
|
|
|
|
const MentionEmoji = ({ item }) => {
|
|
|
|
const context = useContext(MessageboxContext);
|
|
|
|
const { baseUrl } = context;
|
|
|
|
|
|
|
|
if (item.name) {
|
|
|
|
return (
|
|
|
|
<CustomEmoji
|
|
|
|
style={styles.mentionItemCustomEmoji}
|
|
|
|
emoji={item}
|
|
|
|
baseUrl={baseUrl}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<Text style={styles.mentionItemEmoji}>
|
|
|
|
{shortnameToUnicode(`:${ item }:`)}
|
|
|
|
</Text>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
MentionEmoji.propTypes = {
|
|
|
|
item: PropTypes.object
|
|
|
|
};
|
|
|
|
|
|
|
|
export default MentionEmoji;
|