react-native-share-menu
react-native-share-menu copied to clipboard
Shared text is sometimes the URL and sometimes the Title
Hi all! I'm experiencing this on iOS, haven't tried it on android yet.
Details:
I'm using the standard share feature in apps/mobile browsers to share into my app, and I'm expecting shared data with mimetype==text/plain
to be a URL but it's not always a URL. Sometimes it's the title of the page or link.
Here's an example: if I share this link from a mobile browser, sometimes the sharedData is the actual link https://open.spotify.com/episode/1KwaEJqOyWCOFZ7blWzoDR
(as expected) or sometimes it's the title of the page The Joe Rogan Experience / #1635 - Katie Spotz
. It happens randomly.
I tried sharing into other apps (instead of my app) and I notice that it shares two items - the title and the URL. Is it possible to capture both of those things when shared to my app? If it is not supported yet, can I hack the library to make my app capture both (in that case would really appreciate pointers in the code to where I can make the change)?
My code (exact same as in the ReadMe, no changes yet):
useEffect(() => {
ShareMenuReactView.data().then(({ mimeType, data }) => {
setSharedData(data);
setSharedMimeType(mimeType);
console.log("Data =>", data);
console.log("MimeType=>", mimeType);
});
}, []);
Thanks for the all great work with maintaining this! 😄
Here's a screen recording:
I found that the actual copied text is #1635 - Katie Spotz https://open.spotify.com/episode/1KwaEJqOyWCOFZ7blWzoDR
but when shared into the app, it's only the first part #1635 - Katie Spotz
https://user-images.githubusercontent.com/10172332/115974784-095dc000-a514-11eb-9f1c-163fa0eef487.mov
Having same issue, any fixes?
I have the same issue. 😢
Also having this issue
@rahulsonwalkar this problem caused by spotify. I solved the problem with this regex and its works.
[yourText].replace(/(https?:\/\/[^\s]+)/g, (url: string) => { if (url) { // do something... } });
having the same issue with brave browser, netflix and walmart apps
Having this issue with the Firefox browser on iOS. Sharing the page to my app gives me the page title instead of the URL.
Possibly related to #44
Possibly would be fixed on Android with #116 but that hasn't been merged in yet and also doesn't seem like it would fix it on iOS.