You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I remove a child from a ReactTransitionGroup before it calls its componentWillEnter callback, ReactTransitionGroup doesn't call its componentWillLeave until componentWillEnter calls its callback.
This may be the intended behavior, but this is not the way CSS transitions behave, at least not in modern browsers I know. If you have <div style="transition: opacity linear 5s">, and you toggle its opacity from 0.01 to 1 every second, the div never finishes going through the first 5 second transition, rather, it gets interrupted after one second and a new transition from about 0.2 back to 0.01 begins.
Here is a spec for CSS-like ReactTranstionGroup behavior:
It internally keeps track of whether a component is appearing, entering, or leaving
If a component is removed while it's entering or appearing, its state is set to leaving and its componentWillLeave is called immediately
If a component is added back while it's leaving, its state is set to entering and its componentWillEnter is called immediately
When componentWillAppear calls its callback, no action is taken unless the component is in appearing state.
When componentWillEnter calls its callback, no action is taken unless the component is in entering state.
When componentWillLeave calls its callback, no action is taken unless the component is in leaving state.
The text was updated successfully, but these errors were encountered:
jedwards1211
changed the title
ReactTransitionGroup: transitions should interrupt incomplete transitions like CSS transitions
ReactTransitionGroup: in-progress transitions should be interruptible, just like CSS transitions
Oct 1, 2015
I’m going to close since we don’t plan any more changes to TransitionGroup in React repo. Instead, it now is maintained by the community, and you can file an issue in the new repository if this is still affecting you. Thanks!
If I remove a child from a
ReactTransitionGroup
before it calls itscomponentWillEnter
callback,ReactTransitionGroup
doesn't call itscomponentWillLeave
untilcomponentWillEnter
calls its callback.This may be the intended behavior, but this is not the way CSS transitions behave, at least not in modern browsers I know. If you have
<div style="transition: opacity linear 5s">
, and you toggle its opacity from0.01
to1
every second, the div never finishes going through the first 5 second transition, rather, it gets interrupted after one second and a new transition from about0.2
back to0.01
begins.I have a repo to reproduce this issue here: https://github.com/jedwards1211/react-transition-group-issue
If you run it and look at the console you will see how component leaving gets held up until components finish entering:
The 'entered' messages should never appear because the components should leave before they finish entering, like so:
Here is a spec for CSS-like
ReactTranstionGroup
behavior:componentWillLeave
is called immediatelycomponentWillEnter
is called immediatelycomponentWillAppear
calls its callback, no action is taken unless the component is in appearing state.componentWillEnter
calls its callback, no action is taken unless the component is in entering state.componentWillLeave
calls its callback, no action is taken unless the component is in leaving state.The text was updated successfully, but these errors were encountered: