fix: close keyboard even if it's partially visible#1436
Merged
kirillzyusko merged 2 commits intomainfrom Apr 16, 2026
Merged
Conversation
Contributor
📊 Package size report
|
Contributor
|
LGTM |
…is visible and what is not "visible" (if keyboard is shown even partially it means it is "visible", otherwise it's not visible).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Fixed an issue when calling
KeyboardController.dismissduring the keyboard animation (when it appears) doesn't close a keyboard.💡 Motivation and Context
If we use
keyboardDidShowas an indication that keyboard is fully shown, then when keyboard is in progress of the animation callingKeyboardController.dismisswill not close keyboard, becauseisClosedwill betrue, so we'll go into this code:The fix is quite trivial - we need to use
keyboardWillShowinstead ofkeyboardDIdShow. In this case as soon as keyboard starts its animation theisClosedwill befalse:The reasonable question is that such small fix produces a different behavior for
KeyboardController.state()andKeyboardController.isVisible(). Before they would update their values only when animation completes. But now they will update values before keyboard appearance.Technically it still makes sense and the bug above confirms that. We should treat keyboard as shown even if 1% of keyboard is visible on a screen.
I think further we may add additional prop to
statelikeisAnimating/isTransitioning(or maybe even enum to show the differenceOPENING | OPENED | CLOSING | CLOSED) to indicate that animation is in the process. But this is a future improvement. Hopefully it's not a breaking change 🤞Close #1400
📢 Changelog
JS
keyboardDidShowtokeyboardWillShowinmodule.tsfile;🤔 How Has This Been Tested?
Tested manually on iPhone 17 Pro (iOS 26.2).
📸 Screenshots (if appropriate):
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-04-16.at.10.56.31.mov
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-04-16.at.10.55.33.mov
📝 Checklist