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

170
Views
Obtener indefinido no es un objeto (evaluando 'navigation.push') al llamar a un componente dentro de otro

Aquí está mi componente:

 function MyHeader({navigation}){ let cartPress = () => navigation.push("Cart"); return( <View> <TouchableOpacity onPress={cartPress}> <Text>Cart</Text> </TouchableOpacity> </View> ); } export default MyHeader;

Cuando lo llamo en el siguiente componente:

 import React from 'react'; import MyHeader from "../MyHeader"; function MyScreen({navigation}){ return( <View> <MyHeader /> </View> ); } export default MyScreen;

Recibo el siguiente error en el componente MyScreen:

TypeError: undefined no es un objeto (evaluando 'navigation.push').

Sin embargo, cuando llamo a lo que hay en el componente MyHeader sin llamar al componente AppHeader, no recibo ese error:

 import React from 'react'; import MyHeader from "../MyHeader"; function MyScreen({navigation}){ let cartPress = () => navigation.push("Cart"); return( <View> <TouchableOpacity onPress={cartPress}> <Text>Cart</Text> </TouchableOpacity> </View> ); } export default MyScreen;

Cuál es el problema ?

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

0

No pasó la propiedad de navigation al componente <MyHeader /> , intente: <MyHeader navigation={navigation} />

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!