Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RNFS.readDir(path) only returns folders in directory files are excluded #1208

Open
MianIbrarHussain opened this issue Nov 7, 2023 · 3 comments

Comments

@MianIbrarHussain
Copy link

I have been using different libraries but none of them is fetching files all of them only return folders.
I am working on file manager app for which access to all files in storage is necessary.
If anyone could tell me why react-native-fs or react-native-blob-util only return folders and not files in them?
If anybody have any suggestions I am all ears.

@Valentine-Mario
Copy link

I also experienced the same issue when I used ExternalStorageDirectoryPath but DocumentDirectoryPath list all files and folders

@chinmay4github1987
Copy link

Same thing happening for me as well directory files are excluded

@arthurDz
Copy link

Same thing happening for me as well directory files are excluded

I also faced same issues but figured it was not the issue of RNFS.readDir function but due to change in the way permissions are handled from android 11(API level 30). Android 11 introduced scoped storage, which restricts access to external storage and requires apps to use the MediaStore API or the Storage Access Framework (SAF) for accessing files. So, from Android 11, the READ_EXTERNAL_STORAGE permission is not required for accessing media files. Instead, you should use the READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, or READ_MEDIA_AUDIO permissions, depending on the type of media you're accessing. Hope it helps, if it does then leave a thumbs up or if not then please mention the API level/Android version on which you are facing this issue then I will be able to help more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants