Abdennacer Lachiheb
Abdennacer Lachiheb

Reputation: 4888

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?

Upvotes: 2

Views: 7695

Answers (1)

Vahid Boreiri
Vahid Boreiri

Reputation: 3438

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.

Upvotes: 13

Related Questions