Skip to content

fix(ios): fix broken transitions with autoFocus=true by moving to viewDidAppear#56620

Open
hannojg wants to merge 10 commits intofacebook:mainfrom
hannojg:hannojg/experimental-textinput-focus-in-viewdidappear
Open

fix(ios): fix broken transitions with autoFocus=true by moving to viewDidAppear#56620
hannojg wants to merge 10 commits intofacebook:mainfrom
hannojg:hannojg/experimental-textinput-focus-in-viewdidappear

Conversation

@hannojg
Copy link
Copy Markdown
Contributor

@hannojg hannojg commented Apr 27, 2026

Summary:

Fixes:

When feature flag enableIOSExperimentalAutoFocusImplementation is enabled on iOS we will not request focus to the input (calling becomeFirstResponder) in didMoveToWindow but in viewDidAppear of the parent's view controller.

This will make the keyboard appear after any UIKit transitions are done, however, it will fix any glitches with the transition.
This is especially relevant for third party navigation libraries, such as react-native-screens:

Changelog:

[IOS] [FIXED] - Fixed #56595 app lags/stutters while navigating to a new screen with auto focused text input

Test Plan:

Try switching the autoFocus prop in the RN tester app. See those recordings

With the feature flag enabled

Note: In the PR that adds the viewDidAppear listener pattern we call any listener immediately on registration if the VC already appeared. Due to that, although the input is already on the screen, the autoFocus still works as with the feature flag disabled.

w_featureflag_compressed.mp4

Without feature flag

wo_featureflag_compressed.mp4

@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 27, 2026
@github-actions
Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@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 Apr 27, 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.

[iOS] TextInput autoFocus called in didMoveToWindow causing transition glitches with UIKit

1 participant