Skip to content

Commit 6d2ae35

Browse files
scarlacfacebook-github-bot
authored andcommitted
Added AnimatedValueXY.removeAllListeners
Summary: > Explain the **motivation** for making this change. What existing problem does the pull request solve? `AnimatedValueX` has `removeAllListeners()` which is a convenient way to do cleanup when components unmount, but `AnimatedValueXY` was missing a similar method which doesn't really make sense. This change makes the two classes more similar, less confusing and more convenient. Closes facebook#11783 Differential Revision: D4397188 fbshipit-source-id: d10a0c9c7e0a83af015ec04f6facf965d95ea984
1 parent 237ee2d commit 6d2ae35

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Libraries/Animated/src/AnimatedImplementation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,12 @@ class AnimatedValueXY extends AnimatedWithChildren {
10301030
delete this._listeners[id];
10311031
}
10321032

1033+
removeAllListeners(): void {
1034+
this.x.removeAllListeners();
1035+
this.y.removeAllListeners();
1036+
this._listeners = {};
1037+
}
1038+
10331039
/**
10341040
* Converts `{x, y}` into `{left, top}` for use in style, e.g.
10351041
*

0 commit comments

Comments
 (0)