Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted to remove more SomeNativeModule listeners than added #19514

Closed
5 tasks done
lurui1029 opened this issue May 31, 2018 · 1 comment
Closed
5 tasks done

Attempted to remove more SomeNativeModule listeners than added #19514

lurui1029 opened this issue May 31, 2018 · 1 comment
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@lurui1029
Copy link

lurui1029 commented May 31, 2018

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 RCTEventEmitter and conform to RCTBridgeModule.
They all return same event names in - (NSArray<NSString *> *)supportedEvents;:
2018-05-31 11 17 38
2018-05-31 11 17 47

At JavaScript side, I use NativeEventEmitter to listen myEvent 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:
2018-05-31 11 25 43

When it comes to two or more, like:
2018-05-31 11 28 30

I got this red screen:
wechatimg13

I still got this red screen even if I wrote like this:
2018-05-31 11 31 44

Steps to Reproduce

  1. Two or more Native Classes that extends RCTEventEmitter and conform to RCTBridgeModule and has some same event names.
  2. At Javascript side, try to remove listeners.
  3. Get red screen.

Expected Behavior

  1. Every native class should manage its own events, even if it has same event names with other native classes
@react-native-bot
Copy link
Collaborator

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Jun 8, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jun 8, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jun 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
2 participants