-
Notifications
You must be signed in to change notification settings - Fork 8
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
State changes that don't happen through tweens can break them #3
Comments
Maybe we can circumvent the issue by inspecting the tween instance when the plugin initializes, and look for the |
lettertwo
added a commit
that referenced
this issue
Jul 17, 2014
Previously, all tweens shared a tween state which was bound to the target component. Now, every tween maintains its own state internally, and merely initializes its state based on the shared state (giving priority to the actual component state). I think this addresses GH-3, but I guess we'll need a bit more real world testing to know for sure.
lettertwo
added a commit
that referenced
this issue
Jul 17, 2014
Previously, all tweens shared a tween state which was bound to the target component. Now, every tween maintains its own state internally, and merely initializes its state based on the shared state (giving priority to the actual component state). I think this addresses GH-3, but I guess we'll need a bit more real world testing to know for sure.
Just published v1.0.2 which might be a workable solution to this problem. I guess we'll have to wait and see... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because state changes in React components can be asynchronous, the plugin has to track a proxy for the component state so that multiple tweens can act in between component updates.
But, because the component doesn't know about this proxy, there is no way for the tweens to know when the state is changed outside of the tweening process. For example:
There doesn't seem to be any good options for solving this.
Here are some bad ones:
target.state
directly (instead of maintaining an separate tween state and binding them together)componentShouldUpdate
andcomponentDidUpdate
, when comparisons between previous and next tween states are inaccurate (since the state gets mutated directly between renders by the tween)target.setState
to make sure it also updates the tween statesetTweenState
method to the component that can update the tween proxy object and callsetState
setState
(or at least everywhere that the component would want to update state that is also being tweened)The text was updated successfully, but these errors were encountered: