|
|
|
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
|
|
|
|
import { $size, IChatMessage, Txt, useTheme } from '@/shared' |
|
|
|
|
import { $size, IChatMessage, MessageType, Txt, useTheme } from '@/shared' |
|
|
|
|
import { getMessagePreviewText } from '@/shared/helpers' |
|
|
|
|
import { PartialTheme } from '@/shared/themes/interfaces' |
|
|
|
|
import React, { useMemo } from 'react' |
|
|
|
@ -18,7 +18,6 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
@@ -18,7 +18,6 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
|
|
|
|
|
const { styles, theme } = useTheme(createStyles) |
|
|
|
|
|
|
|
|
|
if (!repliedMessage) return null |
|
|
|
|
|
|
|
|
|
const text = useMemo(() => { |
|
|
|
|
if (repliedMessage?.isDeleted) return 'Видалене повідомлення' |
|
|
|
|
|
|
|
|
@ -26,7 +25,14 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
@@ -26,7 +25,14 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
|
|
|
|
|
}, [repliedMessage]) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<TouchableOpacity style={styles.container} onPress={onPress}> |
|
|
|
|
<TouchableOpacity |
|
|
|
|
style={[ |
|
|
|
|
styles.container, |
|
|
|
|
repliedMessage?.type === MessageType.Text |
|
|
|
|
? { height: 'auto' } |
|
|
|
|
: { height: $size(40, 30) }, |
|
|
|
|
]} |
|
|
|
|
onPress={onPress}> |
|
|
|
|
<MessageMediaPreview |
|
|
|
|
type={repliedMessage?.type} |
|
|
|
|
uri={repliedMessage?.content?.fileUrl} |
|
|
|
@ -44,7 +50,7 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
@@ -44,7 +50,7 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
|
|
|
|
|
style={[styles.txt, styles.name]}> |
|
|
|
|
{repliedMessage?.userName} |
|
|
|
|
</Txt> |
|
|
|
|
<Txt numberOfLines={1} style={styles.txt}> |
|
|
|
|
<Txt numberOfLines={3} style={styles.txt}> |
|
|
|
|
{text} |
|
|
|
|
</Txt> |
|
|
|
|
</View> |
|
|
|
@ -55,7 +61,6 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
@@ -55,7 +61,6 @@ export const RepliedMessageInfo = ({ onPress, repliedMessage }: IProps) => {
|
|
|
|
|
const createStyles = (theme: PartialTheme) => |
|
|
|
|
StyleSheet.create({ |
|
|
|
|
container: { |
|
|
|
|
height: $size(40, 30), |
|
|
|
|
alignItems: 'center', |
|
|
|
|
flexDirection: 'row', |
|
|
|
|
marginLeft: $size(3), |
|
|
|
|