Skip to content

onKeyDownListener doesn't capture any event #90

Description

@Emilien1982

Device: DataLogic Memor 10
Android 8.1.0
RN 0.73
react-native-keyevent 0.3.2

My code:

useEffect( () => {
    KeyEvent.onKeyDownListener(handleKeyDown);
    return () => KeyEvent.removeKeyDownListener();
  }, []);
...
const handleKeyDown = (e) => {
    console.log( e )
  }

My callback is never fired.
I use an external bluetooth keyboard
And I also tried on Samsung S21 (Android 14). Nothing works.

Looks like I 'm the only one who have this issue. Did I miss something on install?
With RN 0.73, no need to manually link.
I'm a bit confused by the Configuration part of the doc because I didn't found MainActivity.java. I found MainActivity.kt, I tried to add the "overide onKeyDown" part. But no effect.

Any idea ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions