RonRadtke / react-native-blob-util

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
747 stars 128 forks source link

[iOS] ios.openDocument(path) does nothing if current screen is a modal #311

Open psegalen opened 10 months ago

psegalen commented 10 months ago

Hi, My app was using react-navigation's stack navigator which displays JS modals but I recently switched to native-stack navigator which displays a native modal. In this modal I have a button allowing the user to download a file through this lib, Android generates a notification to open the downloaded file but not on iOS, so my app opens the downloaded document on iOS. Everything works as intended but since I switched to a native-stack navigator ios.openDocument(path) just doesn't do anything, there is no exception thrown and the promise correctly returns void but nothing happens in the app.

I guess it has something to do with ViewController since I found this PR fixing the same kind of problem on another lib: https://github.com/vinzscam/react-native-file-viewer/pull/5/files - I'll try to apply it on this lib but since I've never been an Obj-C beast I'm not sure I'll succeed... :)

RN version: 0.72.4 RNBlobUtil version: 0.19.1

jitenshah19 commented 10 months ago

Hi @psegalen. Were you able to find a solution to opening a file in ios using openDocument inside a modal?

psegalen commented 10 months ago

Hi @jitenshah19 nope I couldn't find a solution using this package, I ended up sharing the path (through RN Share API: https://reactnative.dev/docs/share) in the "url" prop instead of trying to open it.

jitenshah19 commented 10 months ago

I ended up using react-native-file-viewer package.

dgrover-spotnana commented 2 months ago

@RonRadtke Do you have any update on this ? The issue still exists for both ios.openDocument(path) and ios.previewDocument(path)

"react-native": "0.72.12",
"react-native-blob-util": "^0.19.9",
"react-native-modal": "^13.0.1",