Skip to content

iOS: reload input views when keyboardType/returnKeyType change on a focused TextInput (Fabric) - #57868

Open
NoahDorfman00 wants to merge 1 commit into
react:mainfrom
NoahDorfman00:fabric-textinput-reload-input-views
Open

iOS: reload input views when keyboardType/returnKeyType change on a focused TextInput (Fabric)#57868
NoahDorfman00 wants to merge 1 commit into
react:mainfrom
NoahDorfman00:fabric-textinput-reload-input-views

Conversation

@NoahDorfman00

Copy link
Copy Markdown

Summary

On the new architecture, changing keyboardType (or returnKeyType) on a currently focused TextInput has no visible effect: the trait is set on the backing view, but the keyboard does not update until the field loses and regains focus.

The legacy architecture handles this correctly — RCTBaseTextInputView.mm's setKeyboardType: calls reloadInputViews when the field is first responder, with a comment explaining why:

// Without the call to reloadInputViews, the keyboard will not change until the textview field (the first responder)
// loses and regains focus.

That call was not carried over to Fabric's RCTTextInputComponentView.mm, where updateProps: only assigns _backedTextInputView.keyboardType. This PR restores parity by calling reloadInputViews when the field is first responder, for both keyboardType and returnKeyType.

With this fix, apps that switch a focused input between keyboard types (e.g. a chat-style composer that toggles between text and numeric entry) get the same in-place, single-frame keyboard layout swap as the legacy architecture and native UIKit trait updates — instead of having to work around it by remounting the input or swapping focus between duplicate inputs, both of which tear the keyboard down and re-present it.

Changelog:

[IOS] [FIXED] - TextInput: update the keyboard when keyboardType/returnKeyType change while the input is focused (new architecture parity with the legacy architecture)

Test Plan

In a new-architecture app (RN 0.80, iOS 26 simulator), render a focused <TextInput> whose keyboardType prop toggles between default and numbers-and-punctuation:

  • Before: the keyboard does not change until focus is lost and regained (or, if the input is remounted as a workaround, the keyboard fully dismisses and re-presents).
  • After: the keyboard layout swaps in place in a single frame while the field stays focused, verified by frame-by-frame inspection of a simulator screen recording; behavior matches the same transition performed in Safari (which updates input traits on a single responder) and matches the legacy architecture.

returnKeyType changes on a focused field likewise update the return key immediately.

…a focused TextInput

The legacy architecture reloads the focused field's input views when its
keyboardType changes (RCTBaseTextInputView), so the keyboard updates
immediately. The Fabric component sets the trait but never reloads, so
the keyboard does not change until the field loses and regains focus.
Restore parity by calling reloadInputViews when the field is first
responder, for both keyboardType and returnKeyType.
@meta-cla

meta-cla Bot commented Aug 8, 2026

Copy link
Copy Markdown

Hi @NoahDorfman00!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Aug 8, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Aug 8, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 8, 2026
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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant