react-virtualized-sticky-tree
Version:
A React component for efficiently rendering tree like structures with support for position: sticky
19 lines (18 loc) • 836 B
JavaScript
import React from 'react';
import Measure from 'react-measure';
import StickyTree from './StickyTree.js';
export default class AutoSizedStickyTree extends React.PureComponent {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (React.createElement(Measure, { bounds: true, onResize: (rect) => {
this.setState({ width: rect.bounds.width, height: rect.bounds.height });
if (this.props.onResize !== undefined) {
this.props.onResize(rect);
}
} }, ({ measureRef }) => (React.createElement("div", { ref: measureRef, className: this.props.className },
React.createElement(StickyTree, { ref: this.props.treeRef, width: this.state.width, height: this.state.height, ...this.props })))));
}
}