'Kill Or Reset Or Replace Previous screen in React navigation
I have 3 screens in my stack navigator. Practice, Practice details, practice room. Here practice room is different stack. So my screen flow will be something like Practice => Practice details => practice room.
When I am in Practice room screen, I have fetched data from API and storing them in Redux store. And storing some of them in local state variable as well. If user accidentally clicks device back button, local state variable are cleared.
Next time If, user revisits the Practice room again, only redux store data is available. I can change the local state variable to Redux state variable. But I need to the solution here.
How do I replace or kill the Practice room screen with the help of react navigation, when user clicks back button?
Thanks in Advance.
Solution 1:[1]
I think just use navigation.goBack() will kill the current screen and went to the previous screen.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jimmy Chiang |
