SingleImage.js
1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable from 'immutable';
import ImageSingle from "../cell/ImageSingle";
const {Dimensions} = ReactNative;
export default class SingleImage extends React.Component {
constructor(props) {
super(props);
}
shouldComponentUpdate(nextProps) {
if (Immutable.is(nextProps.data, this.props.data)) {
return false;
} else {
return true;
}
}
render() {
return (
<ImageSingle
style={this.props.style}
resource={this.props.data}
messageResourceInfo={this.props.messageResourceInfo}
resourceJumpWithUrl={this.props.resourceJumpWithUrl}
/>
);
}
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let sliderHeight = Math.ceil(100 * DEVICE_WIDTH_RATIO);