1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = Object.setPrototypeOf ||
|
4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6 | return function (d, b) {
|
7 | extendStatics(d, b);
|
8 | function __() { this.constructor = d; }
|
9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10 | };
|
11 | })();
|
12 | Object.defineProperty(exports, "__esModule", { value: true });
|
13 | var React = require("react");
|
14 | var react_measure_1 = require("react-measure");
|
15 | var HKResizeContainer = (function (_super) {
|
16 | __extends(HKResizeContainer, _super);
|
17 | function HKResizeContainer(props) {
|
18 | var _this = _super.call(this, props) || this;
|
19 | _this.handleOnResize = function (contentRect) { return _this.setState({ width: contentRect.bounds.width }); };
|
20 | _this.state = {
|
21 | width: 100,
|
22 | };
|
23 | return _this;
|
24 | }
|
25 | HKResizeContainer.prototype.render = function () {
|
26 | var children = this.props.children;
|
27 | var width = this.state.width;
|
28 | return (React.createElement(react_measure_1.default, { bounds: true, onResize: this.handleOnResize }, function (_a) {
|
29 | var measureRef = _a.measureRef;
|
30 | return (React.createElement("div", { className: 'flex-auto', ref: measureRef }, children(width)));
|
31 | }));
|
32 | };
|
33 | return HKResizeContainer;
|
34 | }(React.PureComponent));
|
35 | exports.default = HKResizeContainer;
|
36 |
|
\ | No newline at end of file |