Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit 43ab216

Browse files
authored
Merge pull request #12 from sfusurge/database
Merge some fixes to text inputs in the signup age
2 parents 2abdea2 + 306f241 commit 43ab216

File tree

3 files changed

+50
-19
lines changed

3 files changed

+50
-19
lines changed

components/SignUp.js

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
import React, { Component } from 'react';
1+
import React, { Component, useState } from 'react';
22
import { KeyboardAvoidingView, Image, StyleSheet, View, TextInput, TouchableOpacity, Text, Navigitor} from 'react-native';
33
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
44
import { Actions } from 'react-native-router-flux';
55

66
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+
}
1324

1425
return (
1526
<KeyboardAwareScrollView
@@ -31,8 +42,9 @@ export default function SignUp({navigation}){
3142
<TextInput
3243
placeholder = "Name of Organization"
3344
returnKeyType = "next"
34-
onSubmitEditing = {()=> emailInput.focus()}
45+
onSubmitEditing = {()=> {secondTextInput.focus();}}
3546
keyboardType = "email-address"
47+
onChangeText = {text => setName(text)}
3648
style = {styles.input}
3749
autoCapitalize = "none"
3850
autoCorrect = {false}
@@ -42,8 +54,9 @@ export default function SignUp({navigation}){
4254
<TextInput
4355
placeholder = "E-mail"
4456
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)}
4760
keyboardType = "email-address"
4861
style = {styles.input}
4962
autoCapitalize = "none"
@@ -54,8 +67,9 @@ export default function SignUp({navigation}){
5467
<TextInput
5568
placeholder = "Phone number"
5669
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)}
5973
keyboardType = "email-address"
6074
style = {styles.input}
6175
autoCapitalize = "none"
@@ -65,8 +79,9 @@ export default function SignUp({navigation}){
6579
<TextInput
6680
placeholder = "Address"
6781
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)}
7085
keyboardType = "email-address"
7186
style = {styles.input}
7287
autoCapitalize = "none"
@@ -76,23 +91,24 @@ export default function SignUp({navigation}){
7691
<TextInput
7792
placeholder = "Password"
7893
returnKeyType = "next"
94+
ref={(input) => {fifthTextInput = input;}}
7995
secureTextEntry
80-
onSubmitEditing = {()=> confirmPasswordInput.focus()}
81-
ref={((input) => passwordInput = input)}
96+
onSubmitEditing = {()=> sixthTextInput.focus()}
97+
onChangeText = {text => setPassword(text)}
8298
style = {styles.input}
8399

84-
85100
/>
86101

87102
<TextInput
88103
placeholder = "Confirm Password"
89104
returnKeyType = "go"
105+
ref={(input) => {sixthTextInput = input;}}
90106
secureTextEntry
91107
style = {styles.input}
92-
ref={((input) => confirmPasswordInput = input)}
108+
onChangeText = {text => setConfirmPassword(text)}
93109
/>
94110

95-
<TouchableOpacity style = {styles.buttonContainer} onPress={()=> {navigation.navigate('Onboard')}}>
111+
<TouchableOpacity style = {styles.buttonContainer} onPress={()=> {createUser()}}>
96112
<Text style = {styles.buttonText}>Sign Up</Text>
97113
</TouchableOpacity>
98114

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"react": "~16.9.0",
2020
"react-dom": "~16.9.0",
2121
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
22+
"react-native-firebase": "^5.6.0",
2223
"react-native-gesture-handler": "~1.5.0",
2324
"react-native-keyboard-aware-scroll-view": "^0.9.1",
2425
"react-native-maps": "0.26.1",

0 commit comments

Comments
 (0)