1
- import React , { Component } from 'react' ;
1
+ import React , { Component , useState } from 'react' ;
2
2
import { KeyboardAvoidingView , Image , StyleSheet , View , TextInput , TouchableOpacity , Text , Navigitor } from 'react-native' ;
3
3
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
4
4
import { Actions } from 'react-native-router-flux' ;
5
5
6
6
export default function SignUp ( { navigation} ) {
7
- var emailInput = ""
8
- var passwordInput = ""
9
- var addressInput = ""
10
- var numberInput = ""
11
- var passwordInput = ""
12
- var confirmPasswordInput = ""
7
+
8
+ const [ name , setName ] = useState ( )
9
+ const [ email , setEmail ] = useState ( )
10
+ const [ address , setAddress ] = useState ( )
11
+ const [ phonenumber , setPhonenumber ] = useState ( )
12
+ const [ password , setPassword ] = useState ( )
13
+ const [ confirmPassword , setConfirmPassword ] = useState ( )
14
+
15
+ const createUser = ( ) => {
16
+ // Firebase stuff!
17
+ console . log ( name )
18
+ console . log ( email )
19
+ console . log ( address )
20
+ console . log ( phonenumber )
21
+ console . log ( password )
22
+ console . log ( confirmPassword )
23
+ }
13
24
14
25
return (
15
26
< KeyboardAwareScrollView
@@ -31,8 +42,9 @@ export default function SignUp({navigation}){
31
42
< TextInput
32
43
placeholder = "Name of Organization"
33
44
returnKeyType = "next"
34
- onSubmitEditing = { ( ) => emailInput . focus ( ) }
45
+ onSubmitEditing = { ( ) => { secondTextInput . focus ( ) ; } }
35
46
keyboardType = "email-address"
47
+ onChangeText = { text => setName ( text ) }
36
48
style = { styles . input }
37
49
autoCapitalize = "none"
38
50
autoCorrect = { false }
@@ -42,8 +54,9 @@ export default function SignUp({navigation}){
42
54
< TextInput
43
55
placeholder = "E-mail"
44
56
returnKeyType = "next"
45
- onSubmitEditing = { ( ) => numberInput . focus ( ) }
46
- ref = { ( ( input ) => emailInput = input ) }
57
+ ref = { ( input ) => { secondTextInput = input ; } }
58
+ onSubmitEditing = { ( ) => thirdTextInput . focus ( ) }
59
+ onChangeText = { text => setEmail ( text ) }
47
60
keyboardType = "email-address"
48
61
style = { styles . input }
49
62
autoCapitalize = "none"
@@ -54,8 +67,9 @@ export default function SignUp({navigation}){
54
67
< TextInput
55
68
placeholder = "Phone number"
56
69
returnKeyType = "next"
57
- onSubmitEditing = { ( ) => addressInput . focus ( ) }
58
- ref = { ( ( input ) => numberInput = input ) }
70
+ ref = { ( input ) => { thirdTextInput = input ; } }
71
+ onSubmitEditing = { ( ) => fourthTextInput . focus ( ) }
72
+ onChangeText = { text => setPhonenumber ( text ) }
59
73
keyboardType = "email-address"
60
74
style = { styles . input }
61
75
autoCapitalize = "none"
@@ -65,8 +79,9 @@ export default function SignUp({navigation}){
65
79
< TextInput
66
80
placeholder = "Address"
67
81
returnKeyType = "next"
68
- onSubmitEditing = { ( ) => passwordInput . focus ( ) }
69
- ref = { ( ( input ) => addressInput = input ) }
82
+ ref = { ( input ) => { fourthTextInput = input ; } }
83
+ onSubmitEditing = { ( ) => fifthTextInput . focus ( ) }
84
+ onChangeText = { text => setAddress ( text ) }
70
85
keyboardType = "email-address"
71
86
style = { styles . input }
72
87
autoCapitalize = "none"
@@ -76,23 +91,24 @@ export default function SignUp({navigation}){
76
91
< TextInput
77
92
placeholder = "Password"
78
93
returnKeyType = "next"
94
+ ref = { ( input ) => { fifthTextInput = input ; } }
79
95
secureTextEntry
80
- onSubmitEditing = { ( ) => confirmPasswordInput . focus ( ) }
81
- ref = { ( ( input ) => passwordInput = input ) }
96
+ onSubmitEditing = { ( ) => sixthTextInput . focus ( ) }
97
+ onChangeText = { text => setPassword ( text ) }
82
98
style = { styles . input }
83
99
84
-
85
100
/>
86
101
87
102
< TextInput
88
103
placeholder = "Confirm Password"
89
104
returnKeyType = "go"
105
+ ref = { ( input ) => { sixthTextInput = input ; } }
90
106
secureTextEntry
91
107
style = { styles . input }
92
- ref = { ( ( input ) => confirmPasswordInput = input ) }
108
+ onChangeText = { text => setConfirmPassword ( text ) }
93
109
/>
94
110
95
- < TouchableOpacity style = { styles . buttonContainer } onPress = { ( ) => { navigation . navigate ( 'Onboard' ) } } >
111
+ < TouchableOpacity style = { styles . buttonContainer } onPress = { ( ) => { createUser ( ) } } >
96
112
< Text style = { styles . buttonText } > Sign Up</ Text >
97
113
</ TouchableOpacity >
98
114
0 commit comments