remindSetting.js
10.3 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/**
* Created by Cassie on 2018/05/14
*/
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Image,
Animated,
InteractionManager
} from 'react-native';
import {width,zoomW,zoomH} from '../../utils/getSize';
import {NoDoublePress} from '../../utils/utils';
const back = require('../../img/returnB.png');
const selected = require('../../img/selectedG.png');
export default class RemindSetting extends Component {
static navigationOptions = ({ navigation, screenProps }) => ({
title:'提醒',
headerLeft:(<View style={{flex:1,display:'flex',flexDirection:'row'}}>
<TouchableOpacity style={styles.topIcon} onPress={navigation.state.params?navigation.state.params.back:null}>
<Image source={back} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</TouchableOpacity>
</View>),
headerRight:(<View style={{flex:1,display:'flex',flexDirection:'row'}} />)
});
constructor(props){
super(props);
this.state = {
left:new Animated.Value(2/zoomH),
timeLeft:new Animated.Value(2/zoomH),
background:'#c6c6c6',
timeBackground:'#c6c6c6',
showSetting:false,
showTimeSetting:false
};
};
componentWillMount(){};
componentDidMount(){
this.props.navigation.setParams({
back:()=>{
NoDoublePress.onPress(() => {
InteractionManager.runAfterInteractions(() => {this.props.navigation.goBack();})
})
}
});
};
/*是否打开提醒*/
isTop(type){
if(type == 'top'){
if(this.state.background == '#c6c6c6'){
this.setState({
background:'#00be3c',
showSetting:true
});
Animated.timing(
this.state.left,
{toValue:(32/zoomH),duration:200}
).start();
}else if(this.state.background == '#00be3c'){
this.setState({
background:'#c6c6c6',
showSetting:false
});
Animated.timing(
this.state.left,
{toValue:(2/zoomH),duration:200}
).start();
}
}else if(type == 'time'){
if(this.state.timeBackground == '#c6c6c6'){
this.setState({
timeBackground:'#00be3c',
showTimeSetting:true
});
Animated.timing(
this.state.timeLeft,
{toValue:(32/zoomH),duration:200}
).start();
}else if(this.state.timeBackground == '#00be3c'){
this.setState({
timeBackground:'#c6c6c6',
showTimeSetting:false
});
Animated.timing(
this.state.timeLeft,
{toValue:(2/zoomH),duration:200}
).start();
}
}
};
componentWillUnmount(){
this.setState = (state,callback)=>{
return;
};
};
render(){
return(
<View style={styles.background}>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>任务动态推送</Text>
</View>
<TouchableOpacity activeOpacity={0.8} style={[styles.topBtn,{backgroundColor:this.state.background}]} onPress={() => NoDoublePress.onPress(() => {this.isTop('top')})}>
<Animated.View style={[styles.circleDot,{left:this.state.left}]} />
</TouchableOpacity>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>全部提醒</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={[styles.settingItem,{marginBottom:(20/zoomH)}]}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>回复我的</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>时间提醒</Text>
</View>
<TouchableOpacity activeOpacity={0.8} style={[styles.topBtn,{backgroundColor:this.state.timeBackground}]} onPress={() => NoDoublePress.onPress(() => {this.isTop('time')})}>
<Animated.View style={[styles.circleDot,{left:this.state.timeLeft}]} />
</TouchableOpacity>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束时</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前5分钟</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前10分钟</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前15分钟</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前30分钟</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前1小时</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前2小时</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
<View style={styles.settingItem}>
<View style={{flex:1}}>
<Text style={{fontSize:17,color:'#000'}}>结束前一天</Text>
</View>
<View style={{width:(50/zoomW),display:'flex',justifyContent:'center',alignItems:'center'}}>
<Image source={selected} style={{width:(16/zoomH),height:(16/zoomH)}} resizeMode="contain" />
</View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
topIcon:{
paddingLeft:(10/zoomW),
paddingRight:(10/zoomW),
height:'100%',
display:'flex',
justifyContent:'center'
},
background:{
flex:1,
backgroundColor:'#ececf1',
display:'flex',
alignItems:'center',
paddingLeft:(15/zoomW)
},
settingItem:{
width:width,
height:(42/zoomH),
backgroundColor:'#fff',
display:'flex',
flexDirection:'row',
alignItems:'center',
marginLeft:-(15/zoomW),
borderBottomWidth:StyleSheet.hairlineWidth,
borderBottomColor:'#eee',
borderStyle:'solid',
paddingLeft:(15/zoomW),
paddingRight:(15/zoomW)
},
topBtn:{
width:(60/zoomH),
height:(30/zoomH),
borderRadius:(15/zoomH),
display:'flex',
justifyContent:'center'
},
circleDot:{
width:(26/zoomH),
height:(26/zoomH),
backgroundColor:'#fff',
borderRadius:(13/zoomH),
position:'absolute'
}
});