import React from 'react' import { Text, View } from 'react-native' import AttachmentImage from './Attachment/AttachmentImage' import AttachmentVideo from './Attachment/AttachmentVideo' export interface Props { media_attachments: Mastodon.Attachment[] sensitive: boolean width: number } const Attachment: React.FC = ({ media_attachments, sensitive, width }) => { let attachment let attachmentHeight // if (width) {} switch (media_attachments[0].type) { case 'unknown': attachment = 文件不支持 attachmentHeight = 25 break case 'image': attachment = ( ) attachmentHeight = width / 2 break case 'gifv': attachment = ( ) attachmentHeight = (width / media_attachments[0].meta.original.width) * media_attachments[0].meta.original.height break // Support multiple video // Supoort when video meta is empty // case 'video': // attachment = ( // // ) // attachmentHeight = // (width / media_attachments[0].meta.original.width) * // media_attachments[0].meta.original.height // break // case 'audio': // attachment = ( // // ) // break } return ( {attachment} ) } export default Attachment