I want to open an external file viewer for viewing files such as docx, txt, ppt, pdf and others. My files are getting stored within the android folder inside the com.appname folder. I am using react-native-file-viewer in order to open such file. But I am getting the below error:
[Error: Asset '/data/user/0/com.fleapo.jharkhandupdate/files/JharkhandUpdate/JharkhandUpdateDocuments/1621524753737_JharkhandUpdate_Madhushree%20Das_47.pdf' could not be opened]
const initPath = RNFS.DownloadDirectoryPath;
const dest = `${RNFS.DocumentDirectoryPath}/JharkhandUpdate/JharkhandUpdateDocuments/${initPath}`;
RNFS.copyFileAssets(dest, initPath)
.then(() => FileViewer.open(initPath))
.then(() => {
console.log("Done")
})
.catch(error => {
console.log(error)
});