Skip to content

isKeyboardVisible ​

isKeyboardVisible is a utility function that checks whether the on-screen keyboard is currently visible.

This function uses getKeyboardHeight() internally and returns true if the keyboard height is greater than 0.

Interface ​

ts
function isKeyboardVisible(): boolean;

Parameters ​

This function does not accept any parameters.

Return Value ​

  • boolean

    true if the keyboard is visible, false otherwise.

Example ​

tsx
if (isKeyboardVisible()) {
  console.log('Keyboard is open');
} else {
  console.log('Keyboard is closed');
}
tsx
// Conditionally show/hide elements based on keyboard visibility
const showFloatingButton = !isKeyboardVisible();

Released under the MIT License.