@@ -67,23 +67,21 @@ You can use these classes to trigger a CSS animation or transition. For example,
.example-enter.example-enter-active {
opacity: 1;
- transition: opacity .5s ease-in;
+ transition: opacity 500ms ease-in;
}
-```
-
-You'll notice that when you try to remove an item `ReactCSSTransitionGroup` keeps it in the DOM. If you're using an unminified build of React with add-ons you'll see a warning that React was expecting an animation or transition to occur. That's because `ReactCSSTransitionGroup` keeps your DOM elements on the page until the animation completes. Try adding this CSS:
-```css
.example-leave {
opacity: 1;
}
.example-leave.example-leave-active {
opacity: 0.01;
- transition: opacity .5s ease-in;
+ transition: opacity 300ms ease-in;
}
```
+You'll notice that animation durations need to be specified in both the CSS and the render method; this tells React when to remove the animation classes from the element and -- if it's leaving -- when to remove the element from the DOM.
+
### Animate Initial Mounting
`ReactCSSTransitionGroup` provides the optional prop `transitionAppear`, to add an extra transition phase at the initial mount of the component. There is generally no transition phase at the initial mount as the default value of `transitionAppear` is `false`. The following is an example which passes the prop `transitionAppear` with the value `true`.
@@ -91,7 +89,7 @@ You'll notice that when you try to remove an item `ReactCSSTransitionGroup` keep
```javascript{3-5}
render: function() {
return (
-
+