Git Product home page Git Product logo

pouchdb-adapter-react-native-mmkv's Introduction

pouchdb-adapter-react-native-mmkv

EXPERIMENTAL: Still needs proper testing and further optimizations!!!

Introduction

This is an experimental PouchDB adapter for react-native-mmkv.

How to Use

1. Install react-native-mmkv

2. Install pouchdb^7 compatible to react-native

For example, one of the following:

3. Install pouchdb-adapter-react-native-mmkv

yarn add pouchdb-adapter-react-native-mmkv

4. Set up in your app

import PouchDB from "@craftzdog/pouchdb-core-react-native";
// OR
import PouchDB from "pouchdb-react-native";

import { MMKV } from "react-native-mmkv";
import MMKVAdapterFactory from "pouchdb-adapter-react-native-mmkv";

const MMKVAdapter = MMKVAdapterFactory(MMKV);

const MMKVPouchDB = PouchDB.plugin(MMKVAdapter);

const myDB = new MMKVPouchDB("myDB", { adapter: "mmkv" });

Development Setup

  1. Clone repo and cd into it
  2. Install dependencies and build lib
yarn && yarn build
  1. Run example
cd example && yarn && react-native run-ios

pouchdb-adapter-react-native-mmkv's People

Contributors

dohaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pouchdb-adapter-react-native-mmkv's Issues

Wrong winning_rev for previously deleted doc

If a document gets deleted by calling remove(doc) and we try to re-add the deleted document by calling put(doc) with the same data, then it results in the wrong old rev winning. Therefore the document does not get re-added for some reason.

A workaround, until resolved, is to disable deterministic revs when creating a PouchDB instance

const myDB = new MMKVPouchDB("myDB", { adapter: "mmkv", deterministic_revs: false });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.