Animated: Add Missing super.__attach() Calls (#48513)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48513

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]

Reviewed By: javache

Differential Revision: D67884975

fbshipit-source-id: f3a5456cf944d4d70ba1cfe7c44897c110e5fc7e
This commit is contained in:
Tim Yung
2025-01-07 10:05:15 -08:00
committed by Facebook GitHub Bot
parent 3f6fc32a5c
commit d3c5f6d1df
12 changed files with 12 additions and 0 deletions
@@ -52,6 +52,7 @@ export default class AnimatedAddition extends AnimatedWithChildren {
__attach(): void {
this._a.__addChild(this);
this._b.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -60,6 +60,7 @@ export default class AnimatedDiffClamp extends AnimatedWithChildren {
__attach(): void {
this._a.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -68,6 +68,7 @@ export default class AnimatedDivision extends AnimatedWithChildren {
__attach(): void {
this._a.__addChild(this);
this._b.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -376,6 +376,7 @@ export default class AnimatedInterpolation<
__attach(): void {
this._parent.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -47,6 +47,7 @@ export default class AnimatedModulo extends AnimatedWithChildren {
__attach(): void {
this._a.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -51,6 +51,7 @@ export default class AnimatedMultiplication extends AnimatedWithChildren {
__attach(): void {
this._a.__addChild(this);
this._b.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -136,6 +136,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
const node = nodes[ii];
node.__addChild(this);
}
super.__attach();
}
__detach(): void {
@@ -160,6 +160,7 @@ export default class AnimatedProps extends AnimatedNode {
const node = nodes[ii];
node.__addChild(this);
}
super.__attach();
}
__detach(): void {
@@ -201,6 +201,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
const node = nodes[ii];
node.__addChild(this);
}
super.__attach();
}
__detach(): void {
@@ -52,6 +52,7 @@ export default class AnimatedSubtraction extends AnimatedWithChildren {
__attach(): void {
this._a.__addChild(this);
this._b.__addChild(this);
super.__attach();
}
__detach(): void {
@@ -67,6 +67,7 @@ export default class AnimatedTracking extends AnimatedNode {
let {platformConfig} = this._animationConfig;
this.__makeNative(platformConfig);
}
super.__attach();
}
__detach(): void {
@@ -117,6 +117,7 @@ export default class AnimatedTransform extends AnimatedWithChildren {
const node = nodes[ii];
node.__addChild(this);
}
super.__attach();
}
__detach(): void {