import React from 'react'; import PropTypes from 'prop-types'; import { Video } from 'expo-av'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { ScrollView, Text, StyleSheet } from 'react-native'; import prettyBytes from 'pretty-bytes'; import { CustomIcon } from '../../lib/Icons'; import { ImageViewer, types } from '../../presentation/ImageViewer'; import { themes } from '../../constants/colors'; import { useDimensions, useOrientation } from '../../dimensions'; import { getHeaderHeight } from '../../containers/Header'; import { isIOS } from '../../utils/deviceInfo'; import { THUMBS_HEIGHT } from './constants'; import sharedStyles from '../Styles'; import { allowPreview } from './utils'; import I18n from '../../i18n'; const styles = StyleSheet.create({ fileContainer: { alignItems: 'center', justifyContent: 'center' }, fileName: { fontSize: 16, textAlign: 'center', marginHorizontal: 10, ...sharedStyles.textMedium }, fileSize: { fontSize: 14, ...sharedStyles.textRegular } }); const IconPreview = React.memo(({ iconName, title, description, theme, width, height, danger }) => ( {title} {description ? {description} : null} )); const Preview = React.memo(({ item, theme, isShareExtension, length }) => { const type = item?.mime; const { width, height } = useDimensions(); const { isLandscape } = useOrientation(); const insets = useSafeAreaInsets(); const headerHeight = getHeaderHeight(isLandscape); const messageboxHeight = isIOS ? 56 : 0; const thumbsHeight = (length > 1) ? THUMBS_HEIGHT : 0; const calculatedHeight = height - insets.top - insets.bottom - messageboxHeight - thumbsHeight - headerHeight; if (item?.canUpload) { if (type?.match(/video/)) { return (