Repository navigation
Commit f372eb4
Defer transformed TextInput edits outside UIKit delegate callbacks (#59188)
Summary:
Pull Request resolved: #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: D1260570021 parent dd9b6c5 commit f372eb4
26 files changed
Lines changed: 835 additions & 121 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