Im trying to animate react router pages with TransitionGroup and gsap App
class App extends React.Component { render() { return ( <div> <ul> //links </ul> <div className="detail"> <TransitionGroup component="div"> {this.props.children} </TransitionGroup> </div> </div> ) } } Page component, only componentDidMount action is calling and animating, componentWillLeave not working.
class Page extends React.Component { componentDidMount() { // working var dom = ReactDOM.findDOMNode(this) TweenMax.fromTo(dom, 0.3, {y: 100, opacity: 0}, {y: 0, opacity: 1}) } render() { return ( <div> Page </div> ) } componentWillLeave() { // not working var dom = ReactDOM.findDOMNode(this) TweenMax.fromTo(dom, 0.3, {y: 0, opacity: 1}, {y: 100, opacity:0}) } } Im new to react, i have complex animations with each page loading and leaving, please help me to find a solution to fix this issue.
thanks in advance.
componentWillUnmountis not the lifecycle method you're looking for?componentWillUnmountit's triggering but not supports animations.componentWillUnmount? That will make it a bit easier to reasoncomponentWillUnmountnot working with animations.componentWillLeaveis not a lifecycle method thus it is not being called as per specs: facebook.github.io/react/docs/component-specs.html