NoDataView.js
1.8 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import GetPurchaseCell from './GetPurchaseCell';
const {
View,
TouchableOpacity,
StyleSheet,
Dimensions,
Platform,
Text,
Image,
} = ReactNative;
import Immutable, {Map} from 'immutable';
export default class NoDataView extends React.Component {
constructor(props) {
super (props);
}
shouldComponentUpdate(nextProps){
if (Immutable.is(nextProps.resource, this.props.resource)) {
return false;
} else {
return true;
}
}
render() {
return (
<View style={styles.container}>
<GetPurchaseCell resource={'0'} onPressHowToGetCodeLink={this.props.onPressHowToGetCodeLink}/>
<Image source={require('../../image/lp_mineList_empty.png')} style={styles.noLimitCodeIcon}></Image>
<Text style={styles.text}>暂无限购码</Text>
<TouchableOpacity activeOpacity={1} style={styles.button}
onPress={() => {
this.props.onPressMore && this.props.onPressMore()
}}
>
<Text style={styles.buttonText}>随便看看</Text>
</TouchableOpacity>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let iconHeight = Math.ceil((146 / 640) * width);
let iconWidth = Math.ceil((120 / 640) * width);
let iconTop = Math.ceil((200 / 640) * width);
let styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
backgroundColor: 'white',
},
noLimitCodeIcon: {
width: iconWidth,
height: iconHeight,
marginTop: iconTop,
},
text: {
marginTop: 30,
fontSize: 12,
},
button: {
marginTop: 60,
width: 200,
height: 40,
backgroundColor: 'black',
alignItems: 'center',
justifyContent: 'center',
},
buttonText: {
color: 'white',
fontSize: 15,
},
});