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

Android removeListeners implementation incorrect #567

Closed
mikehardy opened this issue Jan 25, 2022 · 3 comments · Fixed by #569
Closed

Android removeListeners implementation incorrect #567

mikehardy opened this issue Jan 25, 2022 · 3 comments · Fixed by #569
Labels

Comments

@mikehardy
Copy link
Contributor

I think count is the number of listeners to remove, so we need to track the number of listener and if the number of listeners is 0 then hasListener should be false

Originally posted by @Legion2 in #548 (comment)

@mikehardy
Copy link
Contributor Author

I think you are correct - https://github.com/facebook/react-native/blob/4f1f42b0761bff7a68c85cae6de0c4c58c5031d5/Libraries/EventEmitter/NativeEventEmitter.js#L105

So it looks current code will be correct for the case where no listener has been added ever, or when listener count is > 0, but if listeners have been added and removed such that there should no longer be listeners, this will never work without counting and decrementing.

I won't have time to repair this but if you can post a PR I can certainly merge it - thanks for noting it at minimum so that it is tracked now

@Legion2
Copy link
Contributor

Legion2 commented Jan 26, 2022

I created #569

@matt-oakes
Copy link
Collaborator

🎉 This issue has been resolved in version 7.1.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants