react-native-meteor-offline
This package uses redux and redux-persist behind the scenes to maintain offline versions of your meteor data (compatible with react-native-meteor).
Important: V 2.0 implements a new class-based API. The V 1 api will be deprecated at some point. I've also renamed this react-native-meteor-offline, since that's more reflective of what it is. Access the 1.X API here: https://github.com/DesignmanIO/react-native-meteor-redux/tree/1.1.1
Install
npm install react-native-meteor-redux
Use
Initialize
; // initialize a MeteorOffline instance with options, currently just takes debounce// Do this at/near the top level of your appconst GroundedMeteor = debounce: 1000; // Now you can access MeteorStore as a redux store throughout your app.;
Using cached collection
;; const component = { const docs = props; return <View> docs; </View> } ; // MeteorOffline.collection works as normal, but we pass the unique subscription name so that behind the scenes it will synchronize your collection return docs: GroundedMeteor ;} component)
Running the example
Execute the following commands:
cd example/RNApp && npm icd ../MeteorApp && meteorcd ../RNApp && react-native run-ios# or cd ../RNApp && react-native run-android
If you get .babelrc errors, try running this in the RNApp directory
./node_modules/react-native/packager/packager.sh start --reset-cache