Re-emit keyboardDidShow on IME height change#56486
Open
alanleedev wants to merge 1 commit intofacebook:mainfrom
Open
Re-emit keyboardDidShow on IME height change#56486alanleedev wants to merge 1 commit intofacebook:mainfrom
alanleedev wants to merge 1 commit intofacebook:mainfrom
Conversation
Summary: Follow-up to D100437445, which replaced the legacy height-based IME detector in `ReactRootView.CustomGlobalLayoutListener` with a visibility-only detector (`WindowInsetsCompat.Type.ime()`). The legacy code also re-emitted `keyboardDidShow` whenever the IME *height* changed while still visible (e.g., user toggles the emoji panel or predictive bar). Removing that left these JS consumers reading stale `endCoordinates`: - `KeyboardAvoidingView` — caches `_keyboardEvent`, no longer resizes on IME height changes. - `ScrollView` — caches `_keyboardMetrics`; focused `TextInput` auto-scroll uses stale `screenY`/`height`. - `Keyboard.metrics()` — public API returning the cached payload from the last `keyboardDidShow`. Fix: track the last reported IME height and re-emit `keyboardDidShow` when the keyboard is visible AND (it just appeared OR the height changed), restoring pre-D100437445 semantics. The hide branch is gated on `mKeyboardIsVisible` so it still fires exactly once per cycle. Changelog: [Android][Fixed] KeyboardAvoidingView and TextInput auto-scroll not responding to IME height changes (e.g., when toggling emoji panel or predictive bar) Differential Revision: D101385688
|
@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101385688. |
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.
Summary:
Follow-up to D100437445, which replaced the legacy height-based IME detector in
ReactRootView.CustomGlobalLayoutListenerwith a visibility-only detector (WindowInsetsCompat.Type.ime()).The legacy code also re-emitted
keyboardDidShowwhenever the IME height changed while still visible (e.g., user toggles the emoji panel or predictive bar). Removing that left these JS consumers reading staleendCoordinates:KeyboardAvoidingView— caches_keyboardEvent, no longer resizes on IME height changes.ScrollView— caches_keyboardMetrics; focusedTextInputauto-scroll uses stalescreenY/height.Keyboard.metrics()— public API returning the cached payload from the lastkeyboardDidShow.Fix: track the last reported IME height and re-emit
keyboardDidShowwhen the keyboard is visible AND (it just appeared OR the height changed), restoring pre-D100437445 semantics. The hide branch is gated onmKeyboardIsVisibleso it still fires exactly once per cycle.Changelog: [Android][Fixed] KeyboardAvoidingView and TextInput auto-scroll not responding to IME height changes (e.g., when toggling emoji panel or predictive bar)
Differential Revision: D101385688