Repository navigation
Commit 850496b
Skip image-paste pasteboard probe in TextInput to avoid main-thread hangs
Summary:
WARNING: Generated by Autopilot (alpha) — review carefully, verify the underlying claim before accepting.
Agent: [React Native Agent (Bugs)](https://www.internalfb.com/autopilot/marketplace?agent=1645742253726459) | Trajectory: https://www.internalfb.com/intern/devai/devmate/inspector/dea80a9f-a635-4ecc-874d-33f0741108ca/ | SC job: https://www.internalfb.com/intern/sandcastle/instance/9007202303535554/
---
When the app returns to the foreground with a TextInput focused, UIKit refreshes the keyboard's paste support. To decide whether the field supports image paste, UIKit calls `-[RCTUITextView canPerformAction:withSender:]` with `paste:`. `super` then synchronously queries the system pasteboard over XPC on the main thread. If the pasteboard service is slow to reply, the main thread blocks long enough for the system to terminate the app.
This diff overrides `supportsImagePaste` to return `NO` in `RCTUITextView` and `RCTUITextField`, so UIKit skips that pasteboard query. TextInput only accepts text, so no image paste capability is lost. `canPerformAction:` and `paste:` are unchanged, so the edit menu and text paste work as before.
Changelog:
[iOS][Fixed] - Avoid a synchronous main-thread pasteboard query (and possible app hang) when a focused TextInput's keyboard becomes active on app foreground
Reviewed By: cortinico
Differential Revision: D1259224461 parent ba0b3db commit 850496b
2 files changed
Lines changed: 18 additions & 0 deletions
File tree
- packages/react-native/Libraries/Text/TextInput
- Multiline
- Singleline
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
351 | 360 | | |
352 | 361 | | |
353 | 362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
199 | 208 | | |
200 | 209 | | |
201 | 210 | | |
| |||
0 commit comments