-
Notifications
You must be signed in to change notification settings - Fork 308
Radium breaks ReactTransitionGroup leave transition #544
Comments
Thanks for the details repro and investigation! I'll take a look and see what we can do. |
Did a little debugging, and noticed that After further digging, the key on the ReactTransitionGroup element is rendered with a slash |
Great, I appreciate the quick response and will keep an eye out for a fix. |
So, this all has to do with using if (Array.isArray(children)) {
const resolvedChildren = children.map(child => {
if (React.isValidElement(child)) {
return resolveStyles(component, child, config, existingKeyMap);
}
return child;
});
// We don't want to use React.Children.map, since it adds keys and modifies the children
// in a way component authors don't expect. To get a "blessed" array and avoid errors
// about missing keys, call `React.createElement` and steal the children.
return React.createElement.apply(
null,
['div', {}].concat(resolvedChildren)
).props.children;
} |
Instead of doing that, though, I fixed the bug in React: facebook/react#5892 Not sure what we should do in the interim here... |
@ianobermiller , thanks for figuring this out so quickly. It's not a blocker (for us, anyway) so we should be able to wait for the PR to be merged and released in the next React patch. Thanks again. |
I believe that's released as of React 15, so going to close this one. |
While working with Radium, I've noticed that components that are enhanced with Radium and which contain a ReactTransitionGroup do not call the componentWillLeave animation lifecycle method. Have a look at this example:
https://jsbin.com/wolopuzubu/edit?js,console,output
If you comment out the following line in the example (towards the bottom)
you will see that the leave transition works properly. Also worth noting is that when enhanced with Radium, the "appear" lifecycle hooks are run, as opposed to the "enter" and "leave" hooks when not enhanced with Radium.
After some investigation into the Radium source I found that removing the following logic fixes the problem, although I am not sure of why, nor of any other implications of removing this code:
From what I can tell, removing this code forces Radium to clone each element regardless of whether the children or props have changed, but again I am not sure why this fixes things.
Please let me know if I can offer any more information.
The text was updated successfully, but these errors were encountered: