maisano / react-router-transition

painless transitions built for react-router, powered by react-motion
http://maisano.github.io/react-router-transition/
MIT License
2.59k stars 138 forks source link

Using it with React-snapshot #60

Closed jasan-s closed 7 years ago

jasan-s commented 7 years ago

If I use this with react-sanpshot the resulting static markup from react-snaptshot has a less then 1 opacity. I'm using react-router-Transition like so in my main App.js:

      <RouteTransition
          pathname={this.props.location.pathname}
          atEnter={{opacity: 0}}
          atLeave={{opacity: 2}}
          atActive={{opacity: 1}}
          mapStyles={styles => {
            if (styles.opacity > 1) {
              return {display: 'none'}
            }
            return {opacity: styles.opacity}
          }}>

Any suggestions as to why that is?

jacobangel commented 7 years ago

I gave the react-snapshot and your route configuration a try with the demo app. It worked, with some coaxing (the demo app doesn't use CRA). It took snapshots with opacity at 1.

Your configuration for the tool is either incorrect, or you are taking the snapshot before the animation has completed. You should try setting your configuration for react-snapshot to something more than a second just to be safe.

 "reactSnapshot": {
    "snapshotDelay": 1300
  }

If that doesn't work, it's probably an issue with the application's setup.

jasan-s commented 7 years ago

even adding 4300 snapshot delay leads to less than 1 opacity html files. the div ends up having inline style with opacity: 0.16504117112482844; Any suggestions where in app i should start. the app is pretty bare bones.