Skip to content

computeKeyboardRevealOffset — @gj-kit/expo-ui

A public function from @gj-kit/expo-ui/insets/pure. The signature below is taken directly from the 0.8.1 release declaration.

import { computeKeyboardRevealOffset } from '@gj-kit/expo-ui/insets/pure';
/**
* Calculates the forward-only scroll offset that keeps a focused input above a
* keyboard and any fixed bottom bar. Returns null when no reveal is needed.
*/
declare function computeKeyboardRevealOffset({ currentOffset, inputHeight, inputTop, keyboardInset, reservedBottomHeight, viewportHeight, margin, }: {
/** The current scroll offset (contentOffset.y). */
currentOffset: number;
/** The height of the focused input. */
inputHeight: number;
/** The top (y) of the focused input inside the scroll content. */
inputTop: number;
/** The keyboard overlap covering the bottom of the viewport. */
keyboardInset: number;
/** The measured height of a fixed bottom bar lifted above the keyboard, or 0 when there is none. */
reservedBottomHeight: number;
/** The scroll viewport height with no keyboard present. */
viewportHeight: number;
/** The gap between the input's bottom edge and the keyboard. Defaults to 16. */
margin?: number | undefined;
}): number | null;

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/expo-ui
  • Version: 0.8.1
  • Public entry: ./insets/pure
  • Source: GitHub