Magazine.js
3.94 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
'use strict';
import React, {Component} from 'react';
import ReactNative, {
View,
Text,
Image,
Button,
ListView,
StyleSheet,
Dimensions,
ScrollView,
TouchableOpacity,
Platform,
InteractionManager,
} from 'react-native';
export default class Magazine extends Component {
constructor(props) {
super(props);
this.renderRow = this.renderRow.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
renderRow(rowData,sectionID,rowID,highlightRow) {
if(rowID == 0){
return (
<Image style={styles.magazineImage} source={require('../../images/magazine1.png')} />
);
}
else if(rowID == 1){
return (
<Image style={styles.magazineImage} source={require('../../images/magazine2.png')} />
);
}
else if(rowID == 2){
return (
<Image style={styles.magazineImage} source={require('../../images/magazine3.png')} />
);
}
else if(rowID == 3){
return (
<Image style={styles.magazineImage} source={require('../../images/magazine1.png')} />
);
}
else
return null;
}
render() {
let content = "《YOHO!潮流志》、《YOHO!GIRL》是年轻人的潮流宝典,不仅网罗了方方面面的潮流讯息,"+
"亦会让你对话潮流明星和各大潮牌主理人,轻松掌握当季新品内容及背后故事,手把手教你如何变身潮人。";
let magazineData = [1,1,1];
return (
<ScrollView style={styles.container}>
<View style={styles.magazineContainer}>
<Text style={styles.magazineDesc}>{content}</Text>
</View>
<Text style={styles.about}>ABOUT</Text>
<ListView
style={styles.magazineList}
dataSource={this.dataSource.cloneWithRows(magazineData)}
horizontal={true}
renderRow={this.renderRow}
/>
<Text style={styles.yohoNowText1}>{"点击或扫描二维码YOHO!NOW APP"}</Text>
<TouchableOpacity style={styles.yohoNowImageContainer} activeOpacity={1} onPress={() => {
this.props.onPressYohoNow && this.props.onPressYohoNow();}}>
<Image style={styles.yohoNowImage} source={require('../../images/yohonow.png')} />
</TouchableOpacity>
</ScrollView>
);
}
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f0f0f0',
},
magazineContainer: {
width: width - 60,
height: 350,
backgroundColor: 'white',
marginTop: 40,
marginLeft: 30,
marginRight: 30,
marginBottom: 40,
},
about:{
position: 'absolute',
top: 10,
left: 50,
fontSize: 35,
color: 'rgb(212,169,68)',
fontWeight: 'bold',
},
magazineDesc:{
fontSize: 15,
color: 'rgb(33,33,33)',
fontWeight: 'bold',
marginTop: 20,
marginLeft: 12,
marginRight: 12,
},
magazineList:{
position: 'absolute',
top: 170,
left: 10,
width: width - 20,
},
magazineImage:{
width: 106,
height: 190,
marginLeft: 3,
marginRight: 3,
},
yohoNowText1:{
position: 'absolute',
top: 380,
width: width - 20,
},
yohoNowImageContainer:{
position: 'absolute',
top: 400,
height: 125,
},
yohoNowImage:{
width: 125,
height: 125,
},
});