Skip to content

fix(android): keep composer synchronized with IME - #201

Open
duoyi88 wants to merge 2 commits into
dzianisv:mainfrom
duoyi88:fix/android-keyboard-header-offset
Open

fix(android): keep composer synchronized with IME#201
duoyi88 wants to merge 2 commits into
dzianisv:mainfrom
duoyi88:fix/android-keyboard-header-offset

Conversation

@duoyi88

@duoyi88 duoyi88 commented Aug 28, 2026

Copy link
Copy Markdown

Closes #194

Root cause

On edge-to-edge Android, adjustResize no longer moves the composer above the IME. The KeyboardAvoidingView change proposed in #182 improves the layout, but a physical Pixel 11 Pro test still left the input partially covered.

A larger keyboardVerticalOffset can correct the open position, but React Native 0.81.5 handles Android keyboardDidHide as another frame-change event. With a non-zero offset, that leaves stale bottom padding after the IME closes, so the composer does not return to the bottom.

Change

  • Preserve the existing iOS KeyboardAvoidingView padding behavior and 90 dp offset.
  • On Android, initialize from Keyboard.metrics(), subscribe to keyboardDidShow / keyboardDidHide, and apply the IME-reported height directly as bottom padding.
  • Reset Android padding explicitly to zero on hide.
  • Subscribe before resynchronizing native metrics so an IME transition during route mount cannot be lost.
  • Add regression coverage for show, hide, invalid metrics, iOS isolation, and the measured Pixel geometry.

Physical-device verification

Pixel 11 Pro, Android 17:

Verification

  • npm test — 339 passed
  • npm run typecheck
  • Keyboard offset tests — 6 passed
  • Android arm64 release APK build
  • Physical Pixel 11 Pro open/close cycle

The change is limited to the session keyboard integration and its small pure helper/tests.

@duoyi88 duoyi88 changed the title fix(android): account for native header in keyboard avoidance fix(android): keep composer synchronized with IME Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: chat input hidden behind keyboard

1 participant