Permalink
Browse files

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 #11783

Differential Revision: D4397188

fbshipit-source-id: d10a0c9c7e0a83af015ec04f6facf965d95ea984
  • Loading branch information...
scarlac authored and facebook-github-bot committed Jan 14, 2017
1 parent 237ee2d commit 6d2ae35bca7c5a35e9c537880ebb2f3d5cbaec76
Showing with 6 additions and 0 deletions.
  1. +6 −0 Libraries/Animated/src/AnimatedImplementation.js
@@ -1030,6 +1030,12 @@ class AnimatedValueXY extends AnimatedWithChildren {
delete this._listeners[id];
}
removeAllListeners(): void {
this.x.removeAllListeners();
this.y.removeAllListeners();
this._listeners = {};
}
/**
* Converts `{x, y}` into `{left, top}` for use in style, e.g.
*

0 comments on commit 6d2ae35

Please sign in to comment.