-
Notifications
You must be signed in to change notification settings - Fork 95
Description
I'm using react-native-fs for downloading the pdf and saving it.
let url = 'http://samples.leanpub.com/thereactnativebook-sample.pdf';
const getPdfName = () => {
return url.split('/').pop();
};
RNFS.downloadFile({
fromUrl: url,
toFile: ${RNFS.DocumentDirectoryPath}/${getPdfName()},
}).promise.then(r => {
let path = ${RNFS.DocumentDirectoryPath}/${getPdfName()};
setFilePath(path);
});
const resourceType = 'file';
const resources = {
file: 'thereactnativebook-sample.pdf',
};
<PDFView
fadeInDuration={250.0}
style={styles.pdfStyle}
resource={resources[resourceType]}
resourceType={resourceType}
onLoad={() => console.log(PDF rendered from ${resourceType})}
onError={error => console.log('Cannot render PDF', error)}
/>
Getting error 'Pdf file not found. While code works fine with URL-type resources.
Version:-
"react": "18.1.0",
"react-native": "0.70.0",