react-native-share-menu icon indicating copy to clipboard operation
react-native-share-menu copied to clipboard

Shared text is sometimes the URL and sometimes the Title

Open asaprahul opened this issue 3 years ago • 9 comments

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! 😄

asaprahul avatar Apr 24 '21 09:04 asaprahul

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

asaprahul avatar Apr 24 '21 22:04 asaprahul

Having same issue, any fixes?

jonitef avatar Jun 10 '21 09:06 jonitef

I have the same issue. 😢

yanggak12 avatar Aug 29 '21 08:08 yanggak12

Also having this issue

nnbrandon avatar Oct 09 '21 03:10 nnbrandon

@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... } });

IbrahimCanKALYA avatar Nov 15 '21 14:11 IbrahimCanKALYA

having the same issue with brave browser, netflix and walmart apps

eranga-akva avatar Dec 08 '21 05:12 eranga-akva

Having this issue with the Firefox browser on iOS. Sharing the page to my app gives me the page title instead of the URL.

kodie avatar Jan 13 '22 17:01 kodie

Possibly related to #44

kodie avatar Jan 13 '22 17:01 kodie

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.

kodie avatar Jan 13 '22 18:01 kodie