react-nativereact-native-sqlite-storage

How to fix 'undefined is not an object (evaluating 'NativeModules["SQLite"][method]')'


I am not able to use 'react-native-sqlite-storage' in my app. I am using expo for building pure react-native app.

I have already tried re-installing react native but it did not work.

This is my 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
}

Solution

  • The library is not linked to its native code. If you are using Expo you can use the SQLite Api

    If you want to use react-native-sqlite-storage you will have to eject your app and link the library as shown here