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
trueif the keyboard is visible,falseotherwise.
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();