Hey.
I banged my head off this a few times too, but eventually I got around it by doing the following:
-
created a function that made a dummy/blank DB and called it in component did mount:
makeSQLiteDirAsync() { const dbTest = SQLite.openDatabase('dummy.db'); try { await dbTest.transaction(tx => tx.executeSql('')); } catch(e) { if (this.state.debugEnabled) console.log('error while executing SQL in dummy DB'); }
}
this effectively creates the SQLite dir required.
-
After this call I have a call similar to yours:
// load in db Expo.FileSystem.downloadAsync( Expo.Asset.fromModule(require('./assets/db/db.db')).uri, `${Expo.FileSystem.documentDirectory}SQLite/db.db` ) .then(function(){ let db = SQLite.openDatabase('db.db'); // do whatever else you need here })
Hope this helps!