简体   繁体   English

React Native - AsyncStorage 为空

[英]React Native - AsyncStorage is null

在此处输入图片说明

I got these errores when I was adding AsyncStorage dependencies ( https://github.com/react-native-community/async-storage )我在添加 AsyncStorage 依赖项时遇到这些错误 ( https://github.com/react-native-community/async-storage )

I was using React Native CLI, not expo, I had ran 'react-native link @react-native-community/async-storage' in the project root.我使用的是 React Native CLI,而不是 expo,我在项目根目录中运行了“react-native link @react-native-community/async-storage”。

My problem was when i ran '--clearCache' flag, maybe that was my problem, I don't know.我的问题是当我运行“--clearCache”标志时,也许那是我的问题,我不知道。 If you know how to run the flag '--clearCache' please help me.如果您知道如何运行标志“--clearCache”,请帮助我。

Try this尝试这个

react-native link @react-native-community/async-storage react-native 链接@react-native-community/async-storage

Then Run react-native run-android然后运行 ​​react-native run-android

For me,为了我,
1. Reinstalling app 1. 重装应用
2. restarting bundler with npm start --reset-cache 2. 使用npm start --reset-cache重启 bundler

solved the issue !解决了问题 in Android在安卓中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM