mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
- Package structure created via dtsgen - Initial typings generated from package version 1.7 using flow2ts - Types and tests edited by me to be nice and crispy - I am using this in a project myself and I figured it's time to upstream!
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import * as React from "react";
|
|
import { Resizable, ResizableBox, ResizeCallbackData } from "react-resizable";
|
|
|
|
const resizeCallback = (
|
|
event: React.SyntheticEvent,
|
|
data: ResizeCallbackData
|
|
) => {
|
|
console.log(data.size.height);
|
|
console.log(data.node);
|
|
};
|
|
|
|
class TestResizableComponent extends React.Component {
|
|
render() {
|
|
return (
|
|
<Resizable
|
|
width={10}
|
|
height={20}
|
|
axis="y"
|
|
className={"foobar"}
|
|
minConstraints={[20, 20]}
|
|
maxConstraints={[42, 42]}
|
|
handleSize={[5, 5]}
|
|
lockAspectRatio={false}
|
|
draggableOpts={{ opaque: true }}
|
|
onResizeStart={resizeCallback}
|
|
onResizeStop={resizeCallback}
|
|
onResize={resizeCallback}
|
|
>
|
|
<div>{this.props.children} </div>
|
|
</Resizable>
|
|
);
|
|
}
|
|
}
|
|
|
|
class TestResizableBoxComponent extends React.Component {
|
|
render() {
|
|
return (
|
|
<ResizableBox
|
|
width={10}
|
|
height={20}
|
|
onResizeStart={resizeCallback}
|
|
onResizeStop={resizeCallback}
|
|
onResize={resizeCallback}
|
|
>
|
|
<div>{this.props.children}</div>
|
|
</ResizableBox>
|
|
);
|
|
}
|
|
}
|