Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacking containers after each route transition #90

Open
ryancoughlin opened this issue Mar 3, 2018 · 3 comments
Open

Stacking containers after each route transition #90

ryancoughlin opened this issue Mar 3, 2018 · 3 comments

Comments

@ryancoughlin
Copy link

I started to notice the performance to lag a bit after playing with a transition. My routes started to stack (the one I was opening).

screen shot 2018-03-03 at 12 21 50 am

Thought on this behavior?

// we need to map the `scale` prop we define below
// to the transform style property
function mapStyles(styles) {
  return {
    opacity: styles.opacity,
    transform: `scale3d(${styles.scale}, ${styles.scale}, 1)`,
  }
}

// wrap the `spring` helper to use a bouncy config
function bounce(val) {
  return spring(val, {
    stiffness: 174,
    damping: 26,
  })
}

// child matches will...
const bounceTransition = {
  // start in a transparent, upscaled state
  atEnter: {
    opacity: 0,
    scale: bounce(0.9),
  },
  // leave in a transparent, downscaled state
  atLeave: {
    opacity: 0,
    scale: bounce(0.9),
  },
  // and rest at an opaque, normally-scaled state
  atActive: {
    opacity: 1,
    scale: bounce(1),
  },
}

class App extends Component {
  render() {
    return (
      <Router>
        <AnimatedSwitch
          atEnter={bounceTransition.atEnter}
          atLeave={bounceTransition.atLeave}
          atActive={bounceTransition.atActive}
          mapStyles={mapStyles}
          className="switch-wrapper"
        >
          <Route exact path="/" component={Location} />
          <Route exact path="/tables" component={TideTables} />
        </AnimatedSwitch>
      </Router>
    )
  }
}

export default App
@maisano
Copy link
Owner

maisano commented Mar 6, 2018

that's strange–are there any exceptions being thrown? my guess is that the components might be throwing some error right before they're supposed to unmount.

@danedavid
Copy link
Contributor

@ryancoughlin could you share a working link of the error reproduced ?

@geekeren
Copy link

Any update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants