I've been searching for a solution to use ReactJS animations in a RoR app using Coffeescript.
I've tried this (assets/javascript/components/sidebar/teams_form.js.jsx.coffee):
ReactCSSTransitionGroup = React.addons.CSSTransitionGroup
@TeamForm = React.createClass
render: ->
`<ReactCSSTransitionGroup transitionName="example" transitionAppearTimeout={500} transitionEnterTimeout={500} transitionLeaveTimeout={300}>
<div key="1">Coucou</div>
</ReactCSSTransitionGroup>`
In Chrome's developer tools (React tab), I see the following: Chrome dev tools screenshot
Here is my SASS code (assets/stylesheets/partials/_sidebar.sass):
.example-enter
background: yellow
transition: background 1s ease-in
.example-enter.example-enter-active
background: white
.example-leave
opacity: 1
transition: opacity .5s ease-in
.example-leave.example-leave-active
opacity: 0.01
The resulting code does not animate anything. It does a simple render with no background color. I've been looking for a solution for ages !
(The TeamForm is rendered after clicking on a link that creates the element and adds it to a given div by ID)
If someone could help me out, that would be great !!
Many thanks.
EDIT: I managed to get around the problem by simply adding / removing classes onClick with jQuery. However it doesn't seem to be the right solution. I'm still curious to learn how these animations work though.