Skip to content

Fix(iOS) TextInput onContentSizeChange not firing on text change on iOS - #59447

Open
amerllica wants to merge 4 commits into
react:mainfrom
amerllica:fix/ios-textinput-oncontentsizechange
Open

amerllica wants to merge 4 commits into
react:mainfrom
amerllica:fix/ios-textinput-oncontentsizechange

Conversation

@amerllica

Copy link
Copy Markdown

Summary:

This PR resolves #52854

On the new arch, onContentSizeChange was sent only from updateLayoutMetrics, so when the layout doesn't change (fixed height, or maxHeight is reached) it never fires after mount. Now it is sent after text changes too (typing and JS value updates), with a layoutIfNeeded before reading contentSize because it is stale inside the change callback. Same behaviour as the old arch. Also _previousContentSize is reset on recycle.

Changelog:

[IOS] [FIXED] - Fix TextInput onContentSizeChange not firing on text change when the layout doesn't change

Test Plan:

RNTester > TextInput > "Content size change with fixed height" (new example), iPhone 17 simulator, iOS 27:

  • Before: type 3 lines, content size stays 16.
  • After: 3 lines gives 55, delete all goes back to 24.

@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 Oct 24, 2026
@amerllica amerllica changed the title Fix TextInput onContentSizeChange not firing on text change on iOS Fix(iOS) TextInput onContentSizeChange not firing on text change on iOS Oct 24, 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 Oct 24, 2026
@amerllica

amerllica commented Nov 23, 2026 •

Copy link
Copy Markdown
Author

Hi, I merged the latest main into this branch and fixed the conflict in TextInputSharedExamples.js. Actually, the new "Auto-expanding (uncontrolled)" example landed on the same place as mine, so I kept both of them. The iOS change is untouched.

This is my first PR here, so the CI workflows wait for a maintainer to approve them. The previous runs waited 30 days and then expired as failed, nobody had approved them. Could someone from the team please approve the workflow runs? If anything needs to be changed, just let me know and I'll definitely fix it.

Thanks

cc @javache @cipolleschi, sorry for the ping, I saw you reviewed some TextInput changes before. Whenever you have time, I would be grateful if you take a look.

This branch has not been deployed

No deployments
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.

(RN 79.5) TextInput onContentSizeChange is not triggered on iOS

1 participant