iOS - ability to keep default key event behavior?
Hi friends,
Thank you for this great library! I have a question:
I'm trying to use this library to work with bluetooth-connected barcode scanners. I created a component in my React Native project that is always listening, and when it gets a set of numbers very quickly it guesses that it is a scan and passes that series of numbers to a handler. We're using this library so that we can have something that is always listening wherever the user is in the application. However, we do have text fields (for search, for instance), where the user will likely type text.
On Android, this is working great; we set it up like this:
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
KeyEventModule.getInstance().onKeyUpEvent(keyCode, event);
return super.onKeyUp(keyCode, event);
}
so that it triggers our listener and keeps default key behavior. This way users can still type into the text fields (or scan into them if they'd like) and the app is responding appropriately when it thinks it got a scanned UPC.
However, it appears that iOS doesn't pass key events along - as soon as I set up onKeyUpListener, I no longer get typed text in any of the text fields in the app (but scanning is working as it should). I'm just now digging into Apple's docs, but I've never done native development before and am wondering if anyone has a quick answer about how to make that behave the way we'd like... so far I'm thinking that we have to send the key event to the next responder in the chain?
Thanks again; any advice would be very appreciated!
Did you come up with any solution? I am currently facing exact the same problem.