Skip to content

Re-emit keyboardDidShow on IME height change (#56486)#56486

Closed
alanleedev wants to merge 1 commit intofacebook:mainfrom
alanleedev:export-D101385688
Closed

Re-emit keyboardDidShow on IME height change (#56486)#56486
alanleedev wants to merge 1 commit intofacebook:mainfrom
alanleedev:export-D101385688

Conversation

@alanleedev
Copy link
Copy Markdown
Contributor

@alanleedev alanleedev commented Apr 17, 2026

Summary:

Follow-up to #55855 (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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 17, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 17, 2026

@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101385688.

@meta-codesync meta-codesync Bot changed the title Re-emit keyboardDidShow on IME height change Re-emit keyboardDidShow on IME height change (#56486) Apr 23, 2026
alanleedev added a commit to alanleedev/react-native that referenced this pull request Apr 23, 2026
Summary:

Follow-up to facebook#55855 (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
Summary:

Follow-up to facebook#55855 (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
@meta-codesync meta-codesync Bot closed this in ee1d067 Apr 24, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 24, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 24, 2026

This pull request has been merged in ee1d067.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @alanleedev in ee1d067

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants