-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathlogin.tsx
98 lines (90 loc) · 2.34 KB
/
login.tsx
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
import React, { useState } from "react";
import {
View,
StyleSheet,
KeyboardAvoidingView,
Platform,
ScrollView,
} from "react-native";
import CustomTextInput from "@/components/ui/common/CustomTextInput";
import CustomTitle from "@/components/ui/common/CustomTitle";
import CustomSubmitButton from "@/components/ui/common/CustomSubmitButton";
const LoginScreen = () => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const isLoginEnabled = email.length > 0 && password.length > 0;
console.log(isLoginEnabled);
const handleLogIn = () => {};
return (
<KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
style={styles.keyboardContainer}>
<ScrollView contentContainerStyle={styles.scrollContainer}>
<CustomTitle title="Log In" />
<CustomTextInput
label="Email"
placeholder="Enter your email"
value={email}
onChangeText={setEmail}
keyboardType="email-address"
error={false}
/>
<CustomTextInput
label="Password"
placeholder="Enter your password"
secureTextEntry
value={password}
onChangeText={setPassword}
error={false}
/>
<View style={styles.buttonContainer}>
<CustomSubmitButton
title="log in"
onPress={handleLogIn}
disabled={isLoginEnabled}
style={
(isLoginEnabled ? styles.buttonActive : styles.buttonDisabled,
[{ textTransform: "uppercase" }])
}
/>
</View>
</ScrollView>
</KeyboardAvoidingView>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: "white",
},
keyboardContainer: {
flex: 1,
},
scrollContainer: {
flex: 1,
justifyContent: "center",
paddingHorizontal: 20,
},
buttonContainer: {
paddingVertical: 13,
alignItems: "center",
},
buttonActive: {
backgroundColor: "#61892F",
paddingVertical: 15,
width: "100%",
alignItems: "center",
},
buttonDisabled: {
backgroundColor: "gray",
opacity: 0.5,
paddingVertical: 15,
width: "100%",
alignItems: "center",
},
buttonText: {
fontSize: 18,
fontWeight: "bold",
color: "white",
},
});
export default LoginScreen;