RecommondAppCell.js
1.52 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
/**
* Created by jone on 2017/4/10.
*/
import React, {Component} from 'react';
import {
View,
Text,
TouchableWithoutFeedback,
StyleSheet,
TouchableOpacity,
Image,
Dimensions,
} from 'react-native';
import {getIcon} from '../../util/iconParse';
export default class MoreAppCell extends Component {
constructor(props) {
super(props);
}
render() {
let {data} = this.props;
let params = data.toJSON();
let image = getIcon(params.id);
let id = params.id;
return (
<TouchableOpacity
activeOpacity={0.5}
onPress={() => {this.props.onPressIcon && this.props.onPressIcon(id)}}
>
<View style={styles.container}>
{/* <Image source={require(this.props.data.image_url)} style={styles.topImgStyle}/>*/}
<Image source={image} style={styles.topImgStyle}/>
<Text >{params.recommondName}</Text>
</View>
</TouchableOpacity>
)
}
};
let {width, height} = Dimensions.get('window');
let cols = 4;
let cellW = 60;
let vMargin = (width - cellW * cols) / (cols + 1);
let cellWidth = width / 4;
let styles = StyleSheet.create({
container: {
backgroundColor:'white',
justifyContent:'center',
alignItems:'center',
width:cellWidth,
marginTop:20,
// marginLeft:vMargin
},
topImgStyle: {
width:60,
height:60,
marginBottom:8
},
});