Search code examples
reactjsreact-nativereact-navigationreact-navigation-stackreact-navigation-v6

react navigation I can't send the parameters to the previous page when I came to this page from


have a good day I use react navigation v6 I have a problem in a special mode with sending params I have 3 screens like this

screenA screenB screenC

I can't send the params to the previous screen when I came to this page from the previous screen and now I want to navigate and send new params to the previous screen.

When it goes from screenA to screenB and then to screenC, the problem starts from now on Now the navigation order is like this

screenA -> screenB -> screenC

Now, click on a button from screenC and go to screenB, it does not send any parameters from C to B, but it navigates as if it is going back, which should not be like this.

But if the user goes from screenA to screenC and from there to screenB, everything is correct and the parameters are sent from C to B correctly.

screenA -> screenC -> screenB

while all 90% follow this path

screenA -> screenB -> screenC -> screenB -> screenC -> screenB ...

Can someone guide me, what is happening and what should I do?


Solution

  • The solution solved my problem with mounted /unmounted on screenB like this

    export default class getaway extends PureComponent {
    
        state={}
    
        _Mounted = false
    
        componentDidMount(){
            this._Mounted = true
            this._Mounted ? 'your code' : null
        }   
        componentWillUnmount(){
            this._Mounted = false
        } 
        render() {
            return (
            <View>
                <Text>getaway</Text>
            </View>
            )
        }
    }