“ [@ RNC / AsyncStorage]:NativeModule:AsyncStorage为空”的根本原因是什么?

时间:2019-06-22 14:55:36

标签: react-native

错误:

return AlertDialog(
          title: Text(''),
          content: Text(
              "Möchtest du dich auf allen Geräten abmelden oder nur auf diesem Gerät?"),
          actions: <Widget>[
Container:(
child:Column(
children:<Widget>[
b1, b2, b3
]))
          ],
        );

当我尝试使用npm start在博览会上运行我的应用程序时得到了它

昨晚我得到了它,我修复了它,直到一个小时前它都起作用了,但是现在又回来了。

我阅读了有关同一错误的其他主题,但是对我来说不起作用。

我的app.js代码

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

1 个答案:

答案 0 :(得分:0)

AsyncStorage不再在react-native库中:

import { Platform, StatusBar, StyleSheet, View, AsyncStorage} from 'react-native';

AsyncStorage删除为模块并执行npm install --save @react-native-community/async-storage

,然后像这样导入到您的文件中:

import AsyncStorage from '@react-native-community/async-storage';