-
Hi, everyone. thanks for this great library -- it's a pleasure to use. I was hoping someone could explain an issue I'm having getting an animation to properly trigger. I've got a two column layout: on the left-hand side there's a list of items, and on the right hand side a corresponding box. The effect I'm trying to go for is that when a user enters or leaves an item in the nav, the corresponding box will smoothly scale by 10%, like this: The state is represented like this:
The nav list uses
Then the boxes are rendered like this:
Finally (whew -- this is long, but thank you for bearing with me), the animated div is represented like this:
The issue I'm having is that while code works and the boxes change sizes, there is no actual animated transition. When I was trying this using the toggle with local state, there was that fun, satisfying bounce from the spring animation, but in this iteration, when I'm using a prop, there's just plain old change of state with no animations in between. I was hoping someone could point out what I'm missing? Any help or suggestions appreciated! Andrew ps -- here's the full code for reference:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After a bit more tweaking, I was able to make this work and thought I'd post the solution for future reference. Basically, the solution is to make the item you want to animate a custom component, as described in https://www.react-spring.io/docs/hooks/basics.
|
Beta Was this translation helpful? Give feedback.
After a bit more tweaking, I was able to make this work and thought I'd post the solution for future reference. Basically, the solution is to make the item you want to animate a custom component, as described in https://www.react-spring.io/docs/hooks/basics.