-
Notifications
You must be signed in to change notification settings - Fork 199
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
Modernize Keyboard subscription, RN v0.65+ #244
Conversation
This change is true of all hooks in this library |
@gp3gp3gp3 - yes, the other hooks similarly need updates, but they're not as urgent. They are following proper deprecation rules, whereas console.log(Keyboard.removeListener); ..produces As far as I have seen, other hooks are still are supported in 0.65 as the API yet been hard-deprecated (although it may emit warnings. Example: Dimensions.addEventListener(...);
Dimensions.removeEventListener(...); These functions still exist in Relevant:
|
I think it's time to merge this pr on master. |
for (const subscription of subscriptions) { | ||
subscription.remove() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matinzd - I used to use forEach
more, now I follow unicorn lint pretty religiously for standards:
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-for-each.md
Happy to make the change though if you prefer forEach
Hello devs, Can you merge these changes and release new version of the library? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
When are you going to release a new version? |
I thought it was going to release automatically since I added the |
@pvinis was it you who set up automatic releasing? Or am I just forgetting how it works? 😅 |
i think so too 🤔. let me take a look now. |
🚀 PR was released in |
ok i did a manual release, i hope that worked well. i will try an automatic one to see whats up. |
something is up.. it might need some reconfiguration for automatic releases 🤔 |
It is still not on npm. Last release is for about year ago! |
Still getting the error for
|
@retyui Thank you I'll upgrade as soon as it gets released! |
Summary
React Native 0.65 seems to not support Keyboard.removeListener anymore. Technically it's deprecated, but if you run
...it produces
undefined
Test Plan
What's required for testing (prerequisites)?
useKeyboard
within a component that gets destroyed, on React Native v0.65What are the steps to reproduce (after prerequisites)?
useKeyboard
within a component that then is destroyed via re-renderCompatibility