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

Trigger animation when playState changes from "paused" to "running" - stacked component #27

Open
d-fal opened this issue Jul 25, 2020 · 3 comments

Comments

@d-fal
Copy link

d-fal commented Jul 25, 2020

I want to trigger a ZoomOutDown to a component when a button fires. When I change the playState from "paused" to "running", nothing happens. Can you help how to do this?

` 

  <Animate
    duration="1s"
    iterationCount={100}
    playState={animateState}
    delay="1s"
    Animation={[ZoomOutDown]}
  >
  <button
    onClick={(e) => {
      e.preventDefault();
      setAnimateState("running");
    }}
  >
    Click
  </button>
 </Animate>

`

@dielduarte
Copy link
Owner

@d-fal sorry for the big delay on it.

in order to do that, you should only render the Animate component if the state is equal running in a declarative way, for now, there is no playState prop, although this is a valid idea to implement. will definitely add it to the backlog.

@dielduarte
Copy link
Owner

Hey @d-fal, Just got exactly what is happening!

We have a bug to control animation props when using stacked animations, on your example, you are passing the animation like: Animation={[ZoomOutDown]} try this way: Animation={ZoomOutDown}, not setting it as an array will only render the animation component instead of the stack animation component and the switch between paused or running will work as expected.

@dielduarte dielduarte changed the title Trigger animation when playState changes from "paused" to "running" Trigger animation when playState changes from "paused" to "running" - stacked component issues Dec 13, 2020
@dielduarte dielduarte changed the title Trigger animation when playState changes from "paused" to "running" - stacked component issues Trigger animation when playState changes from "paused" to "running" - stacked component Dec 13, 2020
@d-fal
Copy link
Author

d-fal commented Dec 13, 2020

@dielduarte, thanks for following this up. I would try this and report it back. Btw, it made me go deeper in reactjs animation and transition group. I would try to contribute to this project if I could.

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

2 participants