Attempted to remove more SomeNativeModule listeners than added #19514
Labels
Ran Commands
One of our bots successfully processed a command.
Resolution: Locked
This issue was locked by the bot.
react-native info
in your terminal and paste its contents under "Environment"share an app that reproduces the issue using https://snack.expo.io/
Environment
Environment:
OS: macOS High Sierra 10.13.4
Node: 8.9.0
Yarn: 1.2.1
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.3.1 Build version 9E501
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0
react-native: 0.54.3 => 0.54.3
Description
I have two or more Objective-C Classes that extend
![2018-05-31 11 17 38](https://cdn.statically.io/img/user-images.githubusercontent.com/9585681/40759353-4a4aad32-64c4-11e8-9ab3-2f55e0d0332d.png)
![2018-05-31 11 17 47](https://cdn.statically.io/img/user-images.githubusercontent.com/9585681/40759357-4cb06f62-64c4-11e8-83e7-ecf9a9bf9a91.png)
RCTEventEmitter
and conform toRCTBridgeModule
.They all return same event names in
- (NSArray<NSString *> *)supportedEvents;
:At JavaScript side, I use
![2018-05-31 11 25 43](https://cdn.statically.io/img/user-images.githubusercontent.com/9585681/40759607-61dbb76a-64c5-11e8-93c0-79f01510f6a2.png)
NativeEventEmitter
to listenmyEvent
of these native classes. However, I need to make sure there's only one listener around so I remove all existing listeners before adding new one. It works fine when I only manipulate one single native module:When it comes to two or more, like:
![2018-05-31 11 28 30](https://cdn.statically.io/img/user-images.githubusercontent.com/9585681/40759694-c47576cc-64c5-11e8-9cc5-d956b1e5f7c8.png)
I got this red screen:
![wechatimg13](https://cdn.statically.io/img/user-images.githubusercontent.com/9585681/40759709-d40d41dc-64c5-11e8-8c94-527cfa283605.jpeg)
I still got this red screen even if I wrote like this:
![2018-05-31 11 31 44](https://cdn.statically.io/img/user-images.githubusercontent.com/9585681/40759803-366dba1e-64c6-11e8-9797-4a313d461049.png)
Steps to Reproduce
RCTEventEmitter
and conform toRCTBridgeModule
and has some same event names.Expected Behavior
The text was updated successfully, but these errors were encountered: