Skip to content

Commit

Permalink
Fix natively driven animations not getting reset properly (#29585)
Browse files Browse the repository at this point in the history
Summary:
Fixes #28517

Animated.loop needs to reset the animation after each iteration but currently, natively driven animations are not getting reset properly.
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Fix natively driven animations not getting reset properly

Pull Request resolved: #29585

Test Plan: Tested within RNTester

Reviewed By: kacieb

Differential Revision: D28383538

Pulled By: yungsters

fbshipit-source-id: 40790ad8f825c402afc3515ef6afc00570704109
  • Loading branch information
phamfoo authored and facebook-github-bot committed May 13, 2021
1 parent 7252798 commit 129180c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Libraries/Animated/nodes/AnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ class AnimatedValue extends AnimatedWithChildren {
resetAnimation(callback?: ?(value: number) => void): void {
this.stopAnimation(callback);
this._value = this._startingValue;
if (this.__isNative) {
NativeAnimatedAPI.setAnimatedNodeValue(
this.__getNativeTag(),
this._startingValue,
);
}
}

_onAnimatedValueUpdateReceived(value: number): void {
Expand Down

0 comments on commit 129180c

Please sign in to comment.