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

391
Views
Navegador de pila nativo React: ¿cómo pasar parámetros? no puedo pasar parametros

ingrese la descripción de la imagen aquí

esta es la estructura del proyecto. quiero operarlo: cuando presione ReportButton, navegue a ReportScreen con el parámetro de título de la publicación (accesorios)

esta es la pila de App.js

 <NavigationContainer> <Stack.Navigator initialRouteName="Main"> <Stack.Screen name="Main" component={MainScreen} /> <Stack.Screen name="Report" component={ReportScreen} /> </Stack.Navigator> </NavigationContainer>

este es el navegador táctil de la pantalla principal

 <Tab.Navigator initialRouteName="Home" tabBarOptions={{showIcon: true}}> <Tab.Screen name="Main" options={{ tabBarLabel: 'main', tabBarIcon: ({color}) => <Icon name="home" color={color} size={24} />, tabBarColor: 'blue', }} component={MapScreen} /> <Tab.Screen name="Feed" options={{ tabBarLabel: 'feed', tabBarIcon: ({color}) => <Icon name="home" color={color} size={24} />, tabBarColor: 'blue', }} component={FeedScreen} /> <Tab.Screen name="Setting" options={{ tabBarLabel: 'setting', tabBarIcon: ({color}) => <Icon name="home" color={color} size={24} />, tabBarColor: 'blue', }} component={SettingScreen} /> </Tab.Navigator>

esto es parte de ReportButton para navegar

 <TouchableOpacity style={postModalStyles.listButton} onPress={()=>{console.log(post.title); navigation.navigate('Report', { title: post.title });}}> <Text style={postModalStyles.text}>report</Text> </TouchableOpacity>

esto es parte de ReportScreen

 const ReportScreen = ({title}) => { console.log(title); return( <View></View> ); }

salida de la consola node.js

 LOG hello world //log of reportbutton 's post.title LOG undefined //log of reportscreen's post.title
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No estás pasando props, cuando navegas, pasas 'params'

entonces deberías hacer esto en reportScreen:

 const ReportScreen = ({ navigation, route }) => { console.log(route.params?.title); return( <View></View> ); }
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!