File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ReactDOM from 'react-dom';
55import config from './config' ;
66import { timeoutsShape } from './utils/PropTypes' ;
77import TransitionGroupContext from './TransitionGroupContext' ;
8+ import { nextTick } from "./utils/nextTick"
89
910export const UNMOUNTED = 'unmounted' ;
1011export const EXITED = 'exited' ;
@@ -212,7 +213,15 @@ class Transition extends React.Component {
212213 this . cancelNextCallback ( ) ;
213214
214215 if ( nextStatus === ENTERING ) {
215- this . performEnter ( mounting ) ;
216+ // https://github.com/reactjs/react-transition-group/pull/749
217+ // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
218+ // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
219+ if ( this . props . unmountOnExit || this . props . mountOnEnter ) {
220+ // `exited` -> `entering`
221+ nextTick ( ( ) => this . performEnter ( mounting ) ) ;
222+ } else {
223+ this . performEnter ( mounting ) ;
224+ }
216225 } else {
217226 this . performExit ( ) ;
218227 }
Original file line number Diff line number Diff line change 1+ // polyfill for requestAnimationFrame
2+ const rAF = typeof window !== "undefined" && typeof window . requestAnimationFrame === "function" ? window . requestAnimationFrame : cb => setTimeout ( cb , 1 )
3+
4+ // https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
5+ // Note: Your callback routine must itself call requestAnimationFrame() again
6+ // if you want to animate another frame at the next repaint. requestAnimationFrame() is 1 shot.
7+ export const nextTick = cb => rAF ( ( ) => rAF ( cb ) )
You can’t perform that action at this time.
0 commit comments