Gatsby: About react page transition

Created on 29 Sep 2017  路  7Comments  路  Source: gatsbyjs/gatsby

I create animated page transitions by "react-addons-css-transition-group".
But The page switching animation was all bound to the target page.
my enter page and leave page is the same page.
what happened?

location.pathname is the same value.

there is code:

render() {
    const { location, children } = this.props;
    return (
      <div>
        <SiteNavi title={siteMetadata.title} {...this.props} />
            <ReactCSSTransitionGroup
              transitionName="example"
              component="div"
              className="transitionWrapper"
              transitionEnterTimeout={500}
              transitionLeaveTimeout={300}
              >
              <div key={location.pathname}
                 style={{position:"absolute", width: "100%"}}
                >
                <div className="vheight">
                  {children()}
                  {console.log(location.pathname)}// There is only one output
                </div>
              </div>
            </ReactCSSTransitionGroup>
        <SiteFooter />
      </div>
    )
  }
documentation question or discussion

Most helpful comment

@aouerfelli Thanks!

My problem now is that I'm using react-motion's TransitionMotion component and it doesn't seem to be playing nice with the lifecycle of ReplaceComponentRenderer.

Anyone else using an animation library or api other than react-transition-group to achieve a similar effect?

All 7 comments

Hello @FourEyebrowXiake !
Please see this https://github.com/gatsbyjs/gatsby/issues/1854

@sebastienfi when I use your code I get an error : Cannot read property 'getResourcesForPathname' of undefined.

This is happening because the loader prop on ReplaceComponentRouter is undefined. Not sure how to pass this in or why it is not present.

Anything I could be missing?

@rongierlach Updating Gatsby fixed it for me.

@aouerfelli Thanks!

My problem now is that I'm using react-motion's TransitionMotion component and it doesn't seem to be playing nice with the lifecycle of ReplaceComponentRenderer.

Anyone else using an animation library or api other than react-transition-group to achieve a similar effect?

Any update of this issue?

@calpa yeah, check out the example site @sebastienfi linked to!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jimfilippou picture jimfilippou  路  3Comments

timbrandin picture timbrandin  路  3Comments

ghost picture ghost  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments