-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignUp.js
269 lines (264 loc) · 6.56 KB
/
SignUp.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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
import React from 'react';
import {
StyleSheet,
View,
TouchableOpacity,
Text,
ScrollView,
} from 'react-native';
import EntypoIcon from 'react-native-vector-icons/Entypo';
import MaterialCommunityIconsIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import AppLogo from '../components/AppLogo';
import * as Google from 'expo-google-app-auth';
import * as Facebook from 'expo-facebook';
function SignUp({ navigation }) {
//google sign in
async function signInWithGoogleAsync() {
try {
const result = await Google.logInAsync({
androidClientId:
'24758434460-j2nngqcqh1k7idfbl97esegna48ad6rk.apps.googleusercontent.com',
scopes: ['profile', 'email'],
});
if (result.type === 'success') {
// return result.accessToken;
Alert.alert('Logged in!', `Welcome ${result.user.name}!`);
navigation.navigate('Tabs');
} else {
Alert.alert(
'Something went wrong',
'An issue occured while signing in'
);
// return { cancelled: true };
}
} catch (e) {
Alert.alert('Something went wrong', 'An issue occured while signing in');
// return { error: true };
}
}
//facebook login
async function facebookLogIn() {
try {
await Facebook.initializeAsync('441063166853184');
const {
type,
token,
expires,
permissions,
declinedPermissions,
} = await Facebook.logInWithReadPermissionsAsync({
permissions: ['public_profile'],
});
if (type === 'success') {
// Get the user's name using Facebook's Graph API
const response = await fetch(
`https://graph.facebook.com/me?access_token=${token}`
);
Alert.alert('Logged in!', `Hi ${(await response.json()).name}!`);
navigation.navigate('Tabs');
} else {
Alert.alert('Facebook Login Failed');
}
} catch ({ message }) {
Alert.alert('Facebook Login Failed', message);
}
}
return (
<ScrollView contentContainerStyle={styles.container}>
<AppLogo />
<View style={styles.rect}>
<TouchableOpacity style={styles.button} onPress={facebookLogIn}>
<View style={styles.iconRow}>
<EntypoIcon name='facebook' style={styles.icon}></EntypoIcon>
<Text style={styles.loremIpsum}>Sign up with Facebook</Text>
</View>
</TouchableOpacity>
<TouchableOpacity
style={styles.button1}
onPress={signInWithGoogleAsync}
>
<View style={styles.icon2Row}>
<MaterialCommunityIconsIcon
name='google'
style={styles.icon2}
// onPress={signIn}
></MaterialCommunityIconsIcon>
<Text style={styles.signInWithGoogle}>Sign up with Google</Text>
</View>
</TouchableOpacity>
<TouchableOpacity
style={styles.button2}
onPress={() => navigation.navigate('SignUpForm')}
>
<Text style={styles.loremIpsum2}>
Sign up with Email & Mobile Number
</Text>
</TouchableOpacity>
<Text style={styles.loremIpsum3}>
If you are Already user? Please Sign-in Below
</Text>
<TouchableOpacity
style={styles.button3}
onPress={() => navigation.navigate('SignInStack')}
>
<Text style={styles.signUp}>SIGN IN</Text>
</TouchableOpacity>
<Text style={styles.loremIpsum4}>
By creating or using an Account you agree to the
</Text>
<Text style={styles.loremIpsum5}>
ParkYouself Terms & Conditions and Privacy Policy
</Text>
</View>
</ScrollView>
);
}
const styles = StyleSheet.create({
container: {
// flex: 1,
backgroundColor: '#fff',
paddingTop: 50,
},
rect: {
height: 480,
backgroundColor: 'rgba(39,170,225,1)',
marginTop: 45,
alignItems: 'center',
},
button: {
width: 306,
height: 58,
backgroundColor: 'rgba(51,88,158,1)',
borderRadius: 5,
shadowColor: 'rgba(39,39,39,0.4)',
shadowOffset: {
width: 10,
height: 10,
},
elevation: 30,
shadowOpacity: 0.72,
shadowRadius: 50,
flexDirection: 'row',
marginTop: 40,
// marginLeft: 34,
},
icon: {
color: 'rgba(252,252,252,1)',
fontSize: 34,
height: 37,
width: 34,
},
loremIpsum: {
fontFamily: 'roboto-regular',
color: 'rgba(246,244,244,1)',
fontSize: 15,
marginLeft: 39,
marginTop: 9,
},
iconRow: {
height: 37,
flexDirection: 'row',
flex: 1,
marginRight: 73,
marginLeft: 15,
marginTop: 10,
},
button1: {
width: 306,
height: 58,
backgroundColor: 'rgba(234,66,53,1)',
borderRadius: 5,
shadowColor: 'rgba(101,101,101,1)',
shadowOffset: {
width: 10,
height: 10,
},
elevation: 30,
shadowOpacity: 0.44,
shadowRadius: 50,
flexDirection: 'row',
marginTop: 17,
// marginLeft: 34,
},
icon2: {
color: 'rgba(251,251,251,1)',
fontSize: 33,
height: 36,
width: 33,
},
signInWithGoogle: {
fontFamily: 'roboto-regular',
color: 'rgba(248,248,248,1)',
fontSize: 15,
marginLeft: 49,
marginTop: 9,
},
icon2Row: {
height: 36,
flexDirection: 'row',
flex: 1,
marginRight: 81,
marginLeft: 15,
marginTop: 10,
},
button2: {
width: 306,
height: 58,
borderRadius: 5,
shadowColor: 'rgba(60,60,60,1)',
shadowOffset: {
width: 10,
height: 10,
},
elevation: 30,
shadowOpacity: 0.44,
shadowRadius: 50,
backgroundColor: 'rgba(255,254,254,1)',
marginTop: 18,
// marginLeft: 34,
},
loremIpsum2: {
fontFamily: 'roboto-700',
color: 'rgba(92,159,188,1)',
fontSize: 15,
marginTop: 20,
marginLeft: 28,
},
loremIpsum3: {
fontFamily: 'roboto-regular',
color: 'rgba(252,250,250,1)',
opacity: 0.66,
letterSpacing: 0,
fontSize: 15,
marginTop: 30,
// marginLeft: 60,
},
button3: {
width: 306,
height: 49,
borderWidth: 1,
borderColor: 'rgba(225,221,221,1)',
marginTop: 18,
// marginLeft: 34,
},
signUp: {
fontFamily: 'roboto-500',
color: 'rgba(235,233,233,1)',
fontSize: 18,
marginTop: 13,
marginLeft: 119,
},
loremIpsum4: {
fontFamily: 'roboto-regular',
color: 'rgba(239,237,237,1)',
marginTop: 35,
// marginLeft: 38,
},
loremIpsum5: {
fontFamily: 'roboto-regular',
color: 'rgba(247,245,245,1)',
marginTop: 4,
// marginLeft: 31,
},
});
export default SignUp;