react-native-async-storage/async-storage

Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

puneetkumarkaushik opened this issue · 9 comments

Getting following issue when using @react-native-async-storage/async-storage library. It is happening only when I'm running the project in ios simulator. It's working fine in android.
I have tried 1.18.2, 1.18.1, 1.18.0, 1.17.11 versions. I have tried steps mentioned in error as well.

Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

To fix this issue try these steps:

• Rebuild and restart the app.

• Run the packager with --reset-cache flag.

• If you are using CocoaPods on iOS, run pod install in the ios directory and then rebuild and re-run the app.

• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest

I'm using following dependencies:
"dependencies": {
"@react-native-async-storage/async-storage": "^1.18.0",
"@react-native-firebase/app": "^18.0.0",
"@react-native-masked-view/masked-view": "^0.2.9",
"@react-navigation/native": "^6.1.6",
"@react-navigation/native-stack": "^6.9.12",
"@react-navigation/stack": "^6.3.16",
"firebase": "^9.22.2",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-animatable": "^1.3.3",
"react-native-gesture-handler": "^2.9.0",
"react-native-safe-area-context": "^4.5.3",
"react-native-screens": "^3.14.0",
"react-native-shared-element": "^0.8.8",
"react-native-vector-icons": "^9.2.0",
"react-navigation-shared-element": "^3.1.3"
},

i have the same problem

I was getting this error when I called AsyncStorage functions e.g. AsyncStorage.setItem(key, value);.
Now I'm using Context API, the error is gone. It can work with redux also.

I was getting this error when I called AsyncStorage functions e.g. AsyncStorage.setItem(key, value);. Now I'm using Context API, the error is gone. It can work with redux also.

I got this error while installing it in an existing project, but when I installed another application (npx react-native@latest init) and installed asyncStorage on it, it worked

mocon commented

We are having this same issue as well, from within our Jest tests.

Edit: Fixed the issue in our project by bumping the version:

...
"@react-native-async-storage/async-storage": "~1.18.2"
...

I have the same problem

I was getting this error when I called AsyncStorage functions e.g. AsyncStorage.setItem(key, value);. Now I'm using Context API, the error is gone. It can work with redux also.

I got this error while installing it in an existing project, but when I installed another application (npx react-native@latest init) and installed asyncStorage on it, it worked

have you fixed this issue

I installed version 1.17.11 to fix the problem

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.