Pawat
Pawat

Reputation: 3

How to prevent changing the screen when using "this.props.navigation.navigate"?

I'd like to pass the values from Tab to another Tab and I follow instructions from this tutorial https://reactnavigation.org/docs/en/params.html

I got the values at the end but i don't want to change the screen suddenly.

I tried to use 'setParams' instead but it doesn't work.

Setting tab (Selection) :

onPress={() => {
     console.log('Select : '+ item.code);
     this.props.navigation.navigate('A-page', {adCode: item.code});
}}

First tab (A-page) :

this.setState ({
     AirportCode : this.props.navigation.getParam('adCode','----')
})

Any ideas for passing values across Tab navigation or method to stop changing the screen suddenly?

Upvotes: 0

Views: 270

Answers (1)

Vinicius
Vinicius

Reputation: 1365

This looks more like a Redux use case then a React Navigation one. If you wanna change properties that influence more than one screen in your app, you should store these properties at the redux store.

Upvotes: 1

Related Questions