2020-12-25 18:20:09 +01:00
|
|
|
import React from 'react'
|
|
|
|
import { StyleSheet, Text, View } from 'react-native'
|
2020-12-26 23:05:17 +01:00
|
|
|
import Button from '@components/Button'
|
2020-12-25 18:20:09 +01:00
|
|
|
import { useTheme } from '@root/utils/styles/ThemeManager'
|
|
|
|
import { StyleConstants } from '@root/utils/styles/constants'
|
|
|
|
import openLink from '@root/utils/openLink'
|
|
|
|
|
|
|
|
export interface Props {
|
2020-12-25 21:09:43 +01:00
|
|
|
attachment: Mastodon.AttachmentUnknown
|
2020-12-25 18:20:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const AttachmentUnsupported: React.FC<Props> = ({ attachment }) => {
|
|
|
|
const { theme } = useTheme()
|
|
|
|
return (
|
|
|
|
<View style={styles.base}>
|
|
|
|
<Text style={[styles.text, { color: theme.primary }]}>文件不支持</Text>
|
|
|
|
{attachment.remote_url ? (
|
2020-12-26 23:05:17 +01:00
|
|
|
<Button
|
|
|
|
type='text'
|
|
|
|
content='尝试远程链接'
|
2020-12-25 18:20:09 +01:00
|
|
|
size='S'
|
|
|
|
onPress={async () => await openLink(attachment.remote_url!)}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
base: {
|
|
|
|
flex: 1,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
fontSize: StyleConstants.Font.Size.S,
|
|
|
|
textAlign: 'center',
|
|
|
|
marginBottom: StyleConstants.Spacing.S
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
export default AttachmentUnsupported
|