-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.js
168 lines (144 loc) · 7.1 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
import React from 'react'
import { View, Text, TouchableOpacity,TextInput,StyleSheet, StatusBar, ScrollView } from 'react-native'
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import AntDesignIcon from 'react-native-vector-icons/AntDesign';
import LinearGradient from 'react-native-linear-gradient';
import auth from '@react-native-firebase/auth';
import AnimatedLottieView from 'lottie-react-native';
const signup = ({navigation}) => {
const [text, onChangeText] = React.useState(null);
const [number, onChangeNumber] = React.useState(null);
const [name, onChangeName] = React.useState(null);
const handleSignUp = () => {
auth()
.createUserWithEmailAndPassword(number, text)
.then(() => {
console.log('User account created & signed in!');
})
.catch(error => {
if (error.code === 'auth/email-already-in-use') {
console.log('That email address is already in use!');
}
if (error.code === 'auth/invalid-email') {
console.log('That email address is invalid!');
}
console.error(error);
});
}
return (
<View style={{flex:1,backgroundColor:'#fff',padding:20}}>
<ScrollView>
<StatusBar backgroundColor="transparent" />
<View style={{flex:1,flexDirection:'row',margin:10,justifyContent:'flex-start',alignItems:'center'}}>
<TouchableOpacity style={{width:50,height:50, borderRadius:10, backgroundColor:'#da855e',marginEnd:20, elevation:5, borderColor:'#212121',borderWidth:2,justifyContent:'center',alignItems:'center'}}
onPress={()=>navigation.popToTop()}>
<MaterialIcon name="keyboard-arrow-left" size={45} color="#212121" />
</TouchableOpacity>
<Text style={{fontSize:36,color:"#212121",fontFamily:"BeautyMountains"}}>Sign Up</Text>
<View style={{flex:1,flexDirection:'row',height:"100%",width:"100%",justifyContent:'flex-end',alignContent:'flex-end',alignSelf:'flex-end',marginLeft:50}}>
<AnimatedLottieView source={require('./assets/diamond.json')} autoPlay loop style={{flex:1,alignSelf:'flex-end'}} />
</View>
</View>
<View style={{marginTop:40,justifyContent:'center'}}>
<Text style={{color:'#707070',fontSize:17,marginLeft:10}}>Sign Up with one of the following options</Text>
<View style={{marginTop:10,flexDirection:'row',justifyContent:'center',alignItems:'center',marginLeft:20,marginEnd:20}}>
<TouchableOpacity style={{width:170,height:70, borderRadius:20, backgroundColor:'#fff',marginEnd:20, elevation:10,justifyContent:'center',alignItems:'center'}}>
<AntDesignIcon name="google" size={35} color="#212121" />
</TouchableOpacity>
<TouchableOpacity style={{width:170,height:70, borderRadius:20, backgroundColor:'#fff', elevation:10,justifyContent:'center',alignItems:'center'}}>
<MaterialIcon name="facebook" size={40} color="#212121" />
</TouchableOpacity>
</View>
<View>
<Text style={{color:'#212121',fontSize:17,fontWeight:'bold',marginLeft:10,marginTop:20}}>Name</Text>
<View>
<TextInput
style={styles.input}
onChangeText={(name)=>onChangeName(name)}
value={name}
placeholder="Enter Name"
placeholderTextColor='#707070'
selectionColor='#da855e'
textContentType="name"
color="#212112"
fontSize={17}
padding={20}
/>
</View>
</View>
<View>
<Text style={{color:'#212121',fontSize:17,fontWeight:'bold',marginLeft:10,marginTop:10}}>Email</Text>
<View>
<TextInput
style={styles.input}
onChangeText={(email)=>onChangeNumber(email)}
value={number}
placeholder="Enter Email"
placeholderTextColor='#707070'
selectionColor='#da855e'
textContentType="emailAddress"
color="#212121"
fontSize={17}
padding={20}
/>
</View>
</View>
<View>
<Text style={{color:'#212121',fontSize:17,fontWeight:'bold',marginLeft:10,marginTop:10}}>Password</Text>
<View>
<TextInput
style={styles.input}
onChangeText={(password)=>onChangeText(password)}
value={text}
placeholder="Enter Password"
placeholderTextColor='#707070'
selectionColor='#da855e'
textContentType="password"
color="#212121"
fontSize={17}
padding={20}
secureTextEntry/>
</View>
<TouchableOpacity style={{height: 60,
borderRadius:20,
margin: 12,
elevation:10,
justifyContent:'center',
alignItems:'center',
marginTop:20}} onPress={handleSignUp}>
<LinearGradient style={styles.linearGradient} start={{x: 0, y: 0.75}} end={{x: 1, y: 0.25}} colors={['#da855e', '#ffae6d', '#da855e']}>
<Text style={{color:'#fff',fontWeight:'bold',fontSize:20}}>Create Account</Text>
</LinearGradient>
</TouchableOpacity>
<View style={{flexDirection:'row', justifyContent:'center',alignContent:'center',marginTop:10}}>
<Text style={{color:'#fff',alignSelf:'center'}}>Already have An Account? </Text>
<TouchableOpacity style={{alignSelf:'center'}} onPress={()=>navigation.goBack()}><Text style={{color:'#da855e',fontWeight:'bold',fontSize:16}}>Log In</Text></TouchableOpacity>
</View>
</View>
</View>
</ScrollView>
</View>
)
}
export default signup
const styles = StyleSheet.create({
input: {
height: 66,
backgroundColor:'#fff',
elevation:10,
borderRadius:10,
margin: 12,
borderWidth: 2,
padding: 10,
borderColor:'#da855e',
color:'#212121'
},
linearGradient: {
height:'100%',
width:'100%',
flex:1,
borderRadius: 20,
justifyContent:'center',
alignItems:'center'
},
})