我正在使用react-native-sqlite-storage,想使用JSON Functions And Operators,但在阅读了问题后,我发现我需要使用Android原生SQLite #480。然后我更改了react-native.config.js,以便使用与库捆绑的SQLite。进行一些调整以运行给定in the docs的测试示例,但在打开数据库时出现错误:
OPEN database: Test.db
LOG SQLite.open({"name":"Test.db","dblocation":"nosync"})
ERROR TypeError: Cannot convert null value to object, js engine: hermes
我正在使用Windows和RN Android模拟器(默认脚本:npm运行android)与这些软件包版本:
"dependencies": {
"deprecated-react-native-listview": "^0.0.8",
"react": "18.1.0",
"react-native": "0.70.3",
"react-native-sqlite-storage": "^6.0.1"
},
我想上传堆栈跟踪,但我不知道如何从设备中提取它。从设备中输出的堆栈中提取几个步骤,所有这些步骤都与sqlite.core.js文件相关:
我不知道是函数本身(openDatabase)不识别参数,还是必须使用另一个函数,或者是因为我没有通过将数据库复制到特定文件夹来预填充数据库。
react-native.config.js
module.exports = {
dependency: {
platforms: {
ios: {
project: './platforms/ios/SQLite.xcodeproj'
},
/*
// default config
android: {
sourceDir: './platforms/android'
},
*/
// changed
android: {
sourceDir: "../node_modules/react-native-sqlite-storage/platforms/android-native",
packageImportPath: "import io.liteglue.SQLitePluginPackage;",
packageInstance: "new SQLitePluginPackage()"
},
windows: {
sourceDir: './platforms/windows',
solutionFile: 'SQLitePlugin.sln',
projects: [
{
projectFile: 'SQLitePlugin/SQLitePlugin.vcxproj',
directDependency: true,
}
],
}
}
}
}
1条答案
按热度按时间anauzrmj1#
我也遇到了这个错误。对于我的情况,这只是一个操作序列问题。这个错误发生在我在安装react-native-sqlite-storage包之前启动APP的时候。当我重新启动APP的时候,这个错误消失了。
参考示例:https://blog.logrocket.com/using-sqlite-with-react-native/https://aboutreact.com/example-of-sqlite-database-in-react-native/