Skip to content

Animated: Lower onAnimatedValueUpdate to AnimatedValue#48514

Closed
yungsters wants to merge 2 commits into
facebook:mainfrom
yungsters:export-D67884973
Closed

Animated: Lower onAnimatedValueUpdate to AnimatedValue#48514
yungsters wants to merge 2 commits into
facebook:mainfrom
yungsters:export-D67884973

Conversation

@yungsters
Copy link
Copy Markdown
Contributor

Summary:
Currently, AnimatedNode implements logic to start listening to updates on the current native node if a listener is added.

However, the startListeningToAnimatedNodeValue native module method only supports native tags for instances of AnimatedValue, which is a subclass of AnimatedNode. In fact…

As such, this refactors AnimatedNode to never manage this subscription for native nodes. Instead, the logic is moved into the AnimatedValue subclass, ensuring that we never accidentally try to startListeningToAnimatedNodeValue with non-AnimatedValue native tags.

Changelog:
[Internal]

Differential Revision: D67884973

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jan 7, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D67884973

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D67884973

yungsters and others added 2 commits January 7, 2025 07:49
Summary:
While refactoring `Animated`, I noticed that many subclasses of `AnimatedNode` override `__attach` without invoking the superclass method, even though we do this for `__detach`.

In order to minimize surprise (e.g. if someone were to add logic into `AnimatedNode.prototype.__attach`), this diff updates all method overrides to invoke `super.__attach()`.

Changelog:
[Internal]

Differential Revision: D67884975
…48514)

Summary:
Pull Request resolved: facebook#48514

Currently, `AnimatedNode` implements logic to start listening to updates on the current native node if a listener is added.

However, the `startListeningToAnimatedNodeValue` native module method only supports native tags for instances of `AnimatedValue`, which is a subclass of `AnimatedNode`. In fact…

* On Android, [`startListeningToAnimatedNodeValue`](https://fburl.com/code/bdsl4sro) throws if the node is not an instance of `ValueAnimatedNode`.
* On iOS, [`startListeningToAnimatedNodeValue`](https://fburl.com/code/hlpk1rzk) does nothing if node is not an instance of `RCTValueAnimatedNode`.

As such, this refactors `AnimatedNode` to never manage this subscription for native nodes. Instead, the logic is moved into the `AnimatedValue` subclass, ensuring that we never accidentally try to `startListeningToAnimatedNodeValue` with non-`AnimatedValue` native tags.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D67884973
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D67884973

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 7, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 38c46fe.

@yungsters yungsters deleted the export-D67884973 branch March 13, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants