-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSelect.js
206 lines (195 loc) · 5.24 KB
/
Select.js
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
import React, { Component } from "react";
import {
View,
Dimensions,
AsyncStorage,
Text,
Image,
TouchableOpacity
} from "react-native";
import { showMessage } from "react-native-flash-message";
import { Actions } from "react-native-router-flux";
import { strings } from "./locales/strings";
class Select extends Component {
state = {
isLoadingLocale: true
};
componentDidMount() {
this.getLocale();
}
async getLocale() {
try {
const value = await AsyncStorage.getItem("locale");
if (value) {
strings.setLanguage(value);
}
this.setState({
isLoading: false
});
} catch (error) {
console.log("error", error);
}
}
checkUserVerification = async () => {
try {
const token = await AsyncStorage.getItem("token");
const formdata = new FormData();
formdata.append("token", token);
const req = {
method: "POST",
headers: {
"Content-Type": "multipart/form-data"
},
body: formdata
};
const response = await fetch(
"http://bccms.naxa.com.np/core/api/verify",
req
);
const json = await response.json();
if (json.data && json.status === 200) {
Actions.Address();
} else {
showMessage({
message: "Verification Required",
description:
"You need to be verified by our admin to access this feature. It takes couple of hours for the process.",
type: "info"
});
}
} catch (error) {
console.log("CheckUserVerification Error", error);
}
};
render() {
const { height, width } = Dimensions.get("window");
console.log("SElect render");
return (
<View style={{ position: "relative", overflow: "hidden" }}>
<View
style={{
height: 30,
position: "absolute",
left: -5,
right: -5,
top: (height - 56) / 2 - 15,
backgroundColor: "#FFF",
zIndex: 10,
transform: [{ rotate: "4deg" }]
}}
/>
<TouchableOpacity
onPress={this.checkUserVerification}
activeOpacity={0.6}
>
<View
style={{ position: "relative", height: (height - 56) / 2, width }}
>
<View
style={{
position: "absolute",
zIndex: 9,
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: "#00A2E8",
opacity: 0.7
}}
/>
<Image
style={{ height: height / 2, width }}
source={require("./app_images/schools_background.jpg")}
blurRadius={5}
/>
<View
style={{
position: "absolute",
left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex: 10,
alignItems: "center",
justifyContent: "center"
}}
>
<Text
style={{
fontWeight: "bold",
fontSize: 30,
color: "white",
textAlign: "center"
}}
>
{strings.view_schools_title}
</Text>
<Text
style={{ color: "white", fontSize: 20, textAlign: "center" }}
>
{strings.view_schools_subtitle}
</Text>
</View>
</View>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
Actions.Select2();
}}
activeOpacity={0.6}
>
<View
style={{ position: "relative", height: (height - 56) / 2, width }}
>
<View
style={{
position: "absolute",
zIndex: 9,
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: "#22B14C",
opacity: 0.7
}}
/>
<Image
style={{ height: (height - 56) / 2, width }}
source={require("./app_images/guidelines_background.jpg")}
blurRadius={5}
/>
<View
style={{
position: "absolute",
left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex: 10,
alignItems: "center",
justifyContent: "center"
}}
>
<Text
style={{
fontWeight: "bold",
fontSize: 30,
color: "white",
textAlign: "center"
}}
>
{strings.view_guidelines_title}
</Text>
<Text
style={{ color: "white", fontSize: 20, textAlign: "center" }}
>
{strings.view_guidelines_subtitle}
</Text>
</View>
</View>
</TouchableOpacity>
</View>
);
}
}
export default Select;