Open ezranbayantemur opened 5 years ago
I guess you didn't enable promises with
SQLite.enablePromise(true);
So you can't use db.transaction() as a Promise.
You should still be able catch the callback :
componentDidMount() {
const { db } = this.state;
db.transaction(
(tx) => {
tx.executeSql('SELECT * FROM tblUser;', [], (tx, results) => {
const rows = results.rows;
let users = [];
for (let i = 0; i < rows.length; i++) {
users.push({
...rows.item(i),
});
}
this.setState({ users });
})
},
(err) => {}),
() => console.log("TRANSACTION DONE")
);
}
@Al10s SQLite.enablePromise(true); did the trick.
I tried to catch transaction callback but it gives undefined error. (I'm passing the initial codes, define db, openDatabase etc..)
Error output:
Versions: