React Native - When "componentWillUnmount" will be called?

In react-native, componentWillUnmount is not called as you would expect on the web. Instead try to use the navigation lifecycle, in whatever navigation library you are using (we are using react-navigation).


Navigator uses stack to manager route. When you push a new page, current page wont unmount, if you pop from new page to the current page, the new page will unmount. And in other scene, if you render some child component based on some regulation like isLoading or other, the componentWillUnmount method will also be called when they no longer need to be rendered.

Tags:

React Native