NoActivityView.js
1.6 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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
const {
View,
Text,
TouchableOpacity,
Dimensions,
StyleSheet,
Platform,
Image,
} = ReactNative;
export default class NoActivityView extends React.Component {
constructor(props) {
super (props);
}
render() {
let {resource} = this.props;
let title = '活动已经上线,左滑切换频道,更多潮品,就在YOHO!BUY有货';
if (resource == '即将结束') {
title = '活动正在火热进行中,左滑切换频道,更多潮品,就在YOHO!BUY有货';
}
return (
<View style={styles.container}>
<View style={styles.imageV}>
<Image
source={require('../../image/bag_moren.png')}
style={styles.image}
/>
</View>
<View style={styles.textV}>
<Text style={styles.text}>{title}</Text>
</View>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let backgroundWidth = Math.ceil((156 / 640) * width);
let backgroundHeight = Math.ceil((186 / 640) * width);
let textWidth = Math.ceil((400 / 640) * width);
let styles = StyleSheet.create({
container: {
width: width,
height: height,
},
imageV: {
width: backgroundWidth,
height: backgroundHeight,
alignSelf: 'center',
marginTop: (height-80-backgroundHeight)/2 - 40,
},
image: {
width: backgroundWidth,
height: backgroundHeight,
},
textV: {
width: textWidth,
height: 50,
alignSelf: 'center',
marginTop: 10,
},
text: {
width: textWidth,
height: 50,
textAlign: 'center',
}
});