useSafeKeyboardArea()function

useSafeKeyboardArea(): void
Return
unknown
A cleanup function that removes the listeners and property, or undefined when visualViewport is unavailable.

Track the dynamic viewport height so layout safe-area insets follow the on-screen keyboard.

  • Writes a --layout-inset-bottom custom property reflecting the space hidden behind the keyboard.

@todo This can be removed once Safari iOS supports interactive-widget viewport property. caniuse.com/mdn-html_elements_meta_name_viewport_interactive-widget

Examples

useEffect(useSafeKeyboardArea, []);