fix(ios): stop reading the pasteboard in text input canPerformAction - #132
Merged
Merged
Conversation
iOS 27 validates UICommands from UIIntelligenceSupport without any user action, which calls canPerformAction: on the focused RCTUITextField. The OneKeyPaste swizzle read UIPasteboard.generalPasteboard.hasImages there, a synchronous XPC call to pasteboardd, and a slow reply blocked the main thread until the watchdog killed the app (Sentry REACT-NATIVE-4Y1, "Fatal App Hang Fully Blocked", iOS 27.0). canPerformAction: now reads a cached flag. A background serial queue refreshes it on UIPasteboardChangedNotification, app activation and text input begin-editing, coalescing concurrent refresh requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
originalix
reviewed
Sep 24, 2026
weatherstar
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an iOS 27 main-thread hang in
@onekeyfe/react-native-text-inputthat the watchdog turns into a kill (SentryREACT-NATIVE-4Y1, "Fatal App Hang Fully Blocked", iPhone17,1 / iOS 27.0 24A437, app 6.6.0 build 2026091844).Same change as #131 (which targets
hotfix/3.0.154for app-monoreporelease/v6.6.0), applied tomainso the next regular release carries it.Root cause
The
RCTUITextField(OneKeyPaste)/RCTUITextView(OneKeyPaste)swizzle ofcanPerformAction:withSender:readUIPasteboard.generalPasteboard.hasImages, which is a synchronous XPC call to pasteboardd. On iOS 27,UIIntelligenceSupportvalidatesUICommands from a run-loop block with no user action, so this runs on the main thread in the background:Fix
onekey_canPerformAction:reads a cachedstd::atomic<bool>instead of touchingUIPasteboard.UIPasteboardChangedNotification,UIApplicationDidBecomeActiveNotification, and text field / text view begin-editing. Refresh requests that arrive while one is queued are merged into it.onekey_paste:) is unchanged; it still reads the pasteboard only when the user actually pastes.Tradeoff: right after returning from another app with a copied image, the Paste menu item may miss the image for the moment the async refresh takes. Text paste is unaffected (it falls through to UIKit).
Test plan
clang++ -fsyntax-onlyagainst the iOS 27.0 SDK and the app's React headers: no errors or warnings🤖 Generated with Claude Code