forked from lee-tricia/clinic-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signupClinic.js
187 lines (162 loc) · 5.58 KB
/
signupClinic.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
import React, { useState } from 'react';
import { StyleSheet, Text, View, TextInput, TouchableOpacity, TouchableWithoutFeedback, Keyboard } from 'react-native';
import { RadioButton } from 'react-native-paper';
export default function signupClinic({ navigation, route }) {
const [userType, setUserType] = useState('clinic');
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [password2, setPassword2] = useState("");
const [officeNum, setOfficeNum] = useState("");
const [address, setAddress] = useState("");
function login() {
navigation.navigate("LoginStack");
}
function signup() {
if (email === "" || password === "" || password2 === "" || officeNum === "" || address === "") {
alert('Please enter all required fields *');
} else if (password != password2) {
alert('Please ensure that your confirmed password is correct ');
} else {
navigation.navigate("LoginStack");
}
}
return (
<View style={styles.container}>
<TouchableWithoutFeedback onPressOut={Keyboard.dismiss} accessible={false}>
<View style={styles.formStyle}>
<View style={{flexDirection:"row",alignItems:'center', marginBottom: 30}}>
<View style={{flex:1}}>
<RadioButton.Android
value="patient"
status={ userType === 'patient' ? 'checked' : 'unchecked' }
onPress={() => navigation.navigate("signupPatient")}
color={'#4a0f8c'}
//uncheckedColor={"#5b5b5c"}
/>
</View>
<View style={{flex:4}}>
<Text> Patient </Text>
</View>
<View style={{flex:1}}>
<RadioButton.Android
value="clinic"
status={ userType === 'clinic' ? 'checked' : 'unchecked' }
onPress={() => setUserType('clinic')}
color={'#4a0f8c'}
/>
</View>
<View style={{flex:4}}>
<Text> Clinic </Text>
</View>
</View>
<View style={{zIndex: 100}}>
<Text style={styles.label}>Email Address
<Text style={{color: "red"}}> * </Text>
</Text>
<TextInput
returnKeyType="next"
value={email}
onChangeText={(text) => setEmail(text)}
autoCapitalize="none"
autoCompleteType="email"
textContentType="emailAddress"
keyboardType="email-address"
placeholder="Enter your Email Address"
style={styles.textinput}
/>
</View>
<View style={{zIndex: 100}}>
<Text style={styles.label}>Password
<Text style={{color: "red"}}> * </Text>
</Text>
<TextInput
returnKeyType="next"
value={password}
onChangeText={(text) => setPassword(text)}
placeholder="Enter your Password"
style={styles.textinput}
secureTextEntry
/>
</View>
<View style={{zIndex: 100}}>
<Text style={styles.label}>Confirm Password
<Text style={{color: "red"}}> * </Text>
</Text>
<TextInput
returnKeyType="next"
value={password2}
onChangeText={(text) => setPassword2(text)}
placeholder="Re-Enter your Password"
style={styles.textinput}
secureTextEntry
/>
</View>
<View style={{zIndex: 100, }}>
<Text style={styles.label}>Office Number
<Text style={{color: "red"}}> * </Text>
</Text>
<TextInput
returnKeyType="next"
value={officeNum}
onChangeText={(text) => setOfficeNum(text)}
placeholder="Enter your Office Number"
style={[styles.textinput, { width: 200, }]}
keyboardType={'phone-pad'}
maxLength = {8}
/>
</View>
<View style={{zIndex: 100}}>
<Text style={styles.label}>Clinic Address
<Text style={{color: "red"}}> * </Text>
</Text>
<TextInput
returnKeyType="next"
value={address}
onChangeText={(text) => setAddress(text)}
placeholder="Enter your Address"
style={[styles.textinput, {height: 100, }]}
multiline={true}
/>
</View>
<TouchableOpacity onPress={() => signup() } style={styles.SignUpButton}>
<Text style={{color: "white", fontWeight:"bold"}}>Sign Up</Text>
</TouchableOpacity>
<Text> Already have an account? </Text>
<TouchableOpacity onPress={() => login() } >
<Text style={{textDecorationLine: 'underline'}}>Log In here!</Text>
</TouchableOpacity>
</View>
</TouchableWithoutFeedback>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
label: {
marginBottom: 10,
},
textinput: {
height: 40,
borderWidth: 1,
borderRadius: 10,
width: 300,
padding: 12,
paddingTop: 14,
marginBottom: 20,
},
SignUpButton: {
padding: 10,
marginBottom: 20,
borderRadius: 50,
alignItems: "center",
justifyContent: "center",
backgroundColor: "#0e8bad",
color: "white",
width: 100,
},
});