-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Configure PouchDB to run on the project
Related article: https://dev.to/craftzdog/a-performant-way-to-use-pouchdb7-on-react-native-in-2022-24ej
- Loading branch information
Showing
4 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import '/pouchdb/shim' | ||
|
||
import { AppRegistry } from 'react-native' | ||
|
||
import App from './App' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// eslint-disable-next-line import/order | ||
import 'react-native-get-random-values' | ||
|
||
import HttpPouch from 'pouchdb-adapter-http' | ||
import SQLiteAdapterFactory from 'pouchdb-adapter-react-native-sqlite' | ||
import PouchDB from 'pouchdb-core' | ||
import mapreduce from 'pouchdb-mapreduce' | ||
import replication from 'pouchdb-replication' | ||
import WebSQLite from 'react-native-quick-websql' | ||
|
||
const SQLiteAdapter = SQLiteAdapterFactory(WebSQLite) | ||
|
||
export default PouchDB.plugin(HttpPouch) | ||
.plugin(replication) | ||
.plugin(mapreduce) | ||
.plugin(SQLiteAdapter) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { shim } from 'react-native-quick-base64' | ||
|
||
shim() | ||
|
||
// Avoid using node dependent modules | ||
process.browser = true |