Skip to content

Commit f76be1d

Browse files
Fix drag and drop of files in multiline textfield when a custom draggedType property is used (#1452)
In #1429 I had naively assumed that `NSPasteboardTypeFileURL` is 1:1 replacement for the deprecated `NSFilenamesPboardType` property. It is not. It causes drag and drop of files from Finder to stop working.
1 parent 3bc4d42 commit f76be1d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Libraries/Text/TextInput/RCTBaseTextInputView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ - (BOOL)textInputShouldHandleKeyEvent:(NSEvent *)event {
681681
- (BOOL)textInputShouldHandlePaste:(__unused id)sender
682682
{
683683
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
684-
NSPasteboardType fileType = [pasteboard availableTypeFromArray:@[NSPasteboardTypeFileURL, NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
684+
NSPasteboardType fileType = [pasteboard availableTypeFromArray:@[NSFilenamesPboardType, NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
685685
NSArray<NSPasteboardType>* pastedTypes = ((RCTUITextView*) self.backedTextInputView).readablePasteboardTypes;
686686

687687
// If there's a fileType that is of interest, notify JS. Also blocks notifying JS if it's a text paste

React/Base/RCTConvert.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ + (NSArray *)CGColorArray:(id)json
12331233
}
12341234

12351235
if ([type isEqualToString:@"fileUrl"]) {
1236-
return @[NSPasteboardTypeFileURL];
1236+
return @[NSFilenamesPboardType];
12371237
} else if ([type isEqualToString:@"image"]) {
12381238
return @[NSPasteboardTypePNG, NSPasteboardTypeTIFF];
12391239
} else if ([type isEqualToString:@"string"]) {

0 commit comments

Comments
 (0)