Repository navigation
Commit a8cf4e7
Defer transformed TextInput edits outside UIKit delegate callbacks (#59239)
Summary:
Pull Request resolved: #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: D1264384951 parent 0bd3326 commit a8cf4e7
26 files changed
Lines changed: 841 additions & 119 deletions
File tree
- packages/react-native
- Libraries/Text
- TextInput
- Multiline
- Singleline
- ReactAndroid/src/main
- java/com/facebook/react/internal/featureflags
- jni/react/featureflags
- ReactCommon/react
- featureflags
- nativemodule/featureflags
- React
- Fabric/Mounting/ComponentViews/TextInput
- Tests/Text
- scripts/featureflags
- src/private/featureflags
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
207 | 212 | | |
208 | 213 | | |
209 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
210 | 225 | | |
211 | 226 | | |
212 | 227 | | |
| |||
0 commit comments