instamobile / react-native-firebase

React Native Firebase Starter Project with Auth, Firestore, Storage and Push Notifications
https://instamobile.io
MIT License
413 stars 139 forks source link

The action 'NAVIGATE' with payload {"name":"Home","params":{"user":{"email":"p@p.com","id":"xxx","fullName":"test"}}} was not handled by any navigator #3

Closed rutvik0 closed 4 years ago

rutvik0 commented 4 years ago

Running the project with expo. Receiving this error. No changes made to the files.

index.js:1 The action 'NAVIGATE' with payload {"name":"Home","params":{"user":{"email":"p@p.com","id":"xxx","fullName":"test"}}} was not handled by any navigator.

Do you have a screen named 'Home'?

If you're trying to navigate to a screen in a nested navigator, see https://reactnavigation.org/docs/nesting-navigators#navigating-to-a-screen-in-a-nested-navigator.

This is a development-only warning and won't be shown in production.
rutvik0 commented 4 years ago

https://github.com/instamobile/react-native-firebase/issues/1#issuecomment-653187861

chiefster commented 4 years ago

Good day,

How did you resolve this issue? Please assist.

Miguel-esquivel commented 4 years ago

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 (

{ user ? ( {props => } ) : ( <> )}

);

}`