@@ -9,26 +9,38 @@ import {
9
9
Platform ,
10
10
TouchableWithoutFeedback ,
11
11
Keyboard ,
12
+ TouchableOpacity ,
12
13
} from "react-native" ;
13
14
import { LogInEmailInput , LogInPasswordInput } from "../Common/CustomInputs" ;
14
- import { LogInButton } from "../Common/AuthButtons" ;
15
+ import { LogInButton , ExternalLoginButton } from "../Common/AuthButtons" ;
15
16
import { useLocalSearchParams , useRouter } from "expo-router" ;
16
17
import { appSignIn } from "../../services/store" ;
17
- import { AuthenticationErrorMessage , AuthenticationResponse } from "./AuthenticationResponse" ;
18
+ import {
19
+ AuthenticationErrorMessage ,
20
+ AuthenticationResponse ,
21
+ } from "./AuthenticationResponse" ;
22
+ import { ArrowLeftCircle } from "react-native-feather" ;
18
23
19
24
const LoginScreen = ( ) => {
20
25
const router = useRouter ( ) ;
21
26
const [ fontsLoaded , fontError ] = useFonts ( {
22
- "Gilroy-ExtraBold " : require ( "../../../assets/fonts/Gilroy-ExtraBold.otf " ) ,
23
- "Gilroy-Light " : require ( "../../../assets/fonts/Gilroy-Light.otf " ) ,
27
+ "Quicksand-Bold " : require ( "../../../assets/fonts/Quicksand-Bold.ttf " ) ,
28
+ "Quicksand-Medium " : require ( "../../../assets/fonts/Quicksand-Medium.ttf " ) ,
24
29
} ) ;
25
30
26
31
const { inputEmail } = useLocalSearchParams ( ) ;
27
32
const [ email , setEmail ] = React . useState < string > ( "" ) ;
28
33
const [ password , setPassword ] = React . useState < string > ( "" ) ;
29
- const [ authResponse , setAuthResponse ] = React . useState < AuthenticationResponse > ( ) ;
34
+ const [ authResponse , setAuthResponse ] =
35
+ React . useState < AuthenticationResponse > ( ) ;
30
36
const [ invalidLogin , invalidateLogin ] = React . useState < boolean > ( false ) ; // Possbily change this?
31
37
38
+ const externalLoginIcons = {
39
+ google : require ( "../../../assets/google_logo.png" ) ,
40
+ facebook : require ( "../../../assets/facebook_logo.png" ) ,
41
+ apple : require ( "../../../assets/apple_logo.png" ) ,
42
+ } ;
43
+
32
44
// Sign in function with email and password
33
45
const onHandleSubmit = async ( ) => {
34
46
Keyboard . dismiss ( ) ;
@@ -43,7 +55,7 @@ const LoginScreen = () => {
43
55
console . log ( authResponse . error ) ;
44
56
invalidateLogin ( true ) ;
45
57
}
46
- } , [ authResponse ] )
58
+ } , [ authResponse ] ) ;
47
59
48
60
useEffect ( ( ) => {
49
61
setEmail ( inputEmail ?. toString ( ) || "" ) ; // On load of the page, set the email to the inputEmail if they entered it!
@@ -53,41 +65,117 @@ const LoginScreen = () => {
53
65
return null ;
54
66
}
55
67
68
+ const handleGoogleSignIn = async ( ) => {
69
+ console . log ( "Google Sign In" ) ;
70
+ } ;
71
+
72
+ const handleFacebookSignIn = async ( ) => {
73
+ console . log ( "Facebook Sign In" ) ;
74
+ } ;
75
+
76
+ const handleAppleSignIn = async ( ) => {
77
+ console . log ( "Apple Sign In" ) ;
78
+ } ;
79
+
80
+ const handleGithubSignIn = async ( ) => {
81
+ console . log ( "Github Sign In" ) ;
82
+ } ;
83
+
56
84
return (
57
85
< TouchableWithoutFeedback onPress = { Keyboard . dismiss } >
58
86
< View >
59
- < KeyboardAvoidingView
60
- behavior = { Platform . OS === "ios" ? "padding" : undefined }
61
- >
62
- < View style = { styles . main_container } >
63
- < View style = { styles . header_container } >
64
- < Text style = { styles . header_text } > Welcome back!</ Text >
65
- </ View >
66
- < View style = { styles . input_container } >
67
- < LogInEmailInput
68
- value = { email }
69
- onChangeText = { ( text ) => setEmail ( text ) }
70
- invalid = { invalidLogin }
71
- />
72
- < LogInPasswordInput
73
- value = { password }
74
- onChangeText = { ( text ) => setPassword ( text ) }
75
- invalid = { invalidLogin }
76
- />
77
- </ View >
78
- < View style = { styles . button_container } >
79
- < LogInButton onPress = { onHandleSubmit } />
87
+ < View style = { styles . main_container } >
88
+ < TouchableOpacity
89
+ onPress = { ( ) => router . back ( ) }
90
+ style = { styles . back_button }
91
+ >
92
+ < ArrowLeftCircle
93
+ color = { "black" }
94
+ strokeWidth = { 1.4 }
95
+ width = { 34 }
96
+ height = { 34 }
97
+ />
98
+ </ TouchableOpacity >
99
+ < View style = { styles . header_container } >
100
+ < Text style = { styles . header_text } > Welcome back!</ Text >
101
+ < Text style = { styles . subheader_text } > How have you been?</ Text >
102
+ </ View >
103
+ < View style = { styles . input_container } >
104
+ < LogInEmailInput
105
+ value = { email }
106
+ onChangeText = { ( text ) => setEmail ( text ) }
107
+ invalid = { invalidLogin }
108
+ />
109
+ < LogInPasswordInput
110
+ value = { password }
111
+ onChangeText = { ( text ) => setPassword ( text ) }
112
+ invalid = { invalidLogin }
113
+ />
114
+ </ View >
115
+ < View style = { styles . button_container } >
116
+ < LogInButton onPress = { onHandleSubmit } />
117
+ </ View >
118
+ < TouchableOpacity >
119
+ < Text
120
+ style = { [ styles . regular_text , { textDecorationLine : "underline" } ] }
121
+ >
122
+ Forgot password?
123
+ </ Text >
124
+ </ TouchableOpacity >
125
+ < View style = { styles . divider_container } >
126
+ < View style = { styles . horizontal_line } />
127
+ < View >
128
+ < Text style = { [ styles . regular_text , { marginHorizontal : 10 } ] } >
129
+ Or Login With
130
+ </ Text >
80
131
</ View >
132
+ < View style = { styles . horizontal_line } />
81
133
</ View >
82
- </ KeyboardAvoidingView >
83
134
84
- < View style = { styles . error_container } >
85
- < AuthenticationErrorMessage response = { authResponse } onPress = { ( ) => {
86
- setAuthResponse ( undefined )
87
- invalidateLogin ( false )
88
- } } />
135
+ < View style = { styles . externalLinkContainer } >
136
+ < ExternalLoginButton
137
+ onPress = { handleGoogleSignIn }
138
+ companyName = "google"
139
+ />
140
+ < ExternalLoginButton
141
+ onPress = { handleAppleSignIn }
142
+ companyName = "apple"
143
+ />
144
+ < ExternalLoginButton
145
+ onPress = { handleFacebookSignIn }
146
+ companyName = "facebook"
147
+ />
148
+ < ExternalLoginButton
149
+ onPress = { handleGithubSignIn }
150
+ companyName = "github"
151
+ />
152
+ </ View >
153
+ < View style = { styles . footer_text_container } >
154
+ < Text style = { styles . footer_text } > Don't have an account?</ Text >
155
+ < TouchableOpacity
156
+ onPress = { ( ) => router . replace ( { pathname : "/signup" } ) }
157
+ >
158
+ < Text
159
+ style = { [
160
+ styles . footer_text ,
161
+ { color : "#5dbea3" , textDecorationLine : "underline" } ,
162
+ ] }
163
+ >
164
+ Sign up
165
+ </ Text >
166
+ </ TouchableOpacity >
167
+ </ View >
89
168
</ View >
90
169
170
+ < View style = { styles . error_container } >
171
+ < AuthenticationErrorMessage
172
+ response = { authResponse }
173
+ onPress = { ( ) => {
174
+ setAuthResponse ( undefined ) ;
175
+ invalidateLogin ( false ) ;
176
+ } }
177
+ />
178
+ </ View >
91
179
</ View >
92
180
</ TouchableWithoutFeedback >
93
181
@@ -102,8 +190,12 @@ const styles = StyleSheet.create({
102
190
display : "flex" ,
103
191
height : "100%" ,
104
192
width : "100%" ,
105
- justifyContent : "center " ,
193
+ justifyContent : "flex-start " ,
106
194
alignItems : "center" ,
195
+ paddingHorizontal : Dimensions . get ( "window" ) . width * 0.11 ,
196
+ paddingVertical : Dimensions . get ( "window" ) . height * 0.01 ,
197
+ backgroundColor : "white" ,
198
+ gap : Dimensions . get ( "window" ) . height * 0.029 ,
107
199
} ,
108
200
109
201
//This is an example of where the error message could be
@@ -112,7 +204,7 @@ const styles = StyleSheet.create({
112
204
justifyContent : "space-around" ,
113
205
alignItems : "center" ,
114
206
width : "100%" ,
115
- bottom : Dimensions . get ( "window" ) . height * 0.10 ,
207
+ top : Dimensions . get ( "window" ) . height * 0.1 ,
116
208
position : "absolute" ,
117
209
} ,
118
210
@@ -134,13 +226,60 @@ const styles = StyleSheet.create({
134
226
header_container : {
135
227
display : "flex" ,
136
228
justifyContent : "center" ,
137
- alignItems : "center " ,
229
+ alignItems : "flex-start " ,
138
230
width : "100%" ,
231
+ marginBottom : Dimensions . get ( "window" ) . height * 0.019 ,
232
+ marginTop : Dimensions . get ( "window" ) . height * 0.23 ,
139
233
} ,
140
234
141
235
header_text : {
142
- fontFamily : "Gilroy-ExtraBold" ,
143
- fontSize : 30 ,
236
+ fontFamily : "Quicksand-Bold" ,
237
+ fontSize : 37 ,
238
+ marginBottom : Dimensions . get ( "window" ) . height * 0.01 ,
239
+ } ,
240
+ subheader_text : {
241
+ fontFamily : "Quicksand-Medium" ,
242
+ fontSize : 20 ,
243
+ } ,
244
+ regular_text : {
245
+ fontFamily : "Quicksand-Medium" ,
246
+ color : "#8E8E8E" ,
247
+ } ,
248
+ horizontal_line : {
249
+ flex : 1 ,
250
+ height : 1 ,
251
+ backgroundColor : "#8E8E8E" ,
252
+ } ,
253
+ externalLinkContainer : {
254
+ display : "flex" ,
255
+ flexDirection : "row" ,
256
+ justifyContent : "space-between" ,
257
+ alignItems : "center" ,
258
+ width : "100%" ,
259
+ } ,
260
+ footer_text : {
261
+ fontFamily : "Quicksand-Bold" ,
262
+ color : "black" ,
263
+ fontSize : 15 ,
264
+ } ,
265
+ footer_text_container : {
266
+ display : "flex" ,
267
+ flexDirection : "row" ,
268
+ justifyContent : "center" ,
269
+ alignItems : "flex-end" ,
270
+ gap : 7 ,
271
+ flex : 1 ,
272
+ paddingBottom : Dimensions . get ( "window" ) . height * 0.01 ,
273
+ } ,
274
+ divider_container : {
275
+ flexDirection : "row" ,
276
+ alignItems : "center" ,
277
+ marginVertical : Dimensions . get ( "window" ) . height * 0.011 ,
278
+ } ,
279
+ back_button : {
280
+ position : "absolute" ,
281
+ top : Dimensions . get ( "window" ) . height * 0.075 ,
282
+ left : Dimensions . get ( "window" ) . width * 0.075 ,
144
283
} ,
145
284
} ) ;
146
285
0 commit comments