Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@ These props apply to both `<Resizable>` and `<ResizableBox>`.
draggableOpts?: ?Object
};
```

### Drag and resize

This library already implements [react-draggable](https://github.com/mzabriskie/react-draggable) for handling the resizing.
If you want to use a `react-resizable` box inside a `react-draggable` control, you should wrap the resizable control around a `div`:

```
<Draggable>
<div>
<ResizableBox>
<span>Resizable and draggable</span>
</ResizableBox>
</div>
</Draggable>
```
2 changes: 2 additions & 0 deletions lib/Resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ export default class Resizable extends React.Component<Props, State> {
} else {
this.setState(newState);
}

e.stopPropagation();
};
}

Expand Down
8 changes: 8 additions & 0 deletions test/TestLayout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import Resizable from '../lib/Resizable';
import Draggable from 'react-draggable';
import ResizableBox from '../lib/ResizableBox';
import 'style-loader!css-loader!../css/styles.css';

Expand Down Expand Up @@ -54,6 +55,13 @@ export default class TestLayout extends React.Component<{}, {width: number, heig
<ResizableBox className="box" width={200} height={200} axis="none">
<span className="text">Not resizable ("none" axis).</span>
</ResizableBox>
<Draggable>
<div>
<ResizableBox className="box" width={200} height={200}>
<span className="text">Both resizable and draggable</span>
</ResizableBox>
</div>
</Draggable>
</div>
</div>
);
Expand Down