ex-navigation
ex-navigation copied to clipboard
setState Warning with 3.0 and RN 0.44
If I use navigator.immediatelyResetStack I get a warning that setState must be called only on mounted or mounting component. If I use navigator.push I do not get the warning. I have no setState calls in my test code.
Let me know if you want me to publish a reproduction of it on Expo.
The bug is in ExNavigationComponents.js. componentWillUnmount should trigger _unsubcribeFromStore and it does, but in redux/lib/createStore.js :
function dispatch(action) {
....
var listeners = currentListeners = nextListeners;
for (var i = 0; i < listeners.length; i++) {
listeners[i]();
}
listeners has old value of listeners (dispatch happens after immediatelyResetStack and before unsubscribe). The quick fix can be to
componentWillUnmount() {
this._unsubcribeFromStore && this._unsubcribeFromStore();
this._handleStateUpdate = () => {};
}
in ExNavigationComponents.js
Related bug #468