I have issue with PouchDb react native sqlite adapter when using it on iOS device. I'm developing small React Native application for my SmartHome and using PouchDB to save some data locally on the phone.
The code works good when executing it on the Android device, but on the iOS device I get the following error:
WebSQL threw an error, [TypeError: sqlite.openDatabase is not a function. (In 'sqlite.openDatabase(openOpts.name, openOpts.version, openOpts.description, openOpts.size, null, onError)', 'sqlite.openDatabase' is undefined)]
- node_modules/expo/build/environment/muteWarnings.fx.js:26:24 in error
- node_modules/@sentry/utils/dist/instrument.js:104:50 in <unknown>
- node_modules/pouchdb-adapter-websql-core/node_modules/pouchdb-utils/lib/index-browser.js:457:26 in guardedConsole
- node_modules/pouchdb-adapter-websql-core/lib/index.js:239:32 in <unknown>
- node_modules/pouchdb-adapter-react-native-sqlite/lib/index.js:35:23 in ReactNativeSQLitePouch
- node_modules/pouchdb-react-native/node_modules/pouchdb-core/lib/index.js:1274:38 in PouchDB
const SQLiteAdapter = SQLiteAdapterFactory(SQLite)
PouchDB.plugin(SQLiteAdapter)
PouchDB.plugin(require('pouchdb-find'));
PouchDB.plugin(require('pouchdb-upsert'));
return new PouchDB(dbName, {adapter: 'react-native-sqlite', revs_limit: 1, auto_compaction: true});
PouchDB {
"__opts": Object {
"adapter": "react-native-sqlite",
"auto_compaction": true,
"name": "afa31ab81267925e8bd75233177a5988.db",
"revs_limit": 1,
},
"_adapter": "react-native-sqlite",
"_events": Object {},
"_maxListeners": undefined,
"_name": "afa31ab81267925e8bd75233177a5988.db",
"adapter": "react-native-sqlite",
"auto_compaction": true,
"name": "afa31ab81267925e8bd75233177a5988.db",
"prefix": "_pouch_",
"taskqueue": TaskQueue$1 {
"failed": [web_sql_went_bad: unknown],
"isReady": false,
"queue": Array [],
},
}