tttstudios / react-native-otp-input

Tiny Javascript library which provides an elegant UI for user to input one time passcode.
MIT License
521 stars 238 forks source link

Connecting a hardware keyboard on iOS causes loss of focus #186

Open CriusNyx opened 2 years ago

CriusNyx commented 2 years ago

Describe the bug When a hardware keyboard is connected to an iOS device it causes the component to loose focus on selection

To Reproduce Steps to reproduce the behavior:

  1. On an iOS device or iOS simulator connect a hardware keyboard.
  2. Select an OTP input
  3. The component looses focus after a few milliseconds.

Expected behavior Component does not loose focus

Smartphone (please complete the following information):

Additional context I identified the cause of this message and have a proposed fix. The behavior happens because the software keyboard appears for 0 milliseconds, and then gets hidden by the hardware keyboard. This triggers the handleKeyboardDidHide event handler in the index.tsx file If you add a check to ensure that the event duration on that event handler was longer then 0 milliseconds that will fix the issue.

zoobibackups commented 1 year ago

same issue. I have disable hardware keyboard option in the simulator and now its working.