CourseList.js
1.93 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
import React, {Component} from "react";
import {Image, ScrollView, StyleSheet, Text, TouchableOpacity, View} from "react-native";
import {height, width} from "../../utils/getSize";
import {toPage} from "./IndexBanner";
import {NoDoublePress} from "../../utils/utils";
import PropTypes from 'prop-types';
export default class CourseList extends Component {
// static contextTypes = {
// navigator: PropTypes.object,
// };
constructor(props) {
super(props);
}
render() {
return(
<View style={styles.classSub}>
<View style={styles.titleBarNext}>
<Text style={[styles.font6]}>相关课程</Text>
</View>
<ScrollView
showsHorizontalScrollIndicator={false}
horizontal={true}
>
<View style={{flexDirection: 'row'}}>
{
this.props.data && this.props.data.map((v, i) =>
<TouchableOpacity key={i} onPress={() =>NoDoublePress.onPress(() => toPage(this.props.nav, "COURSE", v.id)) }>
<View style={styles.imgView}>
<Image
source={{uri:v.pictureUrl}}
style={styles.img}
resizeMode="cover"
/>
<Text style={styles.font8}>{v.name}</Text>
</View>
</TouchableOpacity>
)
}
</View>
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
classSub: {
marginTop: 10,
width,
backgroundColor: 'white',
paddingLeft: 15
},
titleBarNext: {
height: 50,
alignItems: 'center',
flexDirection: 'row'
},
font6: {
fontSize: 16,
color: "#333"
},
imgView: {
width: 115,
marginRight: 15
},
img: {
width: 115,
height: 65,
borderRadius: 5
},
font8: {
fontSize: 14,
fontWeight: 'bold',
color: "#333",
marginTop: 10,
marginBottom: 15
},
});