Skip to content

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

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

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

Conversation

@javache

@javache javache commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

UIKit text change delegate callbacks now remain decision-only when JavaScript transforms an edit. The adapter rejects the original UIKit 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. On tvOS, the deferred drain remains disabled because multiline text views are not editable.

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

Differential Revision: D126438495

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

meta-codesync Bot commented Oct 20, 2026

Copy link
Copy Markdown

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

…eact#59239)

Summary:
Pull Request resolved: react#59239

UIKit text change delegate callbacks now remain decision-only when JavaScript transforms an edit. The adapter rejects the original UIKit 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. On tvOS, the deferred drain remains disabled because multiline text views are not editable.

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

Differential Revision: D126438495
@meta-codesync meta-codesync Bot changed the title Defer transformed TextInput edits outside UIKit delegate callbacks (#59188) Defer transformed TextInput edits outside UIKit delegate callbacks (#59239) Oct 20, 2026
@meta-codesync meta-codesync Bot closed this in 6f67e18 Oct 21, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 21, 2026
@meta-codesync

meta-codesync Bot commented Oct 21, 2026

Copy link
Copy Markdown

This pull request has been merged in 6f67e18.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @javache in 6f67e18

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

@javache
javache deleted the export-D126438495 branch October 21, 2026 12:19
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. 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