ammarahm-ed / react-native-scoped-storage

MIT License
58 stars 10 forks source link

How to open a file using default android app #36

Closed LitchiTheCat closed 2 years ago

LitchiTheCat commented 2 years ago

Hi, I'm working on an app in which the user could open a file stored in scoped storage with the default android apps (like RNFetchBlob's ActionViewIntent). However, I can't find a way to do it, as RNFetchBlob requires a path rather than an URI. Also, I need the user to access the original file and not a copy of it, so he can edit it. I tried to stat the file path (and I get something like '/storage/emulated/0/.../myfile', but no file is found by RNFetchBlob ActionViewIntent. As RNFetchBlob is not maintained anymore, I can't find any alternative to manage this situation... Any help will be greatly appreciated

LitchiTheCat commented 2 years ago

EDIT : I have finally found out that react-native-file-viewer is able to open URIs obtained through react-native-scoped-storage. Might be interesting to add this in the docs for any person that needs it in the future