11/**
22 * Created by wangdi on 24/11/16.
33 */
4- import React , { Component } from 'react' ;
5- import { StyleSheet , View , Text } from 'react-native' ;
4+ import React , { Component , PropTypes } from 'react' ;
5+ import { StyleSheet , View , Text , Image , TouchableHighlight , Alert } from 'react-native' ;
66import BackPageComponent from '../../components/BackPageComponent' ;
77import NavigationBar from '../../components/NavigationBar' ;
88import theme from '../../constants/theme' ;
9+ import Icon from 'react-native-vector-icons/Ionicons' ;
910import { connect } from 'react-redux' ;
11+ import px2dp from '../../utils/px2dp' ;
12+ import Toast from 'react-native-root-toast' ;
1013
1114class AboutGankPage extends BackPageComponent {
1215
1316 render ( ) {
14- const { pageBackgroundColor} = this . props ;
17+ const { pageBackgroundColor, titleColor , subTitleColor , segmentColor , rowItemBackgroundColor , arrowColor , tabIconColor } = this . props ;
1518 return (
1619 < View style = { [ styles . container , { backgroundColor : pageBackgroundColor } ] } >
1720 < NavigationBar
1821 title = "关于Gank.io"
1922 leftBtnIcon = "arrow-back"
20- leftBtnPress = { this . _handleBack . bind ( this ) } />
23+ leftBtnPress = { this . _handleBack . bind ( this ) }
24+ />
25+ < View style = { styles . logoInfo } >
26+ < Image source = { require ( '../../assets/icon.png' ) } style = { styles . logo } />
27+ < Text style = { [ { color : titleColor } , styles . logoLabel ] } > Gank.io</ Text >
28+ < Text style = { { color : subTitleColor , marginTop : px2dp ( 3 ) } } > v1.0.0</ Text >
29+ </ View >
30+ < View style = { [ styles . block , { borderTopColor : segmentColor , backgroundColor : rowItemBackgroundColor } ] } >
31+ < Item title = "简介" arrowColor = { arrowColor } titleColor = { titleColor } segmentColor = { segmentColor } onPress = { this . _itemOnPressCallback . bind ( this , 0 ) } />
32+ < Item title = "用户协议" arrowColor = { arrowColor } titleColor = { titleColor } segmentColor = { segmentColor } onPress = { this . _itemOnPressCallback . bind ( this , 1 ) } />
33+ < Item title = "隐私条款" arrowColor = { arrowColor } titleColor = { titleColor } segmentColor = { segmentColor } onPress = { this . _itemOnPressCallback . bind ( this , 2 ) } />
34+ </ View >
35+ < View style = { { position : 'absolute' , bottom : px2dp ( 15 ) , width :theme . screenWidth , alignItems : 'center' } } >
36+ < Text style = { { color : tabIconColor , fontSize : px2dp ( 12 ) } } > Copyright@2016 wangdicoder</ Text >
37+ </ View >
2138 </ View >
2239 ) ;
2340 }
41+
42+ _itemOnPressCallback ( id ) {
43+ switch ( id ) {
44+ case 0 :
45+ Alert . alert ( '简介' , '每日分享妹子图 和 技术干货,还有供大家中午休息的休闲视频' ) ;
46+ break ;
47+ case 1 :
48+ Toast . show ( '没有协议' , { position : px2dp ( - 80 ) } ) ;
49+ break ;
50+ case 2 :
51+ Toast . show ( '没有条款' , { position : px2dp ( - 80 ) } ) ;
52+ break ;
53+ }
54+ }
55+ }
56+
57+ class Item extends Component {
58+ static propTypes = {
59+ title : PropTypes . string . isRequired ,
60+ titleColor : PropTypes . string ,
61+ arrowColor : PropTypes . string ,
62+ segmentColor : PropTypes . string ,
63+ onPress : PropTypes . func
64+ } ;
65+
66+ render ( ) {
67+ const { title, onPress, titleColor, arrowColor, segmentColor} = this . props ;
68+ return (
69+ < TouchableHighlight
70+ onPress = { onPress }
71+ underlayColor = { theme . touchableOpacityActiveOpacity } >
72+ < View style = { [ styles . cell , { borderBottomColor : segmentColor } ] } >
73+ < Text style = { { color : titleColor } } > { title } </ Text >
74+ < Icon name = "ios-arrow-forward" color = { arrowColor } size = { px2dp ( 18 ) } />
75+ </ View >
76+ </ TouchableHighlight >
77+ ) ;
78+ }
2479}
2580
2681const styles = StyleSheet . create ( {
2782 container : {
2883 flex : 1 ,
2984 paddingTop : theme . toolbar . paddingTop
85+ } ,
86+ logoInfo : {
87+ alignItems : 'center' ,
88+ marginTop : px2dp ( 50 )
89+ } ,
90+ logo : {
91+ width : px2dp ( 60 ) ,
92+ height : px2dp ( 60 ) ,
93+ resizeMode : 'contain'
94+ } ,
95+ logoLabel : {
96+ marginTop : px2dp ( 8 ) ,
97+ fontSize : px2dp ( 18 ) ,
98+ } ,
99+ cell : {
100+ flex : 1 ,
101+ paddingLeft : px2dp ( 20 ) ,
102+ paddingRight : px2dp ( 20 ) ,
103+ flexDirection : 'row' ,
104+ justifyContent : 'space-between' ,
105+ alignItems : 'center' ,
106+ height : px2dp ( 40 ) ,
107+ borderBottomWidth : theme . segment . width ,
108+ } ,
109+ block : {
110+ marginTop : px2dp ( 18 ) ,
111+ borderTopWidth : theme . segment . width
30112 }
31113} ) ;
32114
@@ -36,7 +118,10 @@ const mapStateToProps = (state) => {
36118 pageBackgroundColor : state . settingState . colorScheme . pageBackgroundColor ,
37119 segmentColor : state . settingState . colorScheme . segmentColor ,
38120 titleColor : state . settingState . colorScheme . titleColor ,
39- rowItemBackgroundColor : state . settingState . colorScheme . rowItemBackgroundColor
121+ subTitleColor : state . settingState . colorScheme . subTitleColor ,
122+ rowItemBackgroundColor : state . settingState . colorScheme . rowItemBackgroundColor ,
123+ arrowColor : state . settingState . colorScheme . arrowColor ,
124+ tabIconColor : state . settingState . colorScheme . tabIconColor
40125 }
41126}
42127
0 commit comments