Skip to content

Commit 5edc159

Browse files
committed
Merge pull request #77 from jmuerle/master
Updating README to reflect child element's required API
2 parents e982b26 + 4627587 commit 5edc159

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ an intermediate wrapper (`<Draggable><span>...</span></Draggable>`) in this case
3636
The `<Draggable/>` component transparently adds draggable to whatever element is supplied as `this.props.children`.
3737
**Note**: Only a single element is allowed or an Error will be thrown.
3838

39+
For the `<Draggable/>` component to correctly attach itself to its child, the child element must provide support for the following props:
40+
- `style` is used to give the transform css to the child.
41+
- `className` is used to apply the proper classes to the object being dragged.
42+
- `onMouseDown` is used along with onMouseUp to keep track of dragging state.
43+
- `onMouseUp` is used along with onMouseDown to keep track of dragging state.
44+
- `onTouchStart` is used along with onTouchEnd to keep track of dragging state.
45+
- `onTouchEnd` is used along with onTouchStart to keep track of dragging state.
46+
47+
React.DOM elements support the above six properties by default, so you may use those elements as children without any changes. If you wish to use a React component you created, you might find [this React page](https://facebook.github.io/react/docs/transferring-props.html) helpful.
48+
3949
Props:
4050

4151
**`axis`**: determines which axis the draggable can move. Accepted values:

0 commit comments

Comments
 (0)