11'use strict' ;
22var React = require ( 'react' ) ;
33var Draggable = require ( 'react-draggable' ) ;
4- var assign = require ( 'object-assign' ) ;
5- var PureRenderMixin = require ( 'react/lib/ReactComponentWithPureRenderMixin' ) ;
6- var cloneWithProps = require ( 'react/lib/cloneWithProps' ) ;
74
85var Resizable = module . exports = React . createClass ( {
96 displayName : 'Resizable' ,
10- mixins : [ PureRenderMixin ] ,
117
128 propTypes : {
139 children : React . PropTypes . element ,
@@ -54,13 +50,13 @@ var Resizable = module.exports = React.createClass({
5450
5551 render ( ) {
5652 var p = this . props ;
53+
5754 // What we're doing here is getting the child of this element, and cloning it with this element's props.
5855 // We are then defining its children as:
5956 // Its original children (resizable's child's children), and
6057 // A draggable handle.
61-
62- return cloneWithProps ( p . children , assign ( { } , p , {
63- children : [
58+ return React . cloneElement ( p . children , p ,
59+ [
6460 p . children . props . children ,
6561 < Draggable
6662 { ...p . draggableOpts }
@@ -71,11 +67,12 @@ var Resizable = module.exports = React.createClass({
7167 onDrag = { this . resizeHandler ( 'onResize' ) }
7268 minConstraints = { this . minConstraints ( ) }
7369 maxConstraints = { this . maxConstraints ( ) }
70+ key = "draggable"
7471 >
7572 < span className = "react-resizable-handle" />
7673 </ Draggable >
7774 ]
78- } ) ) ;
75+ ) ;
7976 }
8077} ) ;
8178
0 commit comments