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

92
Views
undefined no es un objeto (evaluando 'snapshot.data().newUser') al navegar a Pantalla

Uso componentDidMount para iniciar fetchNewUser cuando navego a la pantalla, se supone que debe reconocer a un nuevo usuario y actualizarlo si es cierto, el problema es que cuando navego en la pantalla por primera vez devuelve undefined is not an object (evaluating 'snapshot.data().newUser') , pero si actualizo la pantalla, funciona.

 fetchNewUser = async () => { const fetchInformation = doc(db, 'path') await getDoc(fetchInformation) .then( async (snapshot) => { const newUser = await snapshot.data().newUser const address = await snapshot.data().mainAddress console.log(newUser) if (newUser == true || newUser == undefined) { this.props.navigation.navigate('AddressSearch') updateDoc(fetchInformation, { newUser: false }) } else { this.setState({address: address}) } }) .catch((err) => console.log(err)) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El problema es que está intentando acceder a newUser en la promesa, lo que debe hacer en su lugar es const newUser = (await snapshot.data()).newUser

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!