import React, { useContext } from 'react'; import { View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import MessageContext from './Context'; import User from './User'; import styles from './styles'; import RepliedThread from './RepliedThread'; import MessageAvatar from './MessageAvatar'; import Attachments from './Attachments'; import Urls from './Urls'; import Thread from './Thread'; import Blocks from './Blocks'; import Reactions from './Reactions'; import Broadcast from './Broadcast'; import Discussion from './Discussion'; import Content from './Content'; import CallButton from './CallButton'; import { themes } from '../../lib/constants'; import { IMessage, IMessageInner, IMessageTouchable } from './interfaces'; import { useTheme } from '../../theme'; import RightIcons from './Components/RightIcons'; const MessageInner = React.memo((props: IMessageInner) => { if (props.isPreview) { return ( <> <> ); } if (props.type === 'discussion-created') { return ( <> ); } if (props.type === 'jitsi_call_started') { return ( <> ); } if (props.blocks && props.blocks.length) { return ( <> ); } return ( <> <> ); }); MessageInner.displayName = 'MessageInner'; const Message = React.memo((props: IMessage) => { if (props.isThreadReply || props.isThreadSequential || props.isInfo || props.isIgnored) { const thread = props.isThreadReply ? : null; return ( {thread} {props.isInfo && props.type === 'message_pinned' ? ( ) : null} ); } return ( {!props.isHeader ? ( ) : null} ); }); Message.displayName = 'Message'; const MessageTouchable = React.memo((props: IMessageTouchable & IMessage) => { const { onPress, onLongPress } = useContext(MessageContext); const { theme } = useTheme(); let backgroundColor = undefined; if (props.isBeingEdited) { backgroundColor = themes[theme].statusBackgroundWarning2; } if (props.highlighted) { backgroundColor = themes[theme].headerBackground; } if (props.hasError) { return ( ); } return ( ); }); MessageTouchable.displayName = 'MessageTouchable'; export default MessageTouchable;