Open singh-sukhmanjit opened 6 months ago
Yeah, the project does not currently support the new architecture. If you'd like to follow along, we're tracking support for this in #293.
Hi @lindboe , what is the latest react-native version compatible with the react-native-share-menu@6.0.0? is it react-native@0.63.2 as shown in the example? thanks
@mhsfh if you're not using the new architecture, which is not required by recent react native, you can use the latest version of react native with a few patches to this library (using patch-package). Check out the list in Phase 0 for the PRs that fix those issues, you can copy their fix as a patch for now: https://github.com/Expensify/react-native-share-menu/issues/294
@lindboe I made it work, thank you so much 🙏
@lindboe I made it work, thank you so much 🙏
Can you describe the path you fallowed?
@lindboe I made it work, thank you so much 🙏
Can you describe the path you fallowed?
for android I had to apply this patch:
diff --git a/android/build.gradle b/android/build.gradle
index 9557fdbf2fbf97b7f7aeaf7ce86d301a8ced213d..8adad42908c0d73c535c30f01c5437e2a7d9f33f 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 29
+ compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion "29.0.2"
defaultConfig {
are you facing ios errors?
@lindboe I made it work, thank you so much 🙏
Can you describe the path you fallowed?
for android I had to apply this patch:
diff --git a/android/build.gradle b/android/build.gradle index 9557fdbf2fbf97b7f7aeaf7ce86d301a8ced213d..8adad42908c0d73c535c30f01c5437e2a7d9f33f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 29 + compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion "29.0.2" defaultConfig {
are you facing ios errors?
Yeah, I've been trying to get this package to work on iOS for several days. I've experimented with different React Native versions, various projects, and different paths, but unfortunately, I haven't had any luck with it.
@EKOzkan am using react-native-share-menu 6.0.0 with react-native 0.72.6. what issue are you facing?
@EKOzkan am using react-native-share-menu 6.0.0 with react-native 0.72.6. what issue are you facing?
Hello @singh-sukhmanjit here to me I'm facing with "'RNShareMenu-Swift.h' file not found" message when I try build iOS.
React-Native 0.72 Xcode 15.3 Apple M3
It's happen in file "node_modules/react-native-share-menu/ios/ShareMenuManager.m" line 9: #import "RNShareMenu-Swift.h"
Where is this file?
I can't get it to build with the custom view config either.
RN 0.73.6
Found Pull Request #260 witch fixes this issue:
Found Pull Request #260 witch fixes this issue:
So it works for you with the new arch enabled?
Has someone made it work with Expo? I am using Expo Dev Client.
I'm running the App on iOS 17.4 with React native v0.73.6. Share Menu is working fine on my app. Here's the all patches that I have applied in case any one find it helpful -
Patch 1
diff --git a/node_modules/react-native-share-menu/ios/Constants.swift b/node_modules/react-native-share-menu/ios/Constants.swift
index 08385b7..87b0d11 100644
--- a/node_modules/react-native-share-menu/ios/Constants.swift
+++ b/node_modules/react-native-share-menu/ios/Constants.swift
@@ -42,6 +42,7 @@ public let COLOR_TRANSPARENT_KEY = "Transparent"
public let MIME_TYPE_KEY = "mimeType"
public let DATA_KEY = "data"
+public let CONVERSATION_IDENTIFIER_KEY = "conversationIdentifier"
public let EXTRA_DATA_KEY = "extraData"
// MARK: Events
diff --git a/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift b/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift
index e290cce..24cd59b 100644
--- a/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift
+++ b/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift
@@ -7,6 +7,7 @@
import Foundation
import MobileCoreServices
+import Intents
@objc(ShareMenuReactView)
public class ShareMenuReactView: NSObject {
@@ -45,6 +46,7 @@ public class ShareMenuReactView: NSObject {
}
extensionContext.completeRequest(returningItems: [], completionHandler: nil)
+ ShareMenuReactView.detachViewDelegate()
}
@objc
@@ -89,7 +91,20 @@ public class ShareMenuReactView: NSObject {
return
}
diff --git a/node_modules/react-native-share-menu/ios/ReactShareViewController.swift b/node_modules/react-native-share-menu/ios/ReactShareViewController.swift index f42bce6..a827e7f 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! {
return RCTBundleURLProvider.sharedSettings()?
return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
@@ -52,6 +52,7 @@ class ReactShareViewController: ShareViewController, RCTBridgeDelegate, ReactSha override func viewDidDisappear(_ animated: Bool) { cancel() ShareMenuReactView.detachViewDelegate()
super.viewDidDisappear(animated) }
func loadExtensionContext() -> NSExtensionContext {
Fix File Sharing
diff --git a/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift b/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift
index 24cd59b..e1972cc 100644
--- a/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift
+++ b/node_modules/react-native-share-menu/ios/Modules/ShareMenuReactView.swift
@@ -57,6 +57,7 @@ public class ShareMenuReactView: NSObject {
}
viewDelegate.openApp()
+ ShareMenuReactView.detachViewDelegate()
}
@objc(continueInApp:)
@@ -74,6 +75,7 @@ public class ShareMenuReactView: NSObject {
}
viewDelegate.continueInApp(with: items, and: extraData)
+ ShareMenuReactView.detachViewDelegate()
}
@objc(data:reject:)
@@ -121,7 +123,16 @@ public class ShareMenuReactView: NSObject {
}
for provider in attachments {
- if provider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
+ if provider.hasItemConformingToTypeIdentifier(kUTTypeFileURL as String) {
+ provider.loadItem(forTypeIdentifier: kUTTypeFileURL as String, options: nil) { (item, error) in
+ let url: URL! = item as? URL
+
+ results.append([DATA_KEY: url.absoluteString, MIME_TYPE_KEY: self.extractMimeType(from: url)])
+
+ semaphore.signal()
+ }
+ semaphore.wait()
+ } else if provider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
provider.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { (item, error) in
let url: URL! = item as? URL
@@ -132,7 +143,7 @@ public class ShareMenuReactView: NSObject { semaphore.wait() } else if provider.hasItemConformingToTypeIdentifier(kUTTypeText as String) { provider.loadItem(forTypeIdentifier: kUTTypeText as String, options: nil) { (item, error) in
let text: String! = item as? String
results.append([DATA_KEY: text, MIME_TYPE_KEY: "text/plain"])
React Native 0.72.6 Xcode 15 New architecture enabled
App builds successfully with old architecture but gives following error with new architecture while building -
Below is the podspec for Share Extension