These variables can be used inside getMeteorData or createContainer. They will be populated into your component if they change.
- Meteor.subscribe()
- Meteor.collection(collectionName, options)
- Meteor.user()
- Meteor.userId()
- Meteor.status()
- Meteor.loggingIn()
- ReactiveDict()
These methods (except update) work offline. That means that elements are correctly updated offline, and when you reconnect to ddp, Meteor calls are taken care of.
- Meteor.collection(collectionName, options)
Meteor.subscribe() returns a handle. If the component which called subscribe is unmounted, the subscription is automatically canceled.
You need pass the cursoredFind
option when you get your collection if you want to use cursor-like method:
Meteor.collection('collectionName', {cursoredFind: true});
Or you can simply use find()
to get an array of documents. The option default to false for backward compatibility. Cursor methods are available to share code more easily between a react-native app and a standard Meteor app.
Connect to a DDP server. You only have to do this once in your app.
Arguments
url
string requiredoptions
object Available options are:autoConnect
boolean [default: true] whether to establish the connection to the server upon instantiation. When false, one can manually establish the connection with the Meteor.ddp.connect method.autoReconnect
boolean [default: true] whether to try to reconnect to the server when the socket connection closes, unless the closing was initiated by a call to the disconnect method.reconnectInterval
number [default: 10000] the interval in ms between reconnection attempts.
Disconnect from the DDP server.
- Meteor.call
- Meteor.loginWithPassword (Please note that user is auto-resigned in - like in Meteor Web applications - thanks to React Native AsyncStorage.)
- Meteor.logout
- Meteor.logoutOtherClients
Example import { Accounts } from 'react-native-meteor';
- EJSON
- Tracker
- ReactiveDict
- Accounts (see below)
See documentation.
import { Accounts } from 'react-native-meteor';
- Accounts.createUser
- Accounts.changePassword
- Accounts.forgotPassword
- Accounts.resetPassword
- Accounts.onLogin
- Accounts.onLoginFailure
- Accounts.onLogout
Custom event
Once connected to the ddp server, you can access every method available in ddp.js.
- Meteor.ddp.on('connected')
- Meteor.ddp.on('added')
- Meteor.ddp.on('changed')
- ...