Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drag and drop of files in multiline textfield when a custom draggedType property is used #1452

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

christophpurrer
Copy link

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

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 when a pastedTypes property is set.

Changelog

[macOS][Fixed] - Fix drag and drop of files in multiline textfield when a custom draggedType property is used

Test Plan

Before

1.mov

After

2.mov

…edType property is used

In microsoft#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.
@christophpurrer christophpurrer requested a review from a team as a code owner October 13, 2022 19:50
@Saadnajmi
Copy link
Collaborator

So if I understand correctly, this is a return to the deprecated API? Is there a "proper" way to use NSPasteboardTypeFileURL is pastedTypes is set?

@christophpurrer
Copy link
Author

It is a deprecated property. Xcode emits this warning
react-native-macos/Libraries/Text/TextInput/RCTBaseTextInputView.m:684:68: warning build: 'NSFilenamesPboardType' is deprecated: first deprecated in macOS 10.14 - Create multiple pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead

Well the suggestion of simply using NSPasteboardTypeFileURL does not lead to the same behavior.

It seems some Swift users even try to bring back the property > https://stackoverflow.com/questions/44537356/swift-4-nsfilenamespboardtype-not-available-what-to-use-instead-for-registerfo

@Saadnajmi Saadnajmi merged commit f76be1d into microsoft:main Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants