react-native-popup-menu
react-native-popup-menu copied to clipboard
Register BackHandler in Menu rather than MenuProvider
Fixes #192 by making sure react-native-popup-menu's registers with BackHandler after React Navigation does.
The backHandler property and implementation are left on MenuProvider just to avoid API changes.
I also left the warning about RN<0.44 just because it was easy to copy/paste, but do you really think anybody would try using a new version of this library with a version of React Native before 0.44 at this point...?
@sodik82 Are you still around? Could fix this be merged? Or were there concerns about it?
Oh dang I hadn't noticed those tests 🤦
I'll sort them out.
(good on you having them and setting up the CI... so many GitHub projects are lacking in that department)
thanks for effort... yes, CI are good ;-)
Tests should be passing now, and added some new ones while I was there
thanks... looks good. I just want to test it a bit to see how does it work when there are multiple menus rendered at one time... ping me in a week if there is no change ;-)
Mm, good thinking, I admit that's not a use case of ours so I hadn't considered it.
what do you think - isn't it enough to register back handler on menu being open?
Hmm. It might be. As long as it's reliably added/removed whenever menus are opened/closed so there aren't stray/duplicate handlers? (regardless of how the open/close was triggered)
It's been a year and half since I looked at this code... does all opening/closing go through MenuProvider's openMenu/closeMenu?
to be honest - as I am thinking about it - I don't like registration of backhandler for each menu.... would something like this be fine with you (i.e. would it solve your problem) https://github.com/instea/react-native-popup-menu/pull/251 ?
in special situation (special custom backhandler) it is breaking change (since the backhandler is registered only after the menu is opened for the first time)
@sodik82 I tried the change in #251 and that seems okay to me. Why was that closed and the branch deleted?
shit happens - our migration script overwrite the repo with old version and closed every PR in the process