Repository navigation
Conversation
…with keyboardDidShow
📊 Package size report
|
|
LGTM |
|
Thanks for this fix. I ran the pinned repro with and without it on two emulators: 10 portrait → landscape → portrait round trips per device and build, each from a fresh launch with the field focused, landscape held for 1 to 3 s. Release build;
Stale means that about 5 s after the round trip the screen showed On the Pixel 9 Pro, 9 runs in each set ended with Load: the host (macOS 27.0.1, Apple silicon) was also running other work. Each run waited until the 1-minute load average was under 10. It was 5.1 to 9.9 when runs started and at most 12.2 when they ended. The stale state also affects
Emulator image on both devices: Google Play, arm64-v8a, API 36.1, build |
…extra render Mirror kirillzyusko/react-native-keyboard-controller#1698: add a separate keyboardDidShow listener instead of rewriting the keyboardWillShow one, so the patch hunk can be dropped when that PR ships. Split the terminal's object selector into primitives so the added didShow update bails out instead of re-rendering the terminal screen on every keyboard show. Co-Authored-By: Claude Opus 5.5 <[email protected]>
📜 Description
Open the keyboard on an Android phone, rotate it, and the library loses track of the keyboard: it's still on screen, but
useKeyboardStateandKeyboardControllerinsist it's closed. With this PR the keyboard state also updates onkeyboardDidShow, so it stays in sync no matter how the keyboard got there.Reproduction: https://github.com/Nezz/expo-repro/tree/e299109d8b565d6d2dc6f71fdb5041429ac0bdbd (Expo SDK 57.0.24, React Native 0.86.3 with the New Architecture, react-native-keyboard-controller 1.22.8, Android).
useKeyboardState: isVisible true, height 336.Expected: the keyboard is reported open, height is matches the virtual keyboard's height.
Actual: keyboard is reported closed, height is reported 0
💡 Motivation and Context
When an Android phone rotates, the keyboard doesn't animate to its new position — it jumps. In that case the library skips the usual event sequence and quietly re-syncs the keyboard position, emitting only
keyboardDidHideandkeyboardDidShow, neverkeyboardWillShow:📢 Changelog
JS
useKeyboardState,KeyboardController.isVisible()andKeyboardController.state()now update onkeyboardDidShowtoo📸 Screenshots (if appropriate):
Before: the keyboard is open, but
useKeyboardStateshowsisVisible false, height 0which is incorrect📝 Checklist