Skip to content

Commit 44ade3f

Browse files
committed
Add onResize callbacks to ResizableBox component
1 parent 7705bc9 commit 44ade3f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/ResizableBox.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ var ResizableBox = module.exports = React.createClass({
3636
[width, height] = this.preserveAspectRatio(width, height);
3737
}
3838

39-
this.setState({width, height});
39+
this.setState({width, height}, () => {
40+
if (this.props.onResize) {
41+
this.props.onResize(event, {element, size});
42+
}
43+
});
4044
},
4145

4246
// If you do this, be careful of constraints
@@ -69,7 +73,9 @@ var ResizableBox = module.exports = React.createClass({
6973
handleSize={handleSize}
7074
width={this.state.width}
7175
height={this.state.height}
76+
onResizeStart={this.props.onResizeStart}
7277
onResize={this.onResize}
78+
onResizeStop={this.props.onResizeStop}
7379
draggableOpts={this.props.draggableOpts}
7480
>
7581
<div style={{width: this.state.width + 'px', height: this.state.height + 'px'}} {...props}>

0 commit comments

Comments
 (0)