Fix natively driven animations not getting reset properly (#29585)

Summary:
Fixes https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/29585

Test Plan: Tested within RNTester

Reviewed By: kacieb

Differential Revision: D28383538

Pulled By: yungsters

fbshipit-source-id: 40790ad8f825c402afc3515ef6afc00570704109
This commit is contained in:
Tien Pham 2021-05-13 00:42:27 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 7252798abf
Коммит 129180c77b
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -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 {