Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: this.props.navigation.getParam is not a function while passing parameter using ReactNative

I am getting an error while accessing parameter by the getParam method like following .

    const source = this.props.navigation.getParam("source","0")
    const doFollow = this.props.navigation.getParam("doFollow","")

I have passed the parameter using the following method

this.props.navigation.navigate('Details', {otherParam:"anything"})
like image 570
Raghu Avatar asked Aug 06 '26 06:08

Raghu


1 Answers

It depends on your react-navigation version that you are using.

In v4

this.props.navigation.getParam('source')

In v5

this.props.route.params.source
like image 151
Shing Ho Tan Avatar answered Aug 08 '26 19:08

Shing Ho Tan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!