From 64009b61cc3c25c8f96a8df8aaf83c06e3c9d3d3 Mon Sep 17 00:00:00 2001 From: Jake Murzy Date: Sun, 4 Sep 2016 15:51:59 -0700 Subject: [PATCH] fix NativeAnimated event listener bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 https://github.com/facebook/react-native/pull/9729 Differential Revision: D3818241 Pulled By: sahrens fbshipit-source-id: e235e3f97534ef2a50df29877ce36d3b6095237e --- Libraries/Animated/src/AnimatedImplementation.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index 3b4afd1bb..df08c066a 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -788,6 +788,7 @@ class AnimatedValue extends AnimatedWithChildren { } this.__nativeAnimatedValueListener.remove(); + this.__nativeAnimatedValueListener = null; NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag()); }