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 ReadReceipt from './ReadReceipt'; import CallButton from './CallButton'; import { themes } from '../../constants/colors'; import { IMessage, IMessageInner, IMessageTouchable } from './interfaces'; const MessageInner = React.memo((props: IMessageInner) => { const { attachments } = props; const isCollapsible = attachments ? attachments[0] && attachments[0].collapsed : false; if (props.type === 'discussion-created') { return ( <> ); } if (props.type === 'jitsi_call_started') { return ( <> ); } if (props.blocks && props.blocks.length) { return ( <> ); } return ( <> {isCollapsible ? ( <> ) : ( <> )} ); }); 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} {/* @ts-ignore */} ); } return ( {/* @ts-ignore */} ); }); Message.displayName = 'Message'; const MessageTouchable = React.memo((props: IMessageTouchable & IMessage) => { if (props.hasError) { return ( ); } const { onPress, onLongPress } = useContext(MessageContext); return ( ); }); MessageTouchable.displayName = 'MessageTouchable'; export default MessageTouchable;