2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
2022-10-21 18:27:55 +00:00
|
|
|
import { StyleProp } from 'react-native';
|
|
|
|
import FastImage, { ImageStyle } from 'react-native-fast-image';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
2022-10-21 18:27:55 +00:00
|
|
|
import { useAppSelector } from '../../lib/hooks';
|
|
|
|
import { ICustomEmoji } from '../../definitions';
|
|
|
|
|
|
|
|
interface ICustomEmojiProps {
|
|
|
|
emoji: ICustomEmoji;
|
|
|
|
style: StyleProp<ImageStyle>;
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
const CustomEmoji = React.memo(
|
2022-10-21 18:27:55 +00:00
|
|
|
({ emoji, style }: ICustomEmojiProps) => {
|
|
|
|
const baseUrl = useAppSelector(state => state.share.server.server || state.server.server);
|
|
|
|
return (
|
|
|
|
<FastImage
|
|
|
|
style={style}
|
|
|
|
source={{
|
|
|
|
uri: `${baseUrl}/emoji-custom/${encodeURIComponent(emoji.name)}.${emoji.extension}`,
|
|
|
|
priority: FastImage.priority.high
|
|
|
|
}}
|
|
|
|
resizeMode={FastImage.resizeMode.contain}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
() => true
|
2021-09-13 20:41:05 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export default CustomEmoji;
|