Skip to content

useKeyboard keyboardShown wrong value #400

Description

@Ainias

When a component uses useKeyboard() and this component is mounted while the keyboard is open, useKeyboard().keyboardShown returns false.

The background is we have a sticky button at the bottom on multiple screens. This button should not be displayed when the keyboard is open, since it takes away too much space. In one of those screens we only show the button after an text-input is made. At this point the keyboard is open and the button is shown because of the error above.

Activity

  1. jforaker commented on Aug 1, 2025

    @jforaker

    On Ipad, in split screen, keyboardHeight retains its value when keyboard is dismissed.

    This is easy replicable.

    Steps:

    1. do split screen
    2. open keyboard
    3. close keyboard
    4. see keyboardHeight does not set to 0
    const { keyboardHeight } = useKeyboard();
    console.log('keyboardHeight: ', keyboardHeight);
    
    keyboardHeight:  422
    
  2. huytdps13400 commented on Aug 23, 2026

    @huytdps13400

    Fix PR is open: #430.

    It initializes useKeyboard from Keyboard.isVisible() and Keyboard.metrics() when available, with optional calls so the package remains runtime-compatible with its RN >=0.70 peer range. It also clears keyboardHeight for every hide event, including the coordinate-bearing iPad split-screen case reported above.

    The regression produced three failures before the fix and now passes with the full 45-test suite, typecheck, lint, and formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions