|
@@ -1,10 +1,10 @@
|
1
|
1
|
import React, { Component } from "react";
|
2
|
|
-import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground, Text, View } from "react-native";
|
|
2
|
+import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground, Text } from "react-native";
|
3
|
3
|
import firebase from "firebase";
|
4
|
4
|
import { Picker } from "@react-native-picker/picker";
|
5
|
5
|
|
6
|
|
-import { styles } from "../../config/styles";
|
7
|
|
-import CustomButton from "../../components/CustomButton";
|
|
6
|
+import { styles } from "../config/styles";
|
|
7
|
+import CustomButton from "../components/CustomButton";
|
8
|
8
|
|
9
|
9
|
export default class RegisterScreen extends Component {
|
10
|
10
|
constructor(props) {
|
|
@@ -22,14 +22,26 @@ export default class RegisterScreen extends Component {
|
22
|
22
|
const { username, email, password, interpreter } = this.state;
|
23
|
23
|
firebase.auth().createUserWithEmailAndPassword(email, password)
|
24
|
24
|
.then((result) => {
|
25
|
|
- firebase.firestore().collection("Users")
|
26
|
|
- .doc(firebase.auth().currentUser.uid)
|
27
|
|
- .set({
|
28
|
|
- username,
|
29
|
|
- email,
|
30
|
|
- interpreter,
|
31
|
|
- })
|
32
|
|
- console.log(result)
|
|
25
|
+ if (interpreter) {
|
|
26
|
+ firebase.firestore().collection("Interpreters")
|
|
27
|
+ .doc(firebase.auth().currentUser.uid)
|
|
28
|
+ .set({
|
|
29
|
+ username,
|
|
30
|
+ email,
|
|
31
|
+ interpreter,
|
|
32
|
+ })
|
|
33
|
+ console.log(result)
|
|
34
|
+ }
|
|
35
|
+ else {
|
|
36
|
+ firebase.firestore().collection("Users")
|
|
37
|
+ .doc(firebase.auth().currentUser.uid)
|
|
38
|
+ .set({
|
|
39
|
+ username,
|
|
40
|
+ email,
|
|
41
|
+ interpreter,
|
|
42
|
+ })
|
|
43
|
+ console.log(result)
|
|
44
|
+ }
|
33
|
45
|
})
|
34
|
46
|
.catch((error) => {
|
35
|
47
|
console.log(error)
|
|
@@ -39,7 +51,7 @@ export default class RegisterScreen extends Component {
|
39
|
51
|
render() {
|
40
|
52
|
return (
|
41
|
53
|
<TouchableWithoutFeedback style={styles.regcontainer} onPress={Keyboard.dismiss} accessible={false}>
|
42
|
|
- <ImageBackground style={styles.regcontainer} source={require('../../assets/yellow-white.jpg')}>
|
|
54
|
+ <ImageBackground style={styles.regcontainer} source={require('../assets/yellow-white.jpg')}>
|
43
|
55
|
<TextInput style={styles.regtxtfield} placeholder="Userame" onChangeText={(username) => this.setState({ username })}/>
|
44
|
56
|
<TextInput style={styles.regtxtfield} placeholder="Email" onChangeText={(email) => this.setState({ email })}/>
|
45
|
57
|
<TextInput style={styles.regtxtfield} placeholder="Password" onChangeText={(password) => this.setState({ password })} secureTextEntry={ true }/>
|