Permalink
Browse files

fix NativeAnimated event listener bug

Summary:
This bugfix cleans up reference to value listener upon unsubscribing to native events ultimately preventing RCTEventEmitter from throwing a [listener count error](https://github.com/facebook/react-native/blob/v0.33.0-rc.0/React/Modules/RCTEventEmitter.m#L90):

`Attempted to remove more RCTNativeAnimatedModule listeners than added`

/cc janicduplessis sahrens

🍺
Closes #9729

Differential Revision: D3818241

Pulled By: sahrens

fbshipit-source-id: e235e3f97534ef2a50df29877ce36d3b6095237e
  • Loading branch information...
1 parent dcdf16a commit 64009b61cc3c25c8f96a8df8aaf83c06e3c9d3d3 @jmurzy jmurzy committed with Facebook Github Bot 0 Sep 4, 2016
Showing with 1 addition and 0 deletions.
  1. +1 −0 Libraries/Animated/src/AnimatedImplementation.js
@@ -788,6 +788,7 @@ class AnimatedValue extends AnimatedWithChildren {
}
this.__nativeAnimatedValueListener.remove();
+ this.__nativeAnimatedValueListener = null;
NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());
}

0 comments on commit 64009b6

Please sign in to comment.