Search code examples
react-nativenavigationreact-native-router-flux

React native router flux reset scenes from navigation stack


I have a scene ( lets called sceneA ) where a lot of data is rendered inside a listview, so after navigating to another scene, the ui become very slow and laggy because sceneA still in the navigation stack, I tried to solve this by calling: Actions.sceneA({type: "reset"}) inside componentWillUnmount() of sceneA, but that doesn't seem to work as componentWillUnmount() is never called after navigating to another scene, so is there a way to reset previous scenes when navigating inside the app?


Solution

  • You can use the <scene/> tag like this:

    <Scene type="reset" key="someKey" component={someComponent} .../>
    

    In this way if you go to the scene above, the navigation stack will reset.