const downloadFile = () => { let date = new Date(); let FILE_URL = fileUrl; let file_ext = getFileExtention(FILE_URL); const {config, fs} = RNFetchBlob; let RootDir = fs.dirs.DownloadDir; let options = { fileCache: true, addAndroidDownloads: { path: RootDir +'/file_'+ Math.floor(date.getTime() + date.getSeconds() / 2) +"."+ file_ext, description: 'downloading file...', notification: true, useDownloadManager: true, }, }; config(options) .fetch('GET', FILE_URL) .then(res => { console.log('res -> ', JSON.stringify(res)); Alert.alert('File Downloaded Successfully.'); }); }; const getFileExtention = (fileUrl: string) => { return /[.]/.exec(fileUrl) ? /[^.]+$/.exec(fileUrl) : undefined; }; // Sharing const letShare = async () => { const shareOptions = { message: 'This is a test message', url: fileUrl }; try { const shareResponse = await Share.open(shareOptions); } catch (error) { console.log('error', error); } };
I am new in React native and trying to create the image share and download page where I am not getting download it in ios and android gallery and while sharing how to share the base 64 format of any image.