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

102
Views
React Native route.params is undefined

I've been trying to pass data from my home.js screen to my merchant.js screen by using navigation.navigate('Merchant', store ) but when I try to actually use route.params I get undefined.

Here's my home.js

export default function Home( { navigation }) {
...
{storeData.map(store => {
    return (
     <View>
      <TouchableOpacity>
        <Text style={styles.categoryName}
          onPress={() => {navigation.navigate('Merchant', store)}}>
         {store.name}
        </Text>
      </TouchableOpacity>

Merchant.js

function Merchant({ navigation, route }) {
    console.log(route);
...
}

Output:

{"key": "Merchant-86K9u5ytF32VGMRcO9s2g", "name": "Merchant", "params": undefined}

Again I have no idea what is going on. I've tried navigation.push(), I've tried using navigate('Merchant', {name: store.name}) but I still get undefined.

If you would like to paste more code with my stack navigation I can.

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

0

Have you try this?

navigation.navigate('Merchant', store)

Access the value by:

navigation.getParam('onePropertyOfStoreHere');
about 4 years ago · Juan Pablo Isaza Report

0

Alright, so I figured why it was undefined. It was because I had another stack that started with Merchant.js on the top.

<Stack.Navigator initialRouteName="Merchant" headerShown='false'>
    <Stack.Screen name="Merchant" component={Merchant} />
    <Stack.Screen name="ProductInfo" component={ProductInfo}/>
</Stack.Navigator>

This must of confused the app as I was moving from Home to Merchant screen but it went into another stack.

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!