I'm using @react-navigation/native-stack, and when I attempt to pass a params from one screen to another, it returns a react element when I log the param.
onPress={() => {
navigation.navigate("MyMeetEvents", {
name: "CurrentMeet",
item,
});
}}
I receive the appropriate response for item
item--------------------------
"Object"{
"datetime":"08:00 - 14:00, 12 Jan 2022",
"events_count":14,
"id":1,
"isTimed":true,
"location":"Seattle, WA",
"meet_image":29,
"title":"Mile Stone Sports Meet"
}```
***But for the name iam getting this***
name--------------------------
```"Object"{
"$$typeof":"Symbol(react.element)",
"_owner":"FiberNode"{
"tag":0,
"key":null,
"type":[
"Function MyMeetEvents"
]
},
"_store":"Object"{
},
"key":null,
"props":"Object"{
"title":"Current Meet",
"type":"NavHeader"
},
"ref":null,
"type":[
"Function Header"
]
}```
CodePudding user response:
Try this:
onPress={() => navigation.navigate("MyMeetEvents", {
name: "CurrentMeet",
item,
});
}
CodePudding user response:
If you are passing hard coded value CurrentMeet
then it does not make sense to pass this key value pair info name: 'CurrentMeet'
through parameter.
Use directly to that screen...
I hope you got my point!