// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {useCallback} from 'react'; import {type StyleProp, View, type ViewStyle} from 'react-native'; import Emoji from '@components/emoji'; import TouchableWithFeedback from '@components/touchable_with_feedback'; import {usePreventDoubleTap} from '@hooks/utils'; import SkinnedEmoji from './skinned_emoji'; type Props = { category?: string; name: string; onEmojiPress: (emoji: string) => void; preventDoubleTap?: boolean; size?: number; style?: StyleProp; } const CATEGORIES_WITH_SKINS = ['people-body']; const hitSlop = {top: 10, bottom: 10, left: 10, right: 10}; const TouchableEmoji = ({category, name, onEmojiPress, preventDoubleTap = true, size = 30, style}: Props) => { const handlePress = useCallback(() => onEmojiPress(name), [name, onEmojiPress]); const onPress = preventDoubleTap ? usePreventDoubleTap(handlePress) : handlePress; if (category && CATEGORIES_WITH_SKINS.includes(category)) { return ( ); } return ( ); }; export default React.memo(TouchableEmoji);