diff --git a/app/components/touchable_emoji/index.tsx b/app/components/touchable_emoji/index.tsx index e892bc2003..24d751e3a5 100644 --- a/app/components/touchable_emoji/index.tsx +++ b/app/components/touchable_emoji/index.tsx @@ -25,19 +25,13 @@ const hitSlop = {top: 10, bottom: 10, left: 10, right: 10}; const TouchableEmoji = ({category, name, onEmojiPress, size = 30, style}: Props) => { const onPress = useCallback(preventDoubleTap(() => onEmojiPress(name)), []); - let emoji; if (category && CATEGORIES_WITH_SKINS.includes(category)) { - emoji = ( + return ( - ); - } else { - emoji = ( - ); } @@ -52,7 +46,10 @@ const TouchableEmoji = ({category, name, onEmojiPress, size = 30, style}: Props) style={style} type={'opacity'} > - {emoji} + ); diff --git a/app/components/touchable_emoji/skinned_emoji.tsx b/app/components/touchable_emoji/skinned_emoji.tsx index 0fdedda8bd..7fce9e6ecd 100644 --- a/app/components/touchable_emoji/skinned_emoji.tsx +++ b/app/components/touchable_emoji/skinned_emoji.tsx @@ -1,19 +1,26 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useMemo} from 'react'; +import React, {useCallback, useMemo} from 'react'; +import {StyleProp, View, ViewStyle} from 'react-native'; import {useEmojiSkinTone} from '@app/hooks/emoji_category_bar'; +import {preventDoubleTap} from '@app/utils/tap'; import Emoji from '@components/emoji'; +import TouchableWithFeedback from '@components/touchable_with_feedback'; import {skinCodes} from '@utils/emoji'; import {isValidNamedEmoji} from '@utils/emoji/helpers'; type Props = { name: string; + onEmojiPress: (emoji: string) => void; size?: number; + style?: StyleProp; } -const SkinnedEmoji = ({name, size = 30}: Props) => { +const hitSlop = {top: 10, bottom: 10, left: 10, right: 10}; + +const SkinnedEmoji = ({name, onEmojiPress, size = 30, style}: Props) => { const skinTone = useEmojiSkinTone(); const emojiName = useMemo(() => { const skinnedEmoji = `${name}_${skinCodes[skinTone]}`; @@ -23,11 +30,26 @@ const SkinnedEmoji = ({name, size = 30}: Props) => { return skinnedEmoji; }, [name, skinTone]); + const onPress = useCallback(preventDoubleTap(() => { + onEmojiPress(emojiName); + }), [emojiName]); + return ( - + + + + + ); };