|
|
|
@ -1,6 +1,7 @@
@@ -1,6 +1,7 @@
|
|
|
|
|
import { $size, Txt } from '@/shared' |
|
|
|
|
import { useTheme } from '@/shared/hooks/use-theme.hook' |
|
|
|
|
import { PartialTheme } from '@/shared/themes/interfaces' |
|
|
|
|
import _ from 'lodash' |
|
|
|
|
import React, { FC, useMemo } from 'react' |
|
|
|
|
import { StyleSheet, View } from 'react-native' |
|
|
|
|
|
|
|
|
@ -19,24 +20,7 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => {
@@ -19,24 +20,7 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => {
|
|
|
|
|
if (!message) return 'ще немає повідомлень.' |
|
|
|
|
|
|
|
|
|
const sliceMessageOnNewLines = message.split('\n') |
|
|
|
|
|
|
|
|
|
const newLines = sliceMessageOnNewLines.length |
|
|
|
|
|
|
|
|
|
if (message.length > LENGTH_STRING_TO_RENDER) { |
|
|
|
|
const preparedMessage = message.substr(0, LENGTH_STRING_TO_RENDER) |
|
|
|
|
|
|
|
|
|
return `${preparedMessage}...` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (newLines > ALLOWED_NEW_LINES) { |
|
|
|
|
const preparedMessage = sliceMessageOnNewLines |
|
|
|
|
.splice(0, ALLOWED_NEW_LINES) |
|
|
|
|
.join('\n') |
|
|
|
|
|
|
|
|
|
return `${preparedMessage}...` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return message |
|
|
|
|
return sliceMessageOnNewLines.join(' ') |
|
|
|
|
}, [message]) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
@ -45,7 +29,9 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => {
@@ -45,7 +29,9 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => {
|
|
|
|
|
{label} |
|
|
|
|
</Txt> |
|
|
|
|
|
|
|
|
|
<Txt style={styles.message}>{messageToRender}</Txt> |
|
|
|
|
<Txt numberOfLines={3} style={styles.message}> |
|
|
|
|
{messageToRender} |
|
|
|
|
</Txt> |
|
|
|
|
</View> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|