react-nativekeyboardone-time-password

React-native hide numeric keyboard on API respond


I have a react native compnent that shows a popup message at the bottom of my mobile screen with data from my API http request. Trying to hide the numeric keyboard to be able to see the popup that is behind the keyboard. Calling keyboard.dismiss() when the API response comes does nothing.

Expecting keyboard to be dismissed while using import { Keyboard } from 'react-native' and calling the keyboard.dismiss() from the API response.


Solution

  • You are calling keyboard.dismiss() from an async () method, that's why the keyboard is not hiding. You will have to call keyboard.dismiss() from the main thread.