不变违规:AsyncStorage 已被删除。即使升级后错误仍然存在

问题描述 投票:0回答:0

我在尝试为 android 构建时遇到此错误:

Invariant Violation: AsyncStorage has been removed from react-native core. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage, js engine: hermes

我是如何使用“@react-native-async-storage/async-storage”并且正确导入的:

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

这是我的 package.json 的片段

"dependencies": {
    "@react-native-async-storage/async-storage": "^1.18.1",
    "@react-native-camera-roll/camera-roll": "^5.2.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-native-firebase/app": "^10.3.1",
    "@react-native-firebase/auth": "^10.3.1",
    "@react-native-firebase/firestore": "^10.3.1",
    "@react-native-firebase/messaging": "^10.3.1",
    "@react-native-firebase/storage": "^10.3.1",
    "@react-navigation/bottom-tabs": "^5.9.2",
    "@react-navigation/native": "^5.7.3",
    "@react-navigation/stack": "^5.9.0",
    "axios": "^1.2.2",
    "firebase": "8.2.3",
    "install": "^0.13.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.43",
    "react": "18.2.0",
    "react-native": "0.71.7",

react-native asyncstorage
© www.soinside.com 2019 - 2024. All rights reserved.