-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
[RN 0.58] removeOrientationListener doesn't remove the listener #21
Comments
I have the same problem. And I take advantage to ask for a global listener for detect orientation changes, in order to set current orientation on Redux when it changes and use it along all my app. |
Thank you! @lschuft ... it works! |
Hi there @lschuft and thanks for taking the time to write this detailed post. Sorry I've been a bit busy of the past weeks and reply earlier. Will have a look soon and come back with a fix and a new release! :) @manelsanz if you had a global listener you would still need to change/set |
@marudy I want to register a global listener in order to know when screen orientation changes. On this listener, I would store the new orientation on Redux so through all my screens I could know the current orientation of screen. When state of Redux is updated, I would detect it in all my screens and will change style depending on orientation. |
Hey guys, my time is very limited during this period. I would strongly appreciate if someone could take the time and create a PR for this 👍 |
@lschuft Can you please approve that this approach is working as expected! You can find a working example under development/examples/responsive-screen-orientation-change |
@AhmedMKamal thanks again for offering a PR :) @lschuft can you have a look as well in order to get this PR ready? Thanks |
Thanks @AhmedMKamal ! @marudy I'm a bit busy with tons of work this week, will try to look into this in the weekend so we can close this. |
Yes please @lschuft ! 👍 |
Hey @lschuft I know you are busy man, but if you could review here it would be great! Cheers |
Hi there, thank for you for this package.
I'm using it in the Login screen of an app I'm making, and I'm having an issue using the removeOrientationListener method. When I debug, I see that it does not remove the subscription, so when I change screens, I get the following warning:
I'm using RN 0.58.4. The issue is in EventEmitter.js:213, in the removeListener method. This requires that the original handler specified in listenOrientationChange be included in the parameters (right now, an empty function is passed instead) because of this check:
Perhaps this was a change in recent RN version. I needed a quick fix so I patched up index.js of this library to workaround this problem, like this:
This solved the problem in my case, although a prettier solution should be possible (don't think it's okay to mess with the component properties...).
Please let me know if something isn't clear. I don't include the code of my Login page because it follows exactly this README example.
The text was updated successfully, but these errors were encountered: