Skip to content

Commit 6fd39db

Browse files
committed
fix(DraggableCore): fix passing style
When using `React.cloneElement(this.props.children, props), we used to override style by spreading it into another object. When that was removed, we simply passed style on, unmodified. It appears some quirk of `cloneElement` causes the render cycle to actually lose the value of `this.props.children.props.style`, causing it to pass `undefined`. This, of course, breaks just about everything. Because this is affecting dependent packages I am pushing an update now then will add a test to catch this.
1 parent 41a2c39 commit 6fd39db

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

lib/DraggableCore.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,6 @@ export default class DraggableCore extends React.Component<DraggableCoreProps, D
426426
// Reuse the child provided
427427
// This makes it flexible to use whatever element is wanted (div, ul, etc)
428428
return React.cloneElement(React.Children.only(this.props.children), {
429-
style: this.props.children.props.style,
430-
431429
// Note: mouseMove handler is attached to document so it will still function
432430
// when the user drags quickly and leaves the bounds of the element.
433431
onMouseDown: this.onMouseDown,

0 commit comments

Comments
 (0)