itinance / itinance/react-native-fs

RNFS.readDir() error Attempt to get length of null array

Open
#921 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Reference to https://github.com/itinance/react-native-fs/issues/462

I followed the above issue solution, still got the same error:

the code:

`
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('onPressDownloads write granted...');
try {
let files = RNFS.readDir(RNFS.DownloadDirectoryPath);
console.log("onPressDownloads files: ", files);
} catch (error) {
console.log("onPressDownloads error: ", error);
}
}
`

I am using
React-native info: "react-native-fs": "^2.16.6",

info Fetching system and libraries information...
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 366.02 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.12.0 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 25, 26, 27, 28, 29
Build Tools: 27.0.2, 27.0.3, 28.0.2, 28.0.3, 29.0.3
System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: ^16.9.0 => 16.9.0
react-native: ^0.61.5 => 0.61.5
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-asset: 2.0.0
react-native-cli: 2.0.1
react-native-cn-richtext-editor: 1.0.42
react-native-git-upgrade: 0.2.7
react-native: 0.61.5

I have the use permissions in AndroidManifest.xml file:














and under

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.