I've been trying to figure out how to trigger the react css transition group on scroll. Say i've got a stack of components and this example gets rendered off screen :
// component.jsx
import React from 'react'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
import './style.css'
export default class extends React.Component {
constructor() {
super()
this.state = {
title: ['an off screen title']}
}
render() {
const displayText = this.state.title.map(i => <h1 key={i}>{i.title}</h1>)
return (
<ReactCSSTransitionGroup
transitionName='atxt'
transitionEnterTimeout={1000}
transitionLeaveTimeout={1000}>
{displayText}
</ReactCSSTransitionGroup>
)
}
}
// style.css
.atxt-enter {
opacity: 0.01;
}
.atxt-enter.atxt-enter-active {
opacity: 1;
transition: opacity 1000ms ease-in;
}
.atxt-leave {
opacity: 1;
}
.atxt-leave.atxt-leave-active {
opacity: 0.01;
transition: opacity 1000ms ease-in;
}
I want the transition group to be triggered when it enters the View and not just when the component is initially rendered. I've been mulling over the docs and exploring pre-made libraries / components to accomplish this but have not found anything that doesn't involve bringing in huge animation libraries... I know deep in my cockles there is a way to do this, hence, asking the pros here. Cheers ya'll.