chenglou / react-tween-state

React animation.
Other
1.74k stars 70 forks source link

Tween props between renders #6

Closed benoneal closed 10 years ago

benoneal commented 10 years ago

So say I have a component which is displaying a number being passed down as a prop from a parent component. When that prop changes and the component re-renders, I'd like to animate that number incrementing to the new prop value (and using easing to decelerate the increment speed as it approaches the new value).

This doesn't seem possible with this currently, as moving the prop to the child component's state decouples it from being updated.

There aren't any other existing solutions that I've found so far, and this repo gives everything I'd want... except that it won't work on props... Is there a way support for props might be added?

benoneal commented 10 years ago

Scratch this issue: figured out a way to do it with componentDidUpdate() if prevProps != props.

chenglou commented 10 years ago

Everything just works I guess? =D

Keep the feedback coming! Thanks.