import React from 'react'; import { Resizable } from 'react-resizable'; export interface ResizableHeaderCellProps { [x: string]: any; onResize?: ResizeFn; onResizeStart?: ResizeFn; onResizeStop?: ResizeFn; width?: number | string; } class ResizableHeaderCell extends React.PureComponent { render() { const { onResize, onResizeStart, onResizeStop, width, ...restProps } = this.props; if (typeof width !== 'number') { return ; } let { children } = restProps; // Fragment must be used here, otherwise there will be an error (seemingly a react-resizable@1.9.0 problem) children = React.Children.map(children, (child, index) => {child}); return ( {children} ); } } export type ResizeFn = (e: React.SyntheticEvent) => any; export default ResizableHeaderCell;