[docs] update usage
This commit is contained in:
parent
5ec411500f
commit
03abfab99b
|
@ -3,36 +3,25 @@
|
|||
After creating a Firebase project and installing the library, we can use it in our project by importing the library in our JavaScript:
|
||||
|
||||
```javascript
|
||||
import RNFirebase from 'react-native-firebase'
|
||||
import firebase from 'react-native-firebase';
|
||||
```
|
||||
|
||||
We need to tell the Firebase library we want to _configure_ the project. RNFirebase provides a way to configure both the native and the JavaScript side of the project at the same time with a single command:
|
||||
As the default app is pre-initialized natively there is no need to call `initializeApp` for the default app instance. Just import and go:
|
||||
|
||||
```javascript
|
||||
const firebase = RNFirebase.initializeApp({
|
||||
// config options
|
||||
import firebase from 'react-native-firebase';
|
||||
|
||||
firebase.auth().signInAnonymously()
|
||||
.then((user) => {
|
||||
console.log(user.isAnonymous);
|
||||
});
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
### Configure Default App Instance
|
||||
|
||||
| option | type | Default Value | Description |
|
||||
|----------------|----------|-------------------------|----------------------------------------|
|
||||
| debug | bool | false | When set to true, RNFirebase will log messages to the console and fire `debug` events we can listen to in `js` |
|
||||
| persistence | bool | false | When set to true, database persistence will be enabled. |
|
||||
| errorOnMissingPlayServices | bool | true | (Android only) When set to true, will throw an error if Google Play Services isn't installed. |
|
||||
| promptOnMissingPlayServices | bool | true | (Android only) When set to true, will prompt the user to install Google Play Services if it isn't installed. This takes precedence over `errorOnMissingPlayServices`.|
|
||||
<!-- TODO document elsewhere and place a 'See X link' here-->
|
||||
|
||||
For instance:
|
||||
### Configuring RNFirebase
|
||||
|
||||
```javascript
|
||||
import RNFirebase from 'react-native-firebase';
|
||||
<!-- TODO document elsewhere and place a 'See X link' here-->
|
||||
|
||||
const configurationOptions = {
|
||||
debug: true
|
||||
};
|
||||
|
||||
const firebase = RNFirebase.initializeApp(configurationOptions);
|
||||
|
||||
export default firebase;
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue