import React from 'react'; import { Text, View } from 'react-native'; import { ISubscription, SubscriptionType } from '../../../definitions'; import styles from '../styles'; import { useTheme } from '../../../theme'; import { MarkdownPreview } from '../../../containers/markdown'; import RoomTypeIcon from '../../../containers/RoomTypeIcon'; import { getRoomTitle } from '../../../lib/methods/helpers'; interface IRoomInfoViewTitle { room?: ISubscription; name?: string; username: string; statusText?: string; type: SubscriptionType; } const RoomInfoViewTitle = ({ room, name, username, statusText, type }: IRoomInfoViewTitle): React.ReactElement => { const { colors } = useTheme(); if (type === SubscriptionType.DIRECT) { return ( <> {name} {username && ( {`@${username}`} )} {!!statusText && ( )} ); } return ( {getRoomTitle(room)} ); }; export default RoomInfoViewTitle;