* Migrate attachment_image * Migrate action_menu * Migrate action_button * migrate message_attachments * Remove unintended commited file * Fix tsc * Fix tsc * Fix lint * Update references * Make emoji functional component and fix imports * Use ReactNode instead of JSXElement * Convert action menu to FC * Remove unneeded fragments * Remove unneded undefined check * Use undefined instead of nil in calculateDimensions * Make sure height is always defined * Use is valid URL * Add missing types * Lint fixes and remove lodash * Revert package.json changes * Put back fragments since they are actually needed * Fix test * Fix lint * Address feedback
41 lines
866 B
TypeScript
41 lines
866 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
import {StyleSheet, View} from 'react-native';
|
|
import FastImage from 'react-native-fast-image';
|
|
|
|
import {isValidUrl} from '@utils/url';
|
|
|
|
type Props = {
|
|
url?: string;
|
|
}
|
|
export default function AttachmentThumbnail(props: Props) {
|
|
const {url: uri} = props;
|
|
|
|
if (!isValidUrl(uri)) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<View style={style.container}>
|
|
<FastImage
|
|
source={{uri}}
|
|
resizeMode='contain'
|
|
style={style.image}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const style = StyleSheet.create({
|
|
container: {
|
|
position: 'absolute',
|
|
right: 10,
|
|
top: 10,
|
|
},
|
|
image: {
|
|
height: 45,
|
|
width: 45,
|
|
},
|
|
});
|