diff --git a/node_modules/react-native-share-menu/ios/ReactShareViewController.swift b/node_modules/react-native-share-menu/ios/ReactShareViewController.swift index f42bce6..ee36062 100644 --- a/node_modules/react-native-share-menu/ios/ReactShareViewController.swift +++ b/node_modules/react-native-share-menu/ios/ReactShareViewController.swift @@ -13,7 +13,7 @@ class ReactShareViewController: ShareViewController, RCTBridgeDelegate, ReactSha func sourceURL(for bridge: RCTBridge!) -> URL! { #if DEBUG return RCTBundleURLProvider.sharedSettings()? - .jsBundleURL(forBundleRoot: "index.share", fallbackResource: nil) + .jsBundleURL(forBundleRoot: "index.share") #else return Bundle.main.url(forResource: "main", withExtension: "jsbundle") #endif diff --git a/node_modules/react-native-share-menu/ios/ShareViewController.swift b/node_modules/react-native-share-menu/ios/ShareViewController.swift index 12d8c92..64aa72b 100644 --- a/node_modules/react-native-share-menu/ios/ShareViewController.swift +++ b/node_modules/react-native-share-menu/ios/ShareViewController.swift @@ -19,8 +19,8 @@ class ShareViewController: SLComposeServiceViewController { var hostAppUrlScheme: String? var sharedItems: [Any] = [] - override func viewDidLoad() { - super.viewDidLoad() + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) if let hostAppId = Bundle.main.object(forInfoDictionaryKey: HOST_APP_IDENTIFIER_INFO_PLIST_KEY) as? String { self.hostAppId = hostAppId @@ -33,6 +33,13 @@ class ShareViewController: SLComposeServiceViewController { } else { print("Error: \(NO_INFO_PLIST_URL_SCHEME_ERROR)") } + + guard let items = extensionContext?.inputItems as? [NSExtensionItem] else { + cancelRequest() + return + } + + handlePost(items) } override func isContentValid() -> Bool { @@ -40,16 +47,6 @@ class ShareViewController: SLComposeServiceViewController { return true } - override func didSelectPost() { - // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. - guard let items = extensionContext?.inputItems as? [NSExtensionItem] else { - cancelRequest() - return - } - - handlePost(items) - } - override func configurationItems() -> [Any]! { // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. return [] @@ -238,11 +235,10 @@ class ShareViewController: SLComposeServiceViewController { func completeRequest() { // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context. - extensionContext!.completeRequest(returningItems: [], completionHandler: nil) + extensionContext!.completeRequest(returningItems: nil, completionHandler: nil) } func cancelRequest() { extensionContext!.cancelRequest(withError: NSError()) } - }