From 087fe88f20102454ec2581368dfb152abf3d7c20 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Tue, 21 Mar 2017 18:37:16 -0700 Subject: [PATCH] Rewrite Stack implementation of ReactART using plain classes instead of createClass --- src/renderers/art/ReactARTStack.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/renderers/art/ReactARTStack.js b/src/renderers/art/ReactARTStack.js index db1d22a885..26e3ff92e8 100644 --- a/src/renderers/art/ReactARTStack.js +++ b/src/renderers/art/ReactARTStack.js @@ -170,12 +170,8 @@ const ContainerMixin = Object.assign({}, ReactMultiChild, { // Surface is a React DOM Component, not an ART component. It serves as the // entry point into the ART reconciler. -const Surface = React.createClass({ - displayName: 'Surface', - - mixins: [ContainerMixin], - - componentDidMount: function() { +class Surface extends React.Component { + componentDidMount() { const domNode = ReactDOM.findDOMNode(this); this.node = Mode.Surface(+this.props.width, +this.props.height, domNode); @@ -189,9 +185,9 @@ const Surface = React.createClass({ ReactInstanceMap.get(this)._context, ); ReactUpdates.ReactReconcileTransaction.release(transaction); - }, + } - componentDidUpdate: function(oldProps) { + componentDidUpdate(oldProps) { const node = this.node; if ( this.props.width != oldProps.width || this.props.height != oldProps.height @@ -220,13 +216,13 @@ const Surface = React.createClass({ if (node.render) { node.render(); } - }, + } - componentWillUnmount: function() { + componentWillUnmount() { this.unmountChildren(); - }, + } - render: function() { + render() { // This is going to be a placeholder because we don't know what it will // actually resolve to because ART may render canvas, vml or svg tags here. // We only allow a subset of properties since others might conflict with @@ -246,8 +242,10 @@ const Surface = React.createClass({ title={props.title} /> ); - }, -}); + } +} +Surface.displayName = 'Surface'; +Object.assign(Surface.prototype, ContainerMixin); // Various nodes that can go into a surface