-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignup.js
More file actions
108 lines (104 loc) · 3.06 KB
/
Copy pathSignup.js
File metadata and controls
108 lines (104 loc) · 3.06 KB
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
import React, { useState } from 'react';
import { StyleSheet, Text, View, Button, TextInput, Image, SafeAreaView, TouchableOpacity, StatusBar, Alert } from "react-native";
import { createUserWithEmailAndPassword } from 'firebase/auth';
import { auth } from '../config/firebase';
const backImage = require("../assets/backImage.png");
export default function Signup({ navigation }) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const onHandleSignup = () => {
if (email !== '' && password !== '') {
createUserWithEmailAndPassword(auth, email, password)
.then(() => console.log('Signup success'))
.catch((err) => Alert.alert("Login error", err.message));
}
};
return (
<View style={styles.container}>
<Image source={backImage} style={styles.backImage} />
<View style={styles.whiteSheet} />
<SafeAreaView style={styles.form}>
<Text style={styles.title}>Sign Up</Text>
<TextInput
style={styles.input}
placeholder="Enter email"
autoCapitalize="none"
keyboardType="email-address"
textContentType="emailAddress"
autoFocus={true}
value={email}
onChangeText={(text) => setEmail(text)}
/>
<TextInput
style={styles.input}
placeholder="Enter password"
autoCapitalize="none"
autoCorrect={false}
secureTextEntry={true}
textContentType="password"
value={password}
onChangeText={(text) => setPassword(text)}
/>
<TouchableOpacity style={styles.button} onPress={onHandleSignup}>
<Text style={{fontWeight: 'bold', color: '#fff', fontSize: 18}}> Sign Up</Text>
</TouchableOpacity>
<View style={{marginTop: 20, flexDirection: 'row', alignItems: 'center', alignSelf: 'center'}}>
<Text style={{color: 'gray', fontWeight: '600', fontSize: 14}}>Don't have an account? </Text>
<TouchableOpacity onPress={() => navigation.navigate("Login")}>
<Text style={{color: '#f57c00', fontWeight: '600', fontSize: 14}}> Log In</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
<StatusBar barStyle="light-content" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
title: {
fontSize: 36,
fontWeight: 'bold',
color: "orange",
alignSelf: "center",
paddingBottom: 24,
},
input: {
backgroundColor: "#F6F7FB",
height: 58,
marginBottom: 20,
fontSize: 16,
borderRadius: 10,
padding: 12,
},
backImage: {
width: "100%",
height: 340,
position: "absolute",
top: 0,
resizeMode: 'cover',
},
whiteSheet: {
width: '100%',
height: '75%',
position: "absolute",
bottom: 0,
backgroundColor: '#fff',
borderTopLeftRadius: 60,
},
form: {
flex: 1,
justifyContent: 'center',
marginHorizontal: 30,
},
button: {
backgroundColor: '#f57c00',
height: 58,
borderRadius: 10,
justifyContent: 'center',
alignItems: 'center',
marginTop: 40,
},
});