document-picker icon indicating copy to clipboard operation
document-picker copied to clipboard

Support react-native-macos

Open shahthepro opened this issue 5 years ago • 7 comments

Feature request

Add support for react-native-macos npm package and macOS target.

shahthepro avatar Nov 15 '20 09:11 shahthepro

hello, I do not plan to do this but am open to be hired to do this or review a PR that implements this. 🙂

thank you!

vonovak avatar Oct 02 '21 19:10 vonovak

@shahthepro It seems like you have to use Mac Catalyst since UIDocumentPickerViewController doesn't support macOS natively. https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller?language=objc

jihoobyeon avatar Apr 22 '22 01:04 jihoobyeon

AppKit has a different API instead of UIDocumentPickerViewController for dealing with save and open dialogs. https://github.com/hsjoberg/blixt-wallet/blob/431ff0d60a423c44d77ba48be46da026b92b6bd0/ios/LndMobile/LndMobileTools.swift#L227-L252

hsjoberg avatar Apr 22 '22 20:04 hsjoberg

Here's a simple example in Swift on how to open a file

DispatchQueue.main.async {
  do {
    let panel = NSOpenPanel()
    panel.allowsMultipleSelection = false
    panel.canChooseDirectories = false
    if panel.runModal() == .OK {
      if let u = panel.url {
       let base64 = try Data(contentsOf: u).base64EncodedString())
      } else {
        // error
      }
    } else {
      // ...
    }
  }
  catch {
   // exception
 }
}

hsjoberg avatar Apr 22 '22 20:04 hsjoberg

It seems to be hard because AppKit has NSOpenPanel and NSSavePanel separately.
maybe we have to make separate package to support macOS.

jihoobyeon avatar Sep 24 '22 07:09 jihoobyeon