Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit c937af9

Browse files
committed
gank.io page
1 parent 40cdb87 commit c937af9

File tree

4 files changed

+92
-7
lines changed

4 files changed

+92
-7
lines changed

js/assets/icon.png

23 KB
Loading

js/containers/MainPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BottomTabBar extends Component{
3636
constructor(props){
3737
super(props);
3838
this.state = {
39-
selectedTab: 'home'
39+
selectedTab: 'more'
4040
};
4141
}
4242

js/containers/MoreTab/AboutGankPage.js

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,114 @@
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';
66
import BackPageComponent from '../../components/BackPageComponent';
77
import NavigationBar from '../../components/NavigationBar';
88
import theme from '../../constants/theme';
9+
import Icon from 'react-native-vector-icons/Ionicons';
910
import {connect} from 'react-redux';
11+
import px2dp from '../../utils/px2dp';
12+
import Toast from 'react-native-root-toast';
1013

1114
class 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

2681
const 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

js/containers/MoreTab/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class MoreFragment extends Component{
6060
{/*<RowItem title="选择语言 / Language" icon="md-globe" iconColor={colors.purple} onPress={this._itemClickCallback.bind(this, 3)}/>*/}
6161
<RowItemWithSwitcher title="夜间模式" icon="md-moon" iconColor="#7b68ee" switcherValue={isOpenNightMode} onValueChange={(value) => actions.changeNightMode(value)}/>
6262
<RowItemWithSwitcher title="显示列表缩略图" icon="md-browsers" iconColor='plum' switcherValue={isOpenThumbnail} onValueChange={(value) => actions.changeShowThumbnail(value)} />
63-
<RowItemWithSwitcher title="自动刷新首页数据" icon="md-refresh" iconColor='#ffd700' switcherValue={isOpenThumbnail} onValueChange={(value) => actions.changeShowThumbnail(value)} renderSegment={false}/>
63+
<RowItemWithSwitcher title="自动刷新首页数据" icon="md-refresh" iconColor='#ffd700' switcherValue={true} onValueChange={(value) => {}} renderSegment={false}/>
6464
</View>
6565
<View style={[styles.block, {borderTopColor: segmentColor, borderBottomColor: segmentColor}]}>
6666
<RowItem title="关于作者" icon="md-happy" iconColor="#9acd32" renderSegment={false} onPress={this._itemClickCallback.bind(this, 4)}/>

0 commit comments

Comments
 (0)