ios.previewDocument is not working anymore
See original GitHub issueHi Everyone! Around two weeks ago previewDocument was broken for me without any packages updates. Before that, I was able to download PDFs and preview them also. Now only an empty file is coming.
Here is my code:
RNFetchBlob.config({
fileCache: true,
indicator: true,
addAndroidDownloads: {
useDownloadManager: true,
notification: true,
mime: 'application/pdf',
title: `${fileName}`,
path: `${dirs.DownloadDir}/${fileName}`,
description: 'Diagnostic result',
},
})
.fetch('GET', `${BACKEND_URL}/${url}`, {
Authorization: `Bearer ${authToken}`,
})
.then((res) => {
const status = res.info().status;
if (status === 200) {
RNFetchBlob.fs.writeFile(filePath, res.data, 'base64');
RNFetchBlob.ios.previewDocument(filePath);
}
})
I checked and file is being saved correctly in the temporary folder and it’s not empty there, but then when I read it with ios.previewDocument
, the file is always empty. in popup which is appearing. After copying it’s also empty, in quick-look it’s also empty.
"rn-fetch-blob": "0.11.2"
"react-native": "0.61.2"
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
iOS 15 Simulator - Files App not s…
I observed that files in Documents folder of the iOS simulator(iOS 15.0) do not show up in the Files app anymore. Is there...
Read more >react-native-file-viewer
Native file viewer for react-native. Preview any type of file supported by the mobile device. iOS: it uses QuickLook Framework. Android: it uses ......
Read more >RN fetch blob download docx or pdf from URL in IOS
writeFile(configfb.path, res.data, 'base64'); RNFetchBlob.ios.previewDocument(configfb.path); } setisdownloaded(false) if (Platform.
Read more >Paste image from the clipboard into a PDF in Preview
Doesn't work for me in Mojave. Which OS version have you tested this in? – benwiggy. Oct 27, 2020 at 17:04.
Read more >8 Fixes for When Preview Fails to Open on Your Mac
app” is not open anymore. You can't open the application “Preview” because it is not responding. You may also see similar error messages...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I figure out my problem, I was pointing to
RNFetchBlob.fs.dirs.DownloadDir
, but this is only available for Android. Changed to point toRNFetchBlob.fs.dirs.DocumentDir
.Hey @qasimgit,
I would suggest finding a different library as this has been archived