'React Native: Keydown global event listener

I have an external RFID reader connected to the Android app. There's a touch gesture when I tap on an external reader device to my react native app. Also, It manages to write down the output data but only in input text fields.

My problem is, the event seems like a keydown but I can't add a window.addEventListener to react native window or document does not recognized. Is there any alternative listener that I can use to get the output from external reader?

 useEffect(() => {
    const rfid = window.addEventListener('keydown', e => {
      console.log(e)
    })
    return () => window.removeEventListener(rfid)
  }, [])


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source