Skip to content

Commit ddb1bc2

Browse files
committed
use UTTypes
1 parent f82bf52 commit ddb1bc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#import <QuartzCore/QuartzCore.h>
1212
#import <objc/runtime.h>
1313
#import <ranges>
14+
#if TARGET_OS_OSX // [macOS
15+
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
16+
#endif // macOS]
1417

1518
#import <React/RCTAssert.h>
1619
#import <React/RCTBorderDrawing.h>
@@ -1751,7 +1754,7 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
17511754

17521755
NSPasteboardType imageType = [pasteboard availableTypeFromArray:@[NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
17531756
if (imageType && fileNames.count == 0) {
1754-
NSString *MIMETypeString = imageType == NSPasteboardTypePNG ? @"image/png" : @"image/tiff";
1757+
NSString *MIMETypeString = imageType == NSPasteboardTypePNG ?[UTTypePNG preferredMIMEType] : [UTTypeTIFF preferredMIMEType];
17551758
NSData *imageData = [pasteboard dataForType:imageType];
17561759
NSImage *image = [[NSImage alloc] initWithData:imageData];
17571760
CGImageRef cgImage = [image CGImageForProposedRect:nil context:nil hints:nil];

0 commit comments

Comments
 (0)