Skip to content

Commit e17a9e8

Browse files
committed
Add disabled prop
1 parent c9addd9 commit e17a9e8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/Draggable.es6

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default class Draggable extends DraggableCore {
2222
// Current transform x and y.
2323
clientX: props.start.x, clientY: props.start.y
2424
};
25+
log('Draggable: initializing state: %j, and props: %j', this.state, props);
2526
autobind(this);
2627
}
2728

@@ -170,6 +171,25 @@ Draggable.propTypes = assign({}, DraggableCore.propTypes, {
170171
React.PropTypes.oneOf(['parent', false])
171172
]),
172173

174+
/**
175+
* `disabled`, if true, stops the <Draggable> from dragging. It will stay where it is.
176+
*
177+
* Example:
178+
*
179+
* ```jsx
180+
* let App = React.createClass({
181+
* render: function () {
182+
* return (
183+
* <Draggable disabled={true}>
184+
* <div>I can't be dragged</div>
185+
* </Draggable>
186+
* );
187+
* }
188+
* });
189+
* ```
190+
*/
191+
disabled: React.PropTypes.bool,
192+
173193
/**
174194
* `grid` specifies the x and y that dragging should snap to.
175195
*
@@ -234,6 +254,7 @@ Draggable.propTypes = assign({}, DraggableCore.propTypes, {
234254
Draggable.defaultProps = assign({}, DraggableCore.defaultProps, {
235255
axis: 'both',
236256
bounds: false,
257+
disabled: false,
237258
grid: null,
238259
start: {x: 0, y: 0},
239260
zIndex: NaN

0 commit comments

Comments
 (0)