craftzdog / pouchdb-adapter-react-native-sqlite

PouchDB adapter using ReactNative SQLite as its backing store
https://github.com/craftzdog/pouchdb-react-native
MIT License
124 stars 21 forks source link

[v4] Use op-sqlite #24

Closed craftzdog closed 2 weeks ago

craftzdog commented 2 months ago
craftzdog commented 2 months ago

You can try 4.0.0-rc.1

gabrielgrover commented 1 month ago

@craftzdog Do you have suggestions for projects that use expo? At my work we use this package at version 3, but we use it with expo sqlite since we are in a managed workflow.

martin-ecatch commented 4 weeks ago

@gabrielgrover FYI: op-sqlite works out of the box in Expo managed workflow. Just install op-sqlite and v4 of this plugin. Then build a development build of your app. Everything should work. You can even use a pre-existing database - let me know if you need some advice on that.

gabrielgrover commented 4 weeks ago

@gabrielgrover FYI: op-sqlite works out of the box in Expo managed workflow. Just install op-sqlite and v4 of this plugin. Then build a development build of your app. Everything should work. You can even use a pre-existing database - let me know if you need some advice on that.

Thanks @martin-ecatch ! Gonna try this out today. Will reach out if I have any questions.

gabrielgrover commented 4 weeks ago

@martin-ecatch So I installed opsqlite and version 4.0.5 of this package. When i try to run my app I get the following error screen

Screenshot 2024-08-20 at 11 52 00 AM

here is my pouch config

import HttpPouch from 'pouchdb-adapter-http';
import SQLiteAdapter from 'pouchdb-adapter-react-native-sqlite';
import PouchDB from 'pouchdb-core';
import PouchdbFind from 'pouchdb-find';
import mapreduce from 'pouchdb-mapreduce';
import replication from 'pouchdb-replication';

export const pouch_db = PouchDB.plugin(SQLiteAdapter)
  .plugin(HttpPouch)
  .plugin(mapreduce)
  .plugin(replication)
  .plugin(PouchdbFind);

I have a feeling it might be because we are using yarn workspaces?

martin-ecatch commented 3 weeks ago

@gabrielgrover I don't see anything wrong with your setup. To make sure:

gabrielgrover commented 3 weeks ago

@gabrielgrover I don't see anything wrong with your setup. To make sure:

  • Are the libraries in your package.json? (npm does that automatically now, not sure about yarn)
  • Did you build a new development build using EAS after installing the libraries?
  • Are you using the latest SDK (51)?
  • Note that this won't work in Expo Go. You need to ditch Expo Go and use development builds. Hope this helps.

Ah. Yes I definitely was using expo go. Will try a dev build