react-native-navigation update child data but remain parent data

99 views Asked by At

I having problem when I push to next screen.

Lets say from screen A(product details screen) -> screen B(product details screen)

Currently I am successfully move from screen A to screen B. But the problems is when i navigate back to screen A, the data in screen A already updated which is same as screen B.

Below is how i update my screen data by using componentDidMount() and navigate to next screen using push.

componentDidMount() { 
    this.props.getDetails(id);
}
this.props.navigator.push({
    screen:'myapp.productDetailsScreen'
})

Is it something i missed that accidentally update screen a data when i navigate to screen b?

Screen A and Screen B share the same component (they just render different value based on the id given).

I am using this library

react-native-navigation v1 (wix)

Any help is appreciated! Thanks.

1

There are 1 answers

3
gamingumar On BEST ANSWER

if you are using redux you the redux state between both of the screens is shared. that is why it is updated on both screens.