Skip to content

Defer transformed TextInput edits outside UIKit delegate callbacks (#59188) - #59188

Open
javache wants to merge 1 commit into
react:mainfrom
javache:export-D126057002
Open

javache wants to merge 1 commit into
react:mainfrom
javache:export-D126057002

Conversation

@javache

@javache javache commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

UIKit text change delegate callbacks now remain decision-only when JavaScript transforms an edit. The adapter rejects UIKit's original edit, records an implementation-private transaction, and applies an incremental UITextInput replacement on the next main-queue turn after validating the backing-view generation and base text.

This preserves partial maxLength truncation without synchronously replacing the full attributed string or selection. Marked-text composition remains UIKit-owned; an over-limit committed value is corrected through the same deferred transaction path after composition ends. A runtime gate controls the new path.

Stale edits are discarded when the backing text changes, lifecycle and JavaScript-driven updates invalidate queued transactions, and successful commits emit one change update plus the corresponding selection event.

Changelog:
[iOS][Fixed] - Preserve transformed TextInput edits without synchronously rewriting text inside UIKit delegate callbacks

Reviewed By: cipolleschi

Differential Revision: D126057002

@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 19, 2026
@meta-codesync

meta-codesync Bot commented Oct 19, 2026

Copy link
Copy Markdown

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

…eact#59188)

Summary:
Pull Request resolved: react#59188

UIKit text change delegate callbacks now remain decision-only when JavaScript transforms an edit. The adapter rejects UIKit's original edit, records an implementation-private transaction, and applies an incremental `UITextInput` replacement on the next main-queue turn after validating the backing-view generation and base text.

This preserves partial `maxLength` truncation without synchronously replacing the full attributed string or selection. Marked-text composition remains UIKit-owned; an over-limit committed value is corrected through the same deferred transaction path after composition ends. A runtime gate controls the new path.

Stale edits are discarded when the backing text changes, lifecycle and JavaScript-driven updates invalidate queued transactions, and successful commits emit one change update plus the corresponding selection event.

Changelog:
[iOS][Fixed] - Preserve transformed `TextInput` edits without synchronously rewriting text inside UIKit delegate callbacks

Reviewed By: cipolleschi

Differential Revision: D126057002
@meta-codesync meta-codesync Bot changed the title Defer transformed TextInput edits outside UIKit delegate callbacks Defer transformed TextInput edits outside UIKit delegate callbacks (#59188) Oct 19, 2026

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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant