We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I keep getting this error when filling the form and pressing the register button.
`@firebase/firestore: Firestore (7.19.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend. [Tue Aug 25 2020 12:57:48.133] ERROR The action 'NAVIGATE' with payload {"name":"Home","params":{"user":{"id":"4Foqi2I28cTIosFxwnYNmPHD2g53","email":"[email protected]","fullName":"Jukka"}}} was not handled by any navigator. ` ` import 'react-native-gesture-handler'; import React, { useEffect, useState } from 'react' import { NavigationContainer } from '@react-navigation/native' import { createStackNavigator } from '@react-navigation/stack' import { LoginScreen, HomeScreen, RegistrationScreen } from '../screens' import {decode, encode} from 'base-64' if (!global.btoa) { global.btoa = encode } if (!global.atob) { global.atob = decode } const Stack = createStackNavigator(); export default function App() { const [loading, setLoading] = useState(true) const [user, setUser] = useState(null) return ( <NavigationContainer> <Stack.Navigator> { user ? ( <Stack.Screen name="Home"> {props => <HomeScreen {...props} extraData={user} />} </Stack.Screen> ) : ( <> <Stack.Screen name="Login" component={LoginScreen} /> <Stack.Screen name="Registration" component={RegistrationScreen} /> </> )} </Stack.Navigator> </NavigationContainer> ); }` `import React, {useState} from 'react'; import {Image, Text, TextInput, TouchableOpacity, View, ToastAndroid , Alert} from 'react-native'; import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view'; import styles from './RegisterStyle'; import { firebase } from '../../firebase/config' export default function RegistrationScreen({navigation}) { const [fullName, setFullName] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); const onFooterLinkPress = () => { navigation.navigate('Login'); }; const onRegisterPress = () => { if (password !== confirmPassword) { ToastAndroid.show("Passwords does not match!", ToastAndroid.SHORT); return } firebase .auth() .createUserWithEmailAndPassword(email, password) .then((response) => { const uid = response.user.uid const data = { id: uid, email, fullName } const usersRef = firebase.firestore().collection('users') usersRef .doc(uid) .set(data) .then(() => { navigation.navigate('Home', {user: data}) }) }) }; return ( <View style={styles.container}> <KeyboardAwareScrollView style={{flex: 1, width: '100%'}} keyboardShouldPersistTaps="always"> <Image style={styles.logo} source={require('../../../assets/icon.png')} /> <TextInput style={styles.input} placeholder="Full Name" placeholderTextColor="#aaaaaa" onChangeText={(text) => setFullName(text)} value={fullName} underlineColorAndroid="transparent" autoCapitalize="none" /> <TextInput style={styles.input} placeholder="E-mail" placeholderTextColor="#aaaaaa" onChangeText={(text) => setEmail(text)} value={email} underlineColorAndroid="transparent" autoCapitalize="none" /> <TextInput style={styles.input} placeholderTextColor="#aaaaaa" secureTextEntry placeholder="Password" onChangeText={(text) => setPassword(text)} value={password} underlineColorAndroid="transparent" autoCapitalize="none" /> <TextInput style={styles.input} placeholderTextColor="#aaaaaa" secureTextEntry placeholder="Confirm Password" onChangeText={(text) => setConfirmPassword(text)} value={confirmPassword} underlineColorAndroid="transparent" autoCapitalize="none" /> <TouchableOpacity style={styles.button} onPress={() => onRegisterPress()}> <Text style={styles.buttonTitle}>Create account</Text> </TouchableOpacity> <View style={styles.footerView}> <Text style={styles.footerText}> Already got an account?{' '} <Text onPress={onFooterLinkPress} style={styles.footerLink}> Log in </Text> </Text> </View> </KeyboardAwareScrollView> </View> ); } ` `import React, {useState} from 'react'; import {Image, Text, TextInput, TouchableOpacity, View, ToastAndroid} from 'react-native'; import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view'; import styles from './LoginStyle'; import { firebase } from '../../firebase/config' export default function LoginScreen({navigation}) { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const onFooterLinkPress = () => { navigation.navigate('Registration'); }; const onLoginPress = () => { firebase .auth() .signInWithEmailAndPassword(email, password) .then((response) => { const uid = response.user.uid const usersRef = firebase.firestore().collection('users') usersRef .doc(uid) .get() .then(firestoreDocument => { if (!firestoreDocument.exists) { ToastAndroid.show("User does not exist anymore.", ToastAndroid.SHORT); return; } const user = firestoreDocument.data() navigation.navigate('Home', {user}) }) }) }; return ( <View style={styles.container}> <KeyboardAwareScrollView style={{flex: 1, width: '100%'}} keyboardShouldPersistTaps="always"> <Image style={styles.logo} source={require('../../../assets/icon.png')} /> <TextInput style={styles.input} placeholder="E-mail" placeholderTextColor="#aaaaaa" onChangeText={(text) => setEmail(text)} value={email} underlineColorAndroid="transparent" autoCapitalize="none" /> <TextInput style={styles.input} placeholderTextColor="#aaaaaa" secureTextEntry placeholder="Password" onChangeText={(text) => setPassword(text)} value={password} underlineColorAndroid="transparent" autoCapitalize="none" /> <TouchableOpacity style={styles.button} onPress={() => onLoginPress()}> <Text style={styles.buttonTitle}>Log in</Text> </TouchableOpacity> <View style={styles.footerView}> <Text style={styles.footerText}> Don't have an account?{' '} <Text onPress={onFooterLinkPress} style={styles.footerLink}> Sign up </Text> </Text> </View> </KeyboardAwareScrollView> </View> ); } ` `(parameter) response: firebase.auth.UserCredential Object is possibly 'null'`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I keep getting this error when filling the form and pressing the register button.
The text was updated successfully, but these errors were encountered: