Closed natew closed 9 years ago
I've the same problem but setting a timeout did not fix it.
I use tweenState in combination with componentWillLeave
.
The problem is in _rafCb()
:
if (!this.isMounted()) {
return;
}
At method call the component is still mounted but the state changed till setState()
is called.
Quickfix: Add the same check just before setState()
.
Thanks and sorry for the wait!
Fortunately with React 0.13, setting state after unmounting doesn't throw anymore. The warning's still bothersome though, so I'll make the change @agidoSF suggested. (@natew: your fix didn't work for me either).
@agidoSF @natew I just released v0.0.5, which contains the fix, because this is the last release compatible with React < 0.13 (0.13 actually breaks something in tween-state and I'm fixing it now). Seemed better than to jump straight to supporting only React 0.13+ and leaving people at 0.12 without this fix.
This should probably work:
But if props.onClose removes the tweening element I get an error
setState
on non-mounted component. This fixes it for now: