Skip to content

Instantly share code, notes, and snippets.

@sdvg
Created April 3, 2017 18:26
Show Gist options
  • Save sdvg/2722fec55ff8fdb393c4c81abab95579 to your computer and use it in GitHub Desktop.
Save sdvg/2722fec55ff8fdb393c4c81abab95579 to your computer and use it in GitHub Desktop.
Hoodie with react native
import PouchDB from 'pouchdb-react-native';
import SQLite from 'react-native-sqlite-storage';
import SQLiteAdapterFactory from 'pouchdb-adapter-react-native-sqlite';
import Hoodie from '@hoodie/client';
import appConfig from './appConfig';
const SQLiteAdapter = SQLiteAdapterFactory(SQLite); // eslint-disable-line new-cap
PouchDB.plugin(SQLiteAdapter);
const hoodie = new Hoodie({
url: appConfig.hoodieUrl,
PouchDB,
});
export default hoodie;
if (typeof process === 'undefined') {
process = {}; // eslint-disable-line no-global-assign
}
process.nextTick = setImmediate;
process.emit = () => {};
export default process;
@alterx
Copy link

alterx commented Apr 19, 2017

Have you tested this on a real RN app?

I was using the exact same thing but I just keep getting 415 errors, it looks like it's got something to do with the XMLHttpRequest polyfill RN uses because overwriting it with the Debugger tools seems to work.

Just curious about this

EDIT:
I found a solution and filled an issue hoodiehq/hoodie#732

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment