Skip to content

Getting this.props.route.params as undefined even when i send params #8785

@vinitgundeti

Description

@vinitgundeti

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions