forward prop updates to children in Velociraptor with React.cloneElement

pull/21833/head
Bruno Windels 2018-10-10 16:15:50 +02:00
parent 5128386160
commit f360b2db90
1 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,9 @@ module.exports = React.createClass({
if (oldNode && oldNode.style.visibility == 'hidden' && c.props.style.visibility == 'visible') {
oldNode.style.visibility = c.props.style.visibility;
}
self.children[c.key] = old;
// clone the old element with the props (and children) of the new element
// so prop updates are still received by the children.
self.children[c.key] = React.cloneElement(old, c.props, c.props.children);
} else {
// new element. If we have a startStyle, use that as the style and go through
// the enter animations