Store GunJS graph data in RealmJS for React Native apps.
WARNING: NOT PRODUCTION READY!
In most apps, you will want to keep local state of your Gunjs data between application sessions and when offline. In the browser, Gun will dump to local storage to provide offline capabilities. This wires up your Gun database to a Realm store for fast local storage in your React Native application.
For an alternative with AsyncStorage, see Andre Staltz's gun-asyncstorage.
Clone this repo (eventually will be available on npm
).
// Still working out bugs when loading Gun in React Native
import Gun from 'gun/gun';
import registerGunRealm from './gun-realm/register';
registerGunRealm(Gun);
let gun = new Gun();
Currently, Expo does not support Realm, but you can detach your app or use a simple react-native init
type install. Eventually, support for Realm may be built in to Expo which will take away some of the manual steps required.
Issues welcome on Github.