react-native-receive-sharing-intent icon indicating copy to clipboard operation
react-native-receive-sharing-intent copied to clipboard

It doesn't clear on android in "unmount" android || ios works fine

Open Salehjarad opened this issue 4 years ago • 1 comments

I used shared links in my app, so i use "weblink" in ios works fine, but android it doesn't clear on "unmount"

[my code]

  useEffect(() => {
      ReceiveSharingIntent.getReceivedFiles(files => {
        const sharedUrl = files[0].weblink.toString().trim();
        if(!UrlChecker().test(sharedUrl)) {
          return console.log('[not valid]', sharedUrl)
        }
        setSharedUrl(sharedUrl);
      }, 
      (error) =>{
        console.log('no files');
      });

    return () => {
      ReceiveSharingIntent.clearReceivedFiles();
    }

  }, []);

Salehjarad avatar Sep 17 '20 04:09 Salehjarad

@Salehjarad Why you put

return () => {
      ReceiveSharingIntent.clearReceivedFiles();
    }

instead of directly using ReceiveSharingIntent.clearReceivedFiles() at the end of the function? Hope to hear your thoughts.

robbiedood avatar Jan 09 '22 02:01 robbiedood