Closed rutvik0 closed 4 years ago
Good day,
How did you resolve this issue? Please assist.
La solucion a lo consulta de mas arriba: Agregar a App.js
`import 'react-native-gesture-handler'; import React, { useEffect, useState } from 'react' import { firebase } from './src/firebase/config' import { NavigationContainer } from '@react-navigation/native' import { createStackNavigator } from '@react-navigation/stack' import { LoginScreen, HomeScreen, RegistrationScreen } from './src/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)
useEffect(() => { const usersRef = firebase.firestore().collection('users'); firebase.auth().onAuthStateChanged(user => { if (user) { usersRef .doc(user.uid) .get() .then((document) => { const userData = document.data() setLoading(false) setUser(userData) }) .catch((error) => { setLoading(false) }); } else { setLoading(false) } }); }, []);
if (loading) { return ( <></> ) }
return (
);
}`
Running the project with expo. Receiving this error. No changes made to the files.