...
|
...
|
@@ -52,23 +52,43 @@ export default class SingleImage extends React.Component { |
|
|
let {resource} = this.props;
|
|
|
let template_name = resource.get('data');
|
|
|
let src = template_name.get('src');
|
|
|
let linkUrl = template_name.get('url');
|
|
|
let imageHeight = template_name.get('height');
|
|
|
let imageWidth = template_name.get('width');
|
|
|
|
|
|
if (imageHeight && imageWidth) {
|
|
|
return (
|
|
|
<Image
|
|
|
source={{uri: src}}
|
|
|
style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
|
|
|
/>
|
|
|
);
|
|
|
<View style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}>
|
|
|
{linkUrl?<TouchableOpacity activeOpacity={0.5} onPress={() => {
|
|
|
this.props.onPressLink && this.props.onPressLink(linkUrl);
|
|
|
}}>
|
|
|
<Image
|
|
|
source={{uri: src}}
|
|
|
style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
|
|
|
/>
|
|
|
</TouchableOpacity>:<Image
|
|
|
source={{uri: src}}
|
|
|
style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
|
|
|
/>}
|
|
|
</View>
|
|
|
);
|
|
|
}else {
|
|
|
return (
|
|
|
<Image
|
|
|
ref={(ref)=>this.imageView=ref}
|
|
|
source={{uri: src}}
|
|
|
style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
|
|
|
/>
|
|
|
<View style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}>
|
|
|
{linkUrl?<TouchableOpacity activeOpacity={0.5} onPress={() => {
|
|
|
this.props.onPressLink && this.props.onPressLink(linkUrl);
|
|
|
}}>
|
|
|
<Image
|
|
|
ref={(ref)=>this.imageView=ref}
|
|
|
source={{uri: src}}
|
|
|
style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
|
|
|
/>
|
|
|
</TouchableOpacity>:<Image
|
|
|
ref={(ref)=>this.imageView=ref}
|
|
|
source={{uri: src}}
|
|
|
style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
|
|
|
/>}
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
}
|
...
|
...
|
|