1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-31 20:11:59 +02:00

dual rendering possible using --singles

This commit is contained in:
Pomax
2016-01-16 17:57:16 -08:00
parent a346272dee
commit 819b628456
21 changed files with 4748 additions and 119 deletions

View File

@@ -6,7 +6,8 @@ module.exports = function(Component) {
propName = options.propName || "",
values = options.values || {},
controller = options.controller || noop,
getDefaultProps = Component.getDefaultProps;
getDefaultProps = Component.getDefaultProps,
ref = "wrappedComponent";
return React.createClass({
values: values,
@@ -26,8 +27,16 @@ module.exports = function(Component) {
}
},
getComponent: function() {
var wrappedComponent = this.refs[ref];
if (wrappedComponent.getComponent) {
return wrappedComponent.getComponent();
}
return wrappedComponent;
},
render: function() {
return <Component {...this.props} onKeyDown={this.onKeyDown} />;
return <Component {...this.props} onKeyDown={this.onKeyDown} ref={ref} />;
}
});
};