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]; }