import React, { useMemo } from 'react'; import { Pressable, StyleSheet, Text, View } from 'react-native'; import type { Attachment } from 'stream-chat'; import { GiphyImage } from './GiphyImage'; import { MessageContextValue, useMessageContext, } from '../../../contexts/messageContext/MessageContext'; import { MessagesContextValue, useMessagesContext, } from '../../../contexts/messagesContext/MessagesContext'; import { useTheme } from '../../../contexts/themeContext/ThemeContext'; import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext'; import { EyeOpen } from '../../../icons/EyeOpen'; import { components, primitives } from '../../../theme'; import { Button } from '../../ui/'; export type GiphyPropsWithContext = Pick< MessageContextValue, 'handleAction' | 'isMyMessage' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress' > & Pick & { attachment: Attachment; }; const GiphyWithContext = (props: GiphyPropsWithContext) => { const { additionalPressableProps, attachment, giphyVersion, handleAction, isMyMessage, onLongPress, onPress, onPressIn, preventPress, } = props; const { actions, image_url, thumb_url } = attachment; const { t } = useTranslationContext(); const { theme: { messageItemView: { giphy: { actionButtonContainer, actionButton, container, giphyHeaderText, header }, }, semantics, }, } = useTheme(); const styles = useStyles({ hasActions: !!actions, isMyMessage }); const uri = image_url || thumb_url; if (!uri) { return null; } return actions ? ( {t('Only visible to you')} {actions.map((action) => { const isPrimaryAction = action.text === 'Send'; return (