Created
April 3, 2017 18:26
-
-
Save sdvg/2722fec55ff8fdb393c4c81abab95579 to your computer and use it in GitHub Desktop.
Hoodie with react native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof process === 'undefined') { | |
process = {}; // eslint-disable-line no-global-assign | |
} | |
process.nextTick = setImmediate; | |
process.emit = () => {}; | |
export default process; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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