I'm trying to use react-native-sqlite-storage to work with the local db on react native, for ios.
var SQLite = require('react-native-sqlite-storage');
var db = [];
export default class DataBase {
constructor () {
db = SQLite.openDatabase("eventHelper.db", "1.0", "EventHelper", 200000, this.openCB, this.errorCB);
}
errorCB(err) {
console.log("SQL Error: " + err);
}
successCB() {
console.log("SQL executed fine");
}
openCB() {
console.log("Database OPENED");
}
}
But i get the following error message: Cannot read property 'open' of undefined. I don't know exactly how does openDatabase works, i have not created the database. I am not sure wether i should create the database first, and how, or if openDatabase is doing this if the database does not exist.
I looked for this problem, and i tried the solution suggested here https://github.com/andpor/react-native-sqlite-storage/issues/64 - uninstalled react-native-sqlite-storage - removed the node_modules folder - npm install - npm install --save react-native-sqlite-storage - rnpm link
Any suggestion will be highly appreciated. Thanks!