I’m not entirely sure what’s going on here. One thing that does jump out at me is that you’re not await
ing the result of db.query
even though it is inside an async
function. You could try:
const testDB = async (): Promise<void> => {
console.log("before start");
const db = connect("miaum");
console.log("db created");
await db.query(sql`
create table if not exists test1 (item_id integer);
`).then(
results => console.log(results), //never executed
err => console.error(err), //never executed
).catch(console.log)
.finally(console.log); //never executed
console.log("finish");
}
I don’t think this should make any difference, but it may end up highlighting the error a bit better.
You might also find our expo text project helpful as a starting point to compare what you have against a working app: https://github.com/ForbesLindesay/atdatabases/blob/master/expo-test-project/App.tsx
Another thing to check is that you’re using an up to date version of expo. Our test app is built using expo 36.0.0