-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Getting this.props.route.params as undefined even when i send params #8785
Copy link
Copy link
Closed
Labels
Description
Current Behavior
getting value undefined in this.props.route.params
- What code are you running and what is happening?
in my app i have multiple tabs home, flights, hotels and holidays.
from home screen i want to send some data to flight screen so i am sending the data with following code
this.props.navigation.navigate("Flights",{ searchdata: data})
it's navigating to flights screen. in flight screen my code is
componentDidMount(){ unsubscribe = this.props.navigation.addListener("focus",()=>{ this.setSearchData() }) }
setSearchData(){ console.log("data : ",this.props.route.params) //here search data should log but getting undefined }
componentWillUnmount() { unsubscribe(); }
Expected Behavior
- What do you expect should be happening?
i should get data in route.params
Your Environment
| software | version |
|---|---|
| iOS and Android | |
| @react-navigation/native | 5.7.3 |
| react-native | 0.62.2 |
Reactions are currently unavailable