camo icon indicating copy to clipboard operation
camo copied to clipboard

Pull request for use with react-native-local-mongodb?

Open Billydubb opened this issue 7 years ago • 1 comments

Hey, I am using react-native-local-mongodb, which is basically a fork of nedb adapted for react-native. To use camo with React Native you have to change and add a few things. Would you be interested in a PR with the changes I've made for react native or do you think I should put that in a separate repo?

Billydubb avatar Aug 17 '17 13:08 Billydubb

For anyone who might be interested in using camo with react-native, here's what worked for me:

  • install Buffer

    • npm install buffer —save
  • Add Buffer to global namespace in index.js (Buffer is used in validate.js)

    • global.Buffer = global.Buffer || require(‘Buffer’)
  • Install path

    • npm install -D path
    • npm install —save path
  • Uncomment or remove require(‘fs) in nedbclient.js

  • Replace const Datastore = require(‘nedb’) with const Datastore = require(‘react-native-local-mongodb) in nedbclient.js

  • If you want to make this a standalone lib, then you should add the following dependencies to package.json

    • path
    • buffer
    • react-native-local-mongodb
  • Optionally in db.js remove all the mongodb stuff

  • Optionally, remove the mongoclient.js file

Billydubb avatar Nov 07 '17 14:11 Billydubb