react-native - 如何修复 'undefined is not an object (evaluating ' NativeModules ["SQLite"][方法 ]')'

标签 react-native react-native-sqlite-storage

我无法在我的应用程序中使用“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,您必须弹出您的应用程序并链接库,如图所示here

关于react-native - 如何修复 'undefined is not an object (evaluating ' NativeModules ["SQLite"][方法 ]')',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56562472/

相关文章:

react-native - 无法在react-native中异步执行sqlite db查询

javascript - 在 "store"的上下文或 props 中找不到 "Connect(App)"

javascript - react native : iOS dictation unable to clear text input

javascript - 样式属性中的索引与 native react

react-native - 列表项上的背景颜色不起作用?

ios - react native iOS 网络请求失败 - 代理设置问题

sqlite - 如何在expo React Native中使用sqlite文件

typescript - 如何使用 TypeORM 在 React-Native 中处理 SQLite 迁移?