Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
React Native (React Navigation)<> Pantalla de inicio de sesión de Firebase

Estoy usando Firebase para realizar un seguimiento de todos los usuarios. Pude conectar Firebase. El registro de usuario funciona bien.

Tengo problemas para registrar a los usuarios. Cuando ingreso el nombre de usuario y la contraseña, la aplicación no me redirige a la pantalla correcta y también muestra esta advertencia [Unhandled promise rejection: TypeError: navigation.navigation is not a function. (In 'navigation.navigation("myProfile")', 'navigation.navigation' is undefined)]

Así es como lo hago

 import { useNavigation } from "@react-navigation/native"; import React, { useEffect, useState } from "react"; import { View, ...} from "react-native"; import { auth } from "../firebase"; const Profile = () => { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const navigation = useNavigation(); useEffect(() => { const unsubscribe = auth.onAuthStateChanged((user) => { if (user) { navigation.navigation("myProfile"); } }); return unsubscribe; }, []); const signIn = () => { auth .signInWithEmailAndPassword(email, password) .then((userCredentials) => { const user = userCredentials.user; console.log("Sign In user.email = " + user.email); }) .catch((error) => alert(error.message)); }; //more code

También probé esto, pero no ayudó

 import React, { useEffect, useState } from "react"; import { View, ...} from "react-native"; import { auth } from "../firebase"; const Profile = ({navigation}) => { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); useEffect(() => { const unsubscribe = auth.onAuthStateChanged((user) => { if (user) { navigation.navigation("myProfile"); } }); return unsubscribe; }, []); //more code

No estoy seguro si necesito navigation.navigation("myProfile") onPress o si tiene que estar dentro del useEffect

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Usar

 navigation.navigate("myProfile")

en vez de

 navigation.navigation("myProfile");

También puedes destruir tu objeto de gancho de esta manera

 const { navigate } = useNavigation()

solo para escribir

 navigate("myProfile")

No estoy seguro de si necesito navegación. navegación ("mi perfil") onPress o si tiene que estar dentro de useEffect

En la mayoría de los casos, debe mover al usuario a la pantalla de inicio (pantalla de usuario conectado) cuando la función de inicio de sesión devuelve verdadero y el usuario ha iniciado sesión, por lo que en este caso creo que debe usar navegar ("mi perfil") dentro de

 auth .signInWithEmailAndPassword(email, password) .then((userCredentials) => { ...your code navigation.navigate("myProfile") })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!