Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/CSSTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React from 'react';

import Transition from './Transition';
import { classNamesShape } from './utils/PropTypes';
import { forceReflow } from './utils/reflow';

const addClass = (node, classes) =>
node && classes && classes.split(' ').forEach((c) => addOneClass(node, c));
Expand Down Expand Up @@ -194,8 +195,7 @@ class CSSTransition extends React.Component {
// This is to force a repaint,
// which is necessary in order to transition styles when adding a class name.
if (phase === 'active') {
/* eslint-disable no-unused-expressions */
node && node.scrollTop;
if (node) forceReflow(node);
}

if (className) {
Expand Down
17 changes: 9 additions & 8 deletions src/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ReactDOM from 'react-dom';
import config from './config';
import { timeoutsShape } from './utils/PropTypes';
import TransitionGroupContext from './TransitionGroupContext';
import { nextTick } from './utils/nextTick';
import { forceReflow } from './utils/reflow';

export const UNMOUNTED = 'unmounted';
export const EXITED = 'exited';
Expand Down Expand Up @@ -213,15 +213,16 @@ class Transition extends React.Component {
this.cancelNextCallback();

if (nextStatus === ENTERING) {
// https://github.com/reactjs/react-transition-group/pull/749
// With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
// To make the animation happen, we have to separate each rendering and avoid being processed as batched.
if (this.props.unmountOnExit || this.props.mountOnEnter) {
// `exited` -> `entering`
nextTick(() => this.performEnter(mounting));
} else {
this.performEnter(mounting);
const node = this.props.nodeRef
? this.props.nodeRef.current
: ReactDOM.findDOMNode(this);
// https://github.com/reactjs/react-transition-group/pull/749
// With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
// To make the animation happen, we have to separate each rendering and avoid being processed as batched.
if (node) forceReflow(node);
}
this.performEnter(mounting);
} else {
this.performExit();
}
Expand Down
11 changes: 0 additions & 11 deletions src/utils/nextTick.js

This file was deleted.

1 change: 1 addition & 0 deletions src/utils/reflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const forceReflow = (node) => node.scrollTop;