2

I'm trying to develop React Native Expo app on Zebra Scanner OS android. I want to listen pressed F Keys or any physical keyboard events on main screen without text input. So far I tried couple of npm package but they didn't solve my problem. And keyboard expo doc only works for 'keyboardDidShow' and 'keyboardDidHide' Does anyone know how to handle keyevents on React Native Expo ?

https://github.com/chronsyn/react-native-keyevent-expo-config-plugin

This code didn't work.

import KeyEvent from 'react-native-keyevent';
  useEffect(() => {
    KeyEvent.onKeyDownListener((keyEvent) => {
      console.log(`onKeyDown keyCode: ${keyEvent.keyCode}`);
      console.log(`Action: ${keyEvent.action}`);
      console.log(`Key: ${keyEvent.pressedKey}`);
    });

    KeyEvent.onKeyMultipleListener((keyEvent) => {
      console.log(`onKeyDown keyCode: ${keyEvent.keyCode}`);
      console.log(`Action: ${keyEvent.action}`);
      console.log(`Key: ${keyEvent.pressedKey}`);
    });
  });

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.