react-native-receive-sharing-intent
react-native-receive-sharing-intent copied to clipboard
It doesn't clear on android in "unmount" android || ios works fine
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 Why you put
return () => {
ReceiveSharingIntent.clearReceivedFiles();
}
instead of directly using ReceiveSharingIntent.clearReceivedFiles() at the end of the function? Hope to hear your thoughts.