javascriptreactjsreact-nativereact-native-fs

How to access files from a hidden folder in react-native-fs


I am not able to access files from a hidden folder /WhatsApp/Media/.Statuses in react-native-fs. Whenever I access I get back an empty array. I have granted READ_EXTERNAL_STORAGE permission (Android). My code goes like this :

import RNFS from 'react-native-fs'
RNFS.readDir(`${RNFS.ExternalStorageDirectoryPath}/WhatsApp/Media/.Statuses`).then(res => {
    console.log(res)
})

I am able to access files of other folder but not anything that starts from '.'
How to access files of a hidden folder in react-native-fs ?

Update:
This issue is in Android 11. Probably Android 10 as well.


Solution

  • Problem resolved for me by adding following permission in AndroidManifest.xml

    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />