22
33var React = require ( 'react' ) ;
44var emptyFunction = function ( ) { } ;
5- var cloneWithProps = require ( 'react/lib/cloneWithProps ' ) ;
5+ var assign = require ( 'object-assign ' ) ;
66
77function createUIEvent ( draggable ) {
88 return {
@@ -24,7 +24,7 @@ function canDragX(draggable) {
2424}
2525
2626function isFunction ( func ) {
27- return typeof func === 'function' || Object . prototype . toString . call ( func ) === '[object Function]'
27+ return typeof func === 'function' || Object . prototype . toString . call ( func ) === '[object Function]' ;
2828}
2929
3030// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
@@ -92,7 +92,7 @@ function getControlPosition(e) {
9292 return {
9393 clientX : position . clientX ,
9494 clientY : position . clientY
95- }
95+ } ;
9696}
9797
9898function addEvent ( el , event , handler ) {
@@ -446,15 +446,15 @@ module.exports = React.createClass({
446446 style . zIndex = this . props . zIndex ;
447447 }
448448
449- var className = ' react-draggable';
449+ var className = ( this . props . children . props . className || '' ) + ' react-draggable';
450450 if ( this . state . dragging ) {
451451 className += ' react-draggable-dragging' ;
452452 }
453453
454454 // Reuse the child provided
455455 // This makes it flexible to use whatever element is wanted (div, ul, etc)
456- return cloneWithProps ( React . Children . only ( this . props . children ) , {
457- style : style ,
456+ return React . cloneElement ( React . Children . only ( this . props . children ) , {
457+ style : assign ( { } , this . props . children . props . style || { } , style ) ,
458458 className : className ,
459459
460460 onMouseDown : this . handleDragStart ,
0 commit comments