1
+ import React , { PureComponent } from 'react'
2
+ import {
3
+ View ,
4
+ Text ,
5
+ StyleSheet ,
6
+ TouchableOpacity ,
7
+ Image ,
8
+ } from 'react-native'
9
+ import { Heading2 , Heading3 } from '../../widget/Text'
10
+ import screen from '../../common/screen'
11
+ import system from '../../common/system'
12
+ import color from '../../widget/color'
13
+
14
+ export default class HomeGridItem extends PureComponent {
15
+ render ( ) {
16
+ let info = this . props . info
17
+
18
+ let title = info . maintitle
19
+ let color = info . typeface_color
20
+ let subtitle = info . deputytitle
21
+ let imageUrl = info . imageUrl . replace ( 'w.h' , '120.0' )
22
+
23
+ return (
24
+ < TouchableOpacity style = { styles . container } onPress = { this . props . onPress } >
25
+ < View >
26
+ < Heading2 style = { { color :color , marginBottom : 10 } } > { title } </ Heading2 >
27
+ < Heading3 > { subtitle } </ Heading3 >
28
+ </ View >
29
+
30
+ < Image style = { styles . icon } source = { { uri : imageUrl } } />
31
+ </ TouchableOpacity >
32
+ )
33
+ }
34
+ }
35
+
36
+ const styles = StyleSheet . create ( {
37
+ container : {
38
+ flexDirection : 'row' ,
39
+ justifyContent : 'center' ,
40
+ alignItems : 'center' ,
41
+ width : screen . width / 2 - screen . onePixel ,
42
+ height : screen . width / 4 ,
43
+ backgroundColor : 'white' ,
44
+ borderBottomWidth : screen . onePixel ,
45
+ borderRightWidth : screen . onePixel ,
46
+ borderColor : color . border
47
+ } ,
48
+ icon : {
49
+ width : screen . width / 5 ,
50
+ height : screen . width / 5 ,
51
+ }
52
+ } )
0 commit comments