Skip to content

Conversation

@Cartas
Copy link
Contributor

@Cartas Cartas commented Dec 6, 2013

It's quite possible to end up with DOM elements within ReactTransitionGroups staying behind despite the leave transition having ended. This occurs when calling render which then attempts to add the same element to the Group at the same time as it is being removed/transitioning-out.

These elements remain behind, with their class forever set to 'name-leave name-leave-active'. In this instance I simply remove the 'leave' classes and re-add the 'enter' ones if necessary, to make the elements nicely reverse their animation/come back into view.

Fixes #649.

PS: I've signed the CLA with this github username.

Cartas added 2 commits December 6, 2013 14:46
… new one no longer bug-out.

In the case of having an animated node which is, after the leave-transition has been activated, then re-added in a render call causes React to 'break'.  This is especially noticeable if you spam to removal and re-addition of an item in a ReactTransitionGroup.

This fix simply stops the leave transition and restarts the enter transition.
@zpao
Copy link
Member

zpao commented Dec 11, 2013

cc @petehunt

@petehunt
Copy link
Contributor

This lgtm, need to do some stuff then I can merge it!

petehunt added a commit that referenced this pull request Dec 23, 2013
ReactTransitionGroup can handle components being re-added before 'leave' transition has completed.
@petehunt petehunt merged commit 128a35d into facebook:master Dec 23, 2013
@jedwards1211
Copy link
Contributor

This PR is mistitled -- it doesn't fix the issue for ReactTransitionGroup, only ReactCSSTransitionGroup. ReactTransitionGroup has this problem too. PR coming

@Cartas
Copy link
Contributor Author

Cartas commented Sep 30, 2015

@jedwards1211: Heh - the PR is almost two years old now! ReactCSSTransitionGroup didn't even exist yet. 😄

@jedwards1211
Copy link
Contributor

@Cartas oh, hah! Well in any case there's been a lot of work on fixing issues with ReactCSSTransitionGroup as it's now named, but it seems like not many people have found the need to use the underlying ReactTransitionGroup, so there hasn't been much focus on issues there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReactAnimationGroup failing to re-add components/reverse animations.

4 participants