Skip to content

Commit

Permalink
Merge pull request #77 from jmuerle/master
Browse files Browse the repository at this point in the history
Updating README to reflect child element's required API
  • Loading branch information
STRML committed Aug 4, 2015
2 parents e982b26 + 4627587 commit 5edc159
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ an intermediate wrapper (`<Draggable><span>...</span></Draggable>`) in this case
The `<Draggable/>` component transparently adds draggable to whatever element is supplied as `this.props.children`.
**Note**: Only a single element is allowed or an Error will be thrown.

For the `<Draggable/>` component to correctly attach itself to its child, the child element must provide support for the following props:
- `style` is used to give the transform css to the child.
- `className` is used to apply the proper classes to the object being dragged.
- `onMouseDown` is used along with onMouseUp to keep track of dragging state.
- `onMouseUp` is used along with onMouseDown to keep track of dragging state.
- `onTouchStart` is used along with onTouchEnd to keep track of dragging state.
- `onTouchEnd` is used along with onTouchStart to keep track of dragging state.

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.

Props:

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

0 comments on commit 5edc159

Please sign in to comment.