SettingMessage.js
5.14 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/**
* Created by jone on 2017/4/10.
*/
import React,
{
Component
} from "react";
import ReactNative,{
View,
Text,
TouchableWithoutFeedback,
StyleSheet,
TouchableOpacity,
ScrollView,
Dimensions,
Platform,
} from "react-native";
import SettingCell from '../components/common/SettingCell';
import MoreAppCell from '../components/common/MoreAppCell';
export default class SettingMessage extends Component {
constructor(props) {
super(props);
}
_renderLoginView(isLogin){
if (isLogin){
return (
<TouchableOpacity
activeOpacity={0.5}
onPress={
() => this.props.onPressItem && this.props.onPressItem(11)
}
>
<View style={styles.loginOutStyle}>
<Text style={styles.loginOutTvStyle}>
退出登录
</Text>
</View>
</TouchableOpacity>
);
}
}
_renderTouchView(){
if (Platform.OS === 'ios'){
return (
<SettingCell
leftText="使用Touch ID登录"
orderId = "6"
isSwitch = {true}
onPressItem = {this.props.onPressItem}
/>
);
}
}
render() {
let {data} = this.props;
let isSwitchOpen = data.settingInfo.isOpenGprs;
let isLogin = data.settingInfo.isLogin;
let hasNew = data.versionInfo.hasNew;
return (
<ScrollView>
<TouchableOpacity
activeOpacity={0.5}
onPress={
() => this.props.onPressItem && this.props.onPressItem(1)
}
>
<SettingCell
leftText="消息推送"
orderId = "1"
onPressItem = {this.props.onPressItem}
cellData = {data}
isGide = {true}
isPush = {true}
/>
</TouchableOpacity>
<SettingCell
leftText="2G/3G网络显示原图"
orderId = "2"
isSwitch = {isSwitchOpen}
onPressItem = {this.props.onPressItem}
/>
<TouchableOpacity
activeOpacity={0.5}
onPress={
() => this.props.onPressItem && this.props.onPressItem(3)
}
>
<SettingCell
leftText="清除缓存"
orderId = "3"
rightTv = {data.settingInfo.cache}
/>
</TouchableOpacity>
{this._renderTouchView()}
<View style={{marginTop:20}}>
<TouchableOpacity
activeOpacity={0.5}
onPress={
() => this.props.onPressItem && this.props.onPressItem(4)
}
>
<SettingCell
leftText="关于我们"
orderId = "4"
isGide = {true}
isNew = {hasNew}
/>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={0.5}
onPress={
() => this.props.onPressItem && this.props.onPressItem(5)
}
>
<SettingCell
leftText="推荐有货给好友"
orderId = "5"
isGide = {true}
/>
</TouchableOpacity>
</View>
<View style={{marginTop:20}}>
<MoreAppCell
onPressItem = {this.props.onPressItem}
/>
</View>
{this._renderLoginView(isLogin)}
</ScrollView>
);
}
};
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
leftViewStyle: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 8
},
leftImgStyle: {
width: 24,
height: 24,
marginRight: 6,
},
titleHelighted: {
color: 'black',
fontSize: 15,
},
titleNormal: {
color: '#b0b0b0',
fontSize: 15,
},
titleSelected: {
color: 'black',
fontSize: 15,
},
loginOutStyle:{
height:45,
backgroundColor: '#d0021b',
borderRadius: 4,
alignItems: 'center',
justifyContent:'center',
margin:25
},
loginOutTvStyle: {
color: 'white',
textAlign: 'center',
fontSize: 15,
},
});