diff --git a/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm b/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm index d0146ab6e64..eef87f87f63 100644 --- a/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +++ b/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm @@ -348,6 +348,15 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender return [super canPerformAction:action withSender:sender]; } +// UIKit queries this when the keyboard becomes active, including when the app returns to the +// foreground. The default implementation calls `canPerformAction:` with `paste:`, which +// synchronously queries the system pasteboard on the main thread and can hang the app. TextInput +// only accepts text, so opt out of image paste; text paste is unaffected. +- (BOOL)supportsImagePaste +{ + return NO; +} + - (void)buildMenuWithBuilder:(id)builder { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 && !TARGET_OS_TV diff --git a/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm b/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm index f747d08ff51..8f07036e875 100644 --- a/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +++ b/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm @@ -196,6 +196,15 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender return [super canPerformAction:action withSender:sender]; } +// UIKit queries this when the keyboard becomes active, including when the app returns to the +// foreground. The default implementation calls `canPerformAction:` with `paste:`, which +// synchronously queries the system pasteboard on the main thread and can hang the app. TextInput +// only accepts text, so opt out of image paste; text paste is unaffected. +- (BOOL)supportsImagePaste +{ + return NO; +} + - (void)buildMenuWithBuilder:(id)builder { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000