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

replace deprecated RCTEventDispatcher #68

Merged
merged 2 commits into from Sep 30, 2017

Conversation

koenpunt
Copy link
Collaborator

@koenpunt koenpunt commented Sep 24, 2017

To not break the public API I've mapped the add/removeEventListener to NativeEventEmitter's addListener, instead of returning the subscription; this is a common pattern that can be found also in the React Native core (e.g.: https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/Libraries/Network/NetInfo.js#L210)

My previous comment was not completely valid; NativeEventEmitter also implements a removeListener method, so no need to keep track of the listeners ourselves. Still unclear why they use that pattern in the NetInfo module tho..

@koenpunt koenpunt merged commit 8b77a19 into naoufal:master Sep 30, 2017
@koenpunt koenpunt deleted the eventemitter branch September 30, 2017 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant