react-native-fetch-blob IOS API openDocument not working

2.6k Views Asked by At

I require showing applications in the IOS device capable of opening various file formats.I tried using react native share to achieve the same but options of copying file to other apps did not appear.So i tried using react native fetch blob. RNFetchBlob.fs.exists(fs.dirs.DocumentDir+'/sample.pdf') return true , meaning the file does exist but when i use RNFetchBlob.ios.openDocument(fs.dirs.DocumentDir+'/sample.pdf') nothing happens, not even an error but rather the success callback is called. Appreciate any help.

1

There are 1 best solutions below

0
On BEST ANSWER

I was able to resolve the issue , but i don't know why it actually happened in the first place. I used an Alert.alert to find if the file existed or not and then called the RNFetchBlob.ios.openDocument function, upon removing the alert just before the function call it started working.Posting this answer incase it does happen to anyone else.