Skip to content

Commit

Permalink
Fix JS animated node value updating when listener is attached
Browse files Browse the repository at this point in the history
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
  • Loading branch information
genkikondo authored and facebook-github-bot committed Feb 3, 2022
1 parent 08faa13 commit 1f77801
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Libraries/Animated/nodes/AnimatedNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/nodes/AnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class AnimatedValue extends AnimatedWithChildren {
}
}

_onAnimatedValueUpdateReceived(value: number): void {
__onAnimatedValueUpdateReceived(value: number): void {
this._updateValue(value, false /*flush*/);
}

Expand Down

0 comments on commit 1f77801

Please sign in to comment.