Avoid errors on Audio/Image/Video (#443)
This commit is contained in:
parent
849de55604
commit
4c19de9433
|
@ -97,6 +97,11 @@ export default class Audio extends React.PureComponent {
|
||||||
user, baseUrl, customEmojis, file
|
user, baseUrl, customEmojis, file
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { description } = file;
|
const { description } = file;
|
||||||
|
|
||||||
|
if (!baseUrl) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
[
|
[
|
||||||
<View key='audio' style={styles.audioContainer}>
|
<View key='audio' style={styles.audioContainer}>
|
||||||
|
|
|
@ -38,6 +38,11 @@ export default class extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { baseUrl, file, user } = this.props;
|
const { baseUrl, file, user } = this.props;
|
||||||
const img = `${ baseUrl }${ file.image_url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
|
const img = `${ baseUrl }${ file.image_url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
|
||||||
|
|
||||||
|
if (!baseUrl) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
[
|
[
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
|
|
@ -60,9 +60,6 @@ const Url = ({ url, index }) => {
|
||||||
return (
|
return (
|
||||||
<Touch onPress={() => onPress(url.url)} style={[styles.button, index > 0 && styles.marginTop]}>
|
<Touch onPress={() => onPress(url.url)} style={[styles.button, index > 0 && styles.marginTop]}>
|
||||||
<View style={styles.container}>
|
<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}
|
{url.image ? <FastImage source={{ uri: url.image }} style={styles.image} resizeMode={FastImage.resizeMode.cover} /> : null}
|
||||||
<View style={styles.textContainer}>
|
<View style={styles.textContainer}>
|
||||||
<Text style={styles.url} numberOfLines={1}>{url.url}</Text>
|
<Text style={styles.url} numberOfLines={1}>{url.url}</Text>
|
||||||
|
|
|
@ -62,6 +62,11 @@ export default class Video extends React.PureComponent {
|
||||||
const { isVisible } = this.state;
|
const { isVisible } = this.state;
|
||||||
const { description } = this.props.file;
|
const { description } = this.props.file;
|
||||||
const { baseUrl, user, customEmojis } = this.props;
|
const { baseUrl, user, customEmojis } = this.props;
|
||||||
|
|
||||||
|
if (!baseUrl) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
[
|
[
|
||||||
<View key='button'>
|
<View key='button'>
|
||||||
|
|
Loading…
Reference in New Issue