@appbuckets/react-ui-core
Version:
Core utilities built for AppBuckets React UI Framework
29 lines (26 loc) • 838 B
JavaScript
import { __extends } from 'tslib';
import * as React from 'react';
import { handleRef } from '../utils/refUtils.js';
var RefForward = /** @class */ (function (_super) {
__extends(RefForward, _super);
function RefForward() {
var _this = (_super !== null && _super.apply(this, arguments)) || this;
_this.handleRefOverride = function (node) {
var _a = _this.props,
children = _a.children,
innerRef = _a.innerRef;
handleRef(children.ref, node);
handleRef(innerRef, node);
};
return _this;
}
RefForward.prototype.render = function () {
var children = this.props.children;
return React.cloneElement(children, {
ref: this.handleRefOverride,
});
};
RefForward.displayName = 'RefForward';
return RefForward;
})(React.Component);
export { RefForward as default };