react-native - 如何修复'未定义不是对象(评估'NativeModules [“SQLite”] [方法]')'
问题描述
我无法在我的应用程序中使用“react-native-sqlite-storage”。我正在使用 expo 来构建纯 react-native 应用程序。
我已经尝试过重新安装 react native,但它不起作用。
这是我的 package.json-
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"@expo/vector-icons": "^10.0.1",
"axios": "^0.18.0",
"expo": "^32.0.0",
"native-base": "^2.12.1",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-camera": "^2.10.0",
"react-native-camera-kit": "^8.0.0",
"react-native-easy-grid": "^0.2.1",
"react-native-sqlite-storage": "^3.3.10",
"react-navigation": "^3.11.0",
"realm": "^2.28.1"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
},
"private": true
}
解决方案
该库未链接到其本机代码。如果您使用 Expo,则可以使用SQLite Api
如果你想使用react-native-sqlite-storage你将不得不弹出你的应用程序并链接库,如下所示
推荐阅读
- angular - ion-input:检查 ionInput 上的输入并将焦点设置在下一个字段上
- mainframe - 使用 EXECIO 将 rexx 输出逻辑写入数据集?
- python - 命令错误退出状态 1:- Pytorch 对象检测
- python - 即使安装成功也无法导入sklearn
- eclipse - Eclipse Project Expoloer Active Highlite 颜色
- unreal-engine4 - UnrealEngine 4.26.0 (Preview2) 中的 MultiSphereTraceByChannel 问题
- ceph - 如何重新加入 Mon 和 mgr Ceph 到集群
- oracle - 如何获取 VNIC 中的所有 IP [Oracle Cloud Using API]
- azure - Azure 通过 DevOps 监控数据收集规则 (DCR)
- javascript - 将地图返回的对象分散到一个对象中