react-native-file-viewer
react-native-file-viewer copied to clipboard
[Unhandled promise rejection: TypeError: null is not an object (evaluating 'RNFileViewer.open')]
thnks alot ,but this has made me having sleepless night to any one ever come a close such
which OS? which RNFV version?
Android as platform and version of 2.1.4
please also provide your code
I am facing this issue as well. Here is my implementation. (PS: I am using redux-saga)
*openFile({ payload }, { select, call, put, all }) {
const { url, fileName } = payload;
const localFile = `${RNFS.DownloadDirectoryPath}/${fileName}`;
const fileUrl = `${Config.API_URL}${url}`;
FileViewer.open(localFile, { showOpenWithDialog: true }); <--- crash
When I open the document, the intent activity seems to be crashed. Then, I debug it using Android Studio, and I got the following error.
E/RNDocumentPicker: promise was null in onActivityResult
Current Android Config: Android SDK: 30 RN version: 0.66.0
Any idea which part I am missing out?
Editted: Poco X3 NFC (Android 11) is working fine. Pixel 4 emulator (Android 11) keep crashing.
I am also facing this issue in both iOS and Android. App crash when open file, Below is my code. RNFS.downloadFile(fileOptions) .promise.then(() => { FileViewer.open(localFile) .then(() => { console.log('Rileviewer sucess, '); }) .catch(error => { // error console.log('FileViewer error - ', error); }); })
Thanks,
in react native +0.60 just run in your command prompt npm i and rebuild your project this works for me you don't have to manually link this library
Android as platform and version of 2.1.4
@ssengedonazil could you share a snippet of your code showing how you import the library?
It could also be related to some issues regarding the linking of the library.
I am facing this issue as well. Here is my implementation. (PS: I am using redux-saga)
*openFile({ payload }, { select, call, put, all }) { const { url, fileName } = payload; const localFile = `${RNFS.DownloadDirectoryPath}/${fileName}`; const fileUrl = `${Config.API_URL}${url}`; FileViewer.open(localFile, { showOpenWithDialog: true }); <--- crashWhen I open the document, the intent activity seems to be crashed. Then, I debug it using Android Studio, and I got the following error.
E/RNDocumentPicker: promise was null in onActivityResultCurrent Android Config: Android SDK: 30 RN version: 0.66.0
Any idea which part I am missing out?
Editted: Poco X3 NFC (Android 11) is working fine. Pixel 4 emulator (Android 11) keep crashing.
@WenLonG12345 your issue could be related to this
Hi sorry for the late reply, I had implement the Package Visibility but still no luck. The native error promise was null in onActivityResult still exist. Any idea why this happen?