mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Rewrite Stack implementation of ReactART using plain classes
instead of createClass
This commit is contained in:
1 parent
5cfaa7cf68
commit
087fe88f20
1 file changed
+12
-14
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user