fix(gl-react): prefer to _addGLNodeChild in DidMount

NB I need to test that more deeply. this is to fix that React16 seem have different willMount/unmount ordering & the Surface#_addGLNodeChild now starts to trigger the 'one child at a time' invariant for a normal "switch", probably because newChild._addGLNodeChild is called before oldChild._removeGLNodeChild
This commit is contained in:
Gaëtan Renaudeau 2017-05-07 10:03:52 +02:00
parent 97dc545dcc
commit aaace75a15

View File

@ -419,12 +419,12 @@ export default class Node extends Component {
}
componentWillMount() {
const { glParent, glSurface: { gl } } = this.context;
const { glSurface: { gl } } = this.context;
if (gl) this._prepareGLObjects(gl);
glParent._addGLNodeChild(this);
}
componentDidMount() {
this.context.glParent._addGLNodeChild(this);
this.redraw();
if (this.props.sync) this.flush();
}