Avoid errors on Audio/Image/Video (#443)

This commit is contained in:
Diego Mello 2018-09-14 16:39:52 -03:00 committed by GitHub
parent 849de55604
commit 4c19de9433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

@ -97,6 +97,11 @@ export default class Audio extends React.PureComponent {
user, baseUrl, customEmojis, file
} = this.props;
const { description } = file;
if (!baseUrl) {
return null;
}
return (
[
<View key='audio' style={styles.audioContainer}>

View File

@ -38,6 +38,11 @@ export default class extends React.PureComponent {
render() {
const { baseUrl, file, user } = this.props;
const img = `${ baseUrl }${ file.image_url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
if (!baseUrl) {
return null;
}
return (
[
<TouchableOpacity

View File

@ -60,9 +60,6 @@ const Url = ({ url, index }) => {
return (
<Touch onPress={() => onPress(url.url)} style={[styles.button, index > 0 && styles.marginTop]}>
<View style={styles.container}>
{/* <View style={{ backgroundColor: 'red', height: 150, borderTopLeftRadius: 5, borderTopRightRadius: 5 }}>
{url.image ? <FastImage source={{ uri: url.image }} /> : null}
</View> */}
{url.image ? <FastImage source={{ uri: url.image }} style={styles.image} resizeMode={FastImage.resizeMode.cover} /> : null}
<View style={styles.textContainer}>
<Text style={styles.url} numberOfLines={1}>{url.url}</Text>

View File

@ -62,6 +62,11 @@ export default class Video extends React.PureComponent {
const { isVisible } = this.state;
const { description } = this.props.file;
const { baseUrl, user, customEmojis } = this.props;
if (!baseUrl) {
return null;
}
return (
[
<View key='button'>