@@ -98,7 +98,11 @@ class CSSTransition extends React.Component {
9898 }
9999
100100 onEntered = ( node , appearing ) => {
101- const { doneClassName } = this . getClassNames ( 'enter' ) ;
101+ const appearClassName = this . getClassNames ( 'appear' ) . doneClassName ;
102+ const enterClassName = this . getClassNames ( 'enter' ) . doneClassName ;
103+ const doneClassName = appearing
104+ ? `${ appearClassName } ${ enterClassName } `
105+ : enterClassName ;
102106
103107 this . removeClasses ( node , appearing ? 'appear' : 'enter' ) ;
104108 addClass ( node , doneClassName ) ;
@@ -203,17 +207,29 @@ CSSTransition.propTypes = {
203207 ...Transition . propTypes ,
204208
205209 /**
206- * The animation classNames applied to the component as it enters, exits or has finished the transition.
207- * A single name can be provided and it will be suffixed for each stage: e.g.
210+ * The animation classNames applied to the component as it enters, exits or
211+ * has finished the transition. A single name can be provided and it will be
212+ * suffixed for each stage: e.g.
213+ *
214+ * `classNames="fade"` applies `fade-enter`, `fade-enter-active`,
215+ * `fade-enter-done`, `fade-exit`, `fade-exit-active`, `fade-exit-done`,
216+ * `fade-appear`, `fade-appear-active`, and `fade-appear-done`.
217+ *
218+ * **Note**: `fade-appear-done` and `fade-enter-done` will _both_ be applied.
219+ * This allows you to define different behavior for when appearing is done and
220+ * when regular entering is done, using selectors like
221+ * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply an
222+ * epic entrance animation when element first appears in the DOM using
223+ * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
224+ * simply use `fade-enter-done` for defining both cases.
208225 *
209- * `classNames="fade"` applies `fade-enter`, `fade-enter-active`, `fade-enter-done`,
210- * `fade-exit`, `fade-exit-active`, `fade-exit-done`, `fade-appear`, and `fade-appear-active`.
211226 * Each individual classNames can also be specified independently like:
212227 *
213228 * ```js
214229 * classNames={{
215230 * appear: 'my-appear',
216231 * appearActive: 'my-active-appear',
232+ * appearDone: 'my-done-appear',
217233 * enter: 'my-enter',
218234 * enterActive: 'my-active-enter',
219235 * enterDone: 'my-done-enter',
@@ -229,8 +245,8 @@ CSSTransition.propTypes = {
229245 * import styles from './styles.css';
230246 * ```
231247 *
232- * you might want to use camelCase in your CSS file, that way could simply spread
233- * them instead of listing them one by one:
248+ * you might want to use camelCase in your CSS file, that way could simply
249+ * spread them instead of listing them one by one:
234250 *
235251 * ```js
236252 * classNames={{ ...styles }}
@@ -239,6 +255,7 @@ CSSTransition.propTypes = {
239255 * @type {string | {
240256 * appear?: string,
241257 * appearActive?: string,
258+ * appearDone?: string,
242259 * enter?: string,
243260 * enterActive?: string,
244261 * enterDone?: string,
@@ -273,7 +290,6 @@ CSSTransition.propTypes = {
273290 */
274291 onEntered : PropTypes . func ,
275292
276-
277293 /**
278294 * A `<Transition>` callback fired immediately after the 'exit' class is
279295 * applied.
0 commit comments