import { useContext } from 'reactn' import { Pressable, View, Image, Text } from 'react-native' import { Video, ResizeMode } from 'expo-video' import { Fonts, gutters, Palette } from '../styles' import Style, { mainBorderRadius } from '../styles/Style' import { icons } from '../assets' import { substringTextLength } from '../helpers' import { WebViewContext } from '../providers/WebViewProvider.js' const thumbnailStyle = { width: 200, height: 200, borderRadius: mainBorderRadius / 2, overflow: 'hidden', } const RenderChatFile = ({ uri, type = 'image', name = '', containerStyle = {} }, index) => { const { setWebViewUrl } = useContext(WebViewContext) return ( {type === 'IMAGE' ? ( {name} ) : type === 'FILE' ? ( { setWebViewUrl(uri) }} style={{ ...Style.containerRow, ...Style.containerCenter, backgroundColor: Palette.transparentPrimary, padding: gutters / 2, borderRadius: mainBorderRadius / 2, }} > {substringTextLength({ text: name, maxLength: 40 })} ) : type === 'VIDEO' ? ( ) } export default RenderChatFile