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
[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. #967
Comments
I am Facing the same issue |
Hey, |
@krizzu Thanx for your time,Actually i was not clear enough,it is working in project but fails in below test case CODE :: import 'react-native'; // Note: test renderer must be required after react-native. // test("Testing first time",() => { test("Welcome Screen from App.js", () => {
}); RESULT :: FAIL tests/App-test.tsx
Test Suites: 1 failed, 1 total |
Ah, that changes the issue completely 😄 |
@krizzu Already did bro but no it doesn't work 🥲 |
And i have tried with both ways |
"dependencies": { |
I change the import from import AsyncStorage from '@react-native-async-storage/async-storage' TO 😀Working Fine Now Thanx ✌🏻 |
Great! |
I realized the OP did not response yet, so reopening |
Same issue happened with me, been creating fresh new project with typescript since last week and this issue happens right the moment i installed this package My environment, maybe we can see some pattern here:
Last time it worked was in my last old RN project below, without typescript
|
Krysztof, thanks. I will try a new project. I had cleaned out node_modules
multiple times, to no avail, but I had not tried a completely new project.
I will report back later today on the effort.
Thanks,
…On Wed, May 31, 2023 at 8:40 AM Krzysztof Borowy ***@***.***> wrote:
I realized the OP did not response yet, so reopening
—
Reply to this email directly, view it on GitHub
<#967 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOQ5AMGLQGSAE667A5RTNHLXI432FANCNFSM6AAAAAAYR6A3AQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
--
*Denver Hunter*
*Small Town Co., LLC*
Websites & data experiences that sell.
P: 803.939.6694
|
please let me know how it went by initiating fresh new project. because i did it several days ago and no avail idk if i init fresh new one and straight up installs RNC/AsyncStorage v1.15 instead of fresh install with 1.18 and downgrading (which didn't work for me) |
Hello, "@react-native-async-storage/async-storage": "^1.17.11", |
fix : download one version older from the latest one it will work fine without any errors |
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. |
Same issue here tried multiple versions can't make it work. Im running my app on an expo development build.. |
@TahirPK007 Which version are you using? |
I face the same problem with Andriod, but it works with iOS.
|
I'm also facing the same issue. |
still facing the same issue on the expo. anyone have any idea |
Same. problem here with expo. I am using amplify and getting the error in Jest testing. None of the suggested solution works. |
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. |
Joining the club. |
Same issue here.. |
try that #994 (comment) kill (remove on backend service) app installed on the simulator before and reinstall the app, and then it works! |
Please try rebuilding the application once you install the package and set it up in your repository. It should work out of the box, with the new build. |
quit react-native in terminal,then restart with "npm run start --reset-cache".It works for me! |
you could just stop in quit react-native |
works for me. Thansk! |
What happened?
Just to be clear, I have reviewed every search and article I can find on this topic. I am working on just the Android app to get some underlying issues updated in Android Studio. This is just a relatively simple flashcard-type app.
I have cleaned, rebuilt, and run through every fix I can find.
I'm getting the error:
`Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
I followed the above to the letter. I have deleted and added the app back both on the emulator and a physical device. I also created the .apk and ran it on my phone just to make sure it wasn't a jest issue.
I'll include the relevant files & commands below, but please let me know if you need more information somewhere:
Version
1.18.1
What platforms are you seeing this issue on?
System Information
Steps to Reproduce
Firstly, I installed the package with NPM:
npm install @react-native-async-storage/async-storage
package.json:
{ "name": "Name", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "@react-native-async-storage/async-storage": "^1.18.1", "deprecated-react-native-prop-types": "^4.1.0", "native-base": "^2.13.12", "react": "18.2.0", "react-native": "0.71.8", "react-native-firebase": "^5.6.0", "react-native-swiper": "^1.6.0" }, "devDependencies": { "babel-jest": "29.5.0", "jest": "29.5.0", "jetifier": "^2.0.0", "metro-react-native-babel-preset": "0.76.5", "react-test-renderer": "18.2.0" }, "jest": { "preset": "react-native", "setupFiles": [ "./jest/jestSetupFile.js" ] } }
^ Just one note on the above, I did try upgrading native-base as well.
Deck.js
import React from 'react' import { Platform, Image, Dimensions, TouchableOpacity, View, Animated, StyleSheet } from 'react-native' import { Card, CardItem, Icon, Container, Header, Body, Footer, Left, Right, Content, Title, List, ListItem, Text, Button } from 'native-base' import Swiper from 'react-native-swiper' import firebase from 'react-native-firebase' import AsyncStorage from '@react-native-async-storage/async-storage';
I can provide more code if needed, but when I comment out the above import, the app functions. If I include the import from Native base, I get the removal notification, and if I simply comment out the AsyncStorage, the app otherwise functions with the AsyncStorage functionality.
I ran two different codes in my jestSetupFile, the suggested one here: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest and the current one:
jest.mock("@react-native-async-storage/async-storage", () => ({ setItem: jest.fn(() => Promise.resolve()), getItem: jest.fn(() => Promise.resolve()), }));
I also went the mocks_ directory route.
Are there any other suggestions?
The text was updated successfully, but these errors were encountered: