Fix JS animated node value updating when listener is attached

Summary:
The JS-side animated node values were not being updated on AnimatedValue (and thus AnimatedValueXY); however, the native event "onAnimatedValueUpdate" is being handled properly in AnimatedNode. It turns out that single underscore prefixed methods are obfuscated at FB. And thus AnimatedValue._onAnimatedValueUpdateReceived was not getting called. Changing the method name to double underscore as a way to denote "protected" fixes the issue.

Changelog:
[General][Fixed] - JS animated node value updates properly when listener is attached

Reviewed By: yungsters

Differential Revision: D33962038

fbshipit-source-id: c4f60e1f1ccc0cef3e65b89034bdb91376a26416
This commit is contained in:
Genki Kondo 2022-02-02 19:55:21 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 08faa130dd
Коммит 1f778014a7
2 изменённых файлов: 3 добавлений и 3 удалений

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

@ -130,12 +130,12 @@ class AnimatedNode {
if (data.tag !== this.__getNativeTag()) {
return;
}
this._onAnimatedValueUpdateReceived(data.value);
this.__onAnimatedValueUpdateReceived(data.value);
},
);
}
_onAnimatedValueUpdateReceived(value: number) {
__onAnimatedValueUpdateReceived(value: number) {
this.__callListeners(value);
}

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

@ -211,7 +211,7 @@ class AnimatedValue extends AnimatedWithChildren {
}
}
_onAnimatedValueUpdateReceived(value: number): void {
__onAnimatedValueUpdateReceived(value: number): void {
this._updateValue(value, false /*flush*/);
}