From eaa84997cedc8dc4d46308e2217d2b094a51ed02 Mon Sep 17 00:00:00 2001 From: Rahul Ramachandran Date: Wed, 13 Dec 2017 08:25:09 -0800 Subject: [PATCH] Fix - argument type in RCTEventEmitter Reviewed By: javache Differential Revision: D6528139 fbshipit-source-id: 170c2359bcc67131330d091e3707124018053938 --- React/Modules/RCTEventEmitter.h | 2 +- React/Modules/RCTEventEmitter.m | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/React/Modules/RCTEventEmitter.h b/React/Modules/RCTEventEmitter.h index f98195827..489b25039 100644 --- a/React/Modules/RCTEventEmitter.h +++ b/React/Modules/RCTEventEmitter.h @@ -39,6 +39,6 @@ - (void)stopObserving; - (void)addListener:(NSString *)eventName; -- (void)removeListeners:(NSInteger)count; +- (void)removeListeners:(double)count; @end diff --git a/React/Modules/RCTEventEmitter.m b/React/Modules/RCTEventEmitter.m index 9f54f1f49..4c0e6d19c 100644 --- a/React/Modules/RCTEventEmitter.m +++ b/React/Modules/RCTEventEmitter.m @@ -84,12 +84,13 @@ RCT_EXPORT_METHOD(addListener:(NSString *)eventName) } } -RCT_EXPORT_METHOD(removeListeners:(NSInteger)count) +RCT_EXPORT_METHOD(removeListeners:(double)count) { - if (RCT_DEBUG && count > _listenerCount) { + int currentCount = (int)count; + if (RCT_DEBUG && currentCount > _listenerCount) { RCTLogError(@"Attempted to remove more %@ listeners than added", [self class]); } - _listenerCount = MAX(_listenerCount - count, 0); + _listenerCount = MAX(_listenerCount - currentCount, 0); if (_listenerCount == 0) { [self stopObserving]; }