mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-03 22:48:36 +08:00
[skip ci] docs
This commit is contained in:
11
docs/config/android.md
Normal file
11
docs/config/android.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Android Setup
|
||||
description: Manually integrate Remote Config into your Android application.
|
||||
---
|
||||
|
||||
# Android Setup
|
||||
|
||||
> The following steps are only required if your environment does not have access to React Native
|
||||
auto-linking.
|
||||
|
||||
## TODO
|
||||
52
docs/config/index.md
Normal file
52
docs/config/index.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: Remote Config
|
||||
description: Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update.
|
||||
---
|
||||
|
||||
# Performance Monitoring
|
||||
|
||||
React Native Firebase provides native integration with Remote Config, allowing you to change the appearance
|
||||
and/or functionality of your app without requiring an app update. Remote Config values added into the Firebase
|
||||
console are accessible via a JavaScript API, giving you full control over when and how these are applied and take
|
||||
effect within your application.
|
||||
|
||||
<Youtube id="_CXXVFPO6f0" />
|
||||
|
||||
## Getting Started
|
||||
|
||||
<Grid>
|
||||
<Block
|
||||
icon="build"
|
||||
color="#ffc107"
|
||||
title="Quick Start"
|
||||
to="/{{ version }}/config/quick-start"
|
||||
>
|
||||
Install & begin integrating your Remote Config settings into your application.
|
||||
</Block>
|
||||
<Block
|
||||
icon="school"
|
||||
color="#4CAF50"
|
||||
title="Guides"
|
||||
to="/guides?tag=config"
|
||||
>
|
||||
Remote Config has a wide range of use-cases. Our guides cover various scenarios on how to integrate it into your
|
||||
application with real-world application.
|
||||
</Block>
|
||||
<Block
|
||||
icon="layers"
|
||||
color="#03A9F4"
|
||||
title="Reference"
|
||||
to="/{{ version }}/config/reference"
|
||||
>
|
||||
The API reference covers everything required to successfully intgerate Remote Config into your apps.
|
||||
</Block>
|
||||
</Grid>
|
||||
|
||||
## Learn more
|
||||
|
||||
Our documentation is a great place to start, however if you're looking for more help or want to help others,
|
||||
check out the resources below:
|
||||
|
||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native-firebase-config)
|
||||
- [Github Issues](https://github.com/invertase/react-native-firebase/issues?utf8=%E2%9C%93&q=is%3Aissue+sort%3Aupdated-desc+label%3Aconfig+)
|
||||
- [Firebase Documentation](https://firebase.google.com/docs/perf-mon?utm_source=invertase&utm_medium=react-native-firebase&utm_campaign=config)
|
||||
11
docs/config/ios.md
Normal file
11
docs/config/ios.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: iOS Setup
|
||||
description: Manually integrate Remote Config into your iOS application.
|
||||
---
|
||||
|
||||
# iOS Setup
|
||||
|
||||
> The following steps are only required if your environment does not have access to React Native
|
||||
auto-linking.
|
||||
|
||||
## TODO
|
||||
84
docs/config/quick-start.md
Normal file
84
docs/config/quick-start.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: Quick Start
|
||||
description: Get to grips with the basics of Remote Config in React Native Firebase
|
||||
---
|
||||
|
||||
# Remote Config Quick Start
|
||||
|
||||
## Installation
|
||||
|
||||
Install this module with Yarn:
|
||||
|
||||
```bash
|
||||
yarn add @react-native-firebase/config
|
||||
```
|
||||
|
||||
> Integrating manually and not via React Native auto-linking? Check the setup instructions for <Anchor version group href="/android">Android</Anchor> & <Anchor version group href="/ios">iOS</Anchor>.
|
||||
|
||||
## Module usage
|
||||
|
||||
Import the Performance Monitoring package into your project:
|
||||
|
||||
```js
|
||||
import config from '@react-native-firebase/config';
|
||||
```
|
||||
|
||||
The package also provides access to the firebase instance:
|
||||
|
||||
```js
|
||||
import { firebase } from '@react-native-firebase/config';
|
||||
```
|
||||
|
||||
### Fetching, activating and getting values
|
||||
|
||||
Before the values from the Firebase console can be used, they need to be fetched and activated. This can be done using
|
||||
the `fetchAndActivate` method:
|
||||
|
||||
```js
|
||||
import config from '@react-native-firebase/config';
|
||||
|
||||
async function getValues() {
|
||||
try {
|
||||
const activated = await config().fetchAndActivate();
|
||||
|
||||
if (activated) {
|
||||
const experimentalFeatureEnabled = await config().getValue('experiment');
|
||||
console.log('Experimental source: ', experimentalFeatureEnabled.source);
|
||||
console.log('Experimental value: ', experimentalFeatureEnabled.value);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Setting default values
|
||||
|
||||
In some cases you may want to fetch values from the console in the background without the process visibly impacting
|
||||
your application. To prevent any race conditions where values are being requested (i.e. via `getValue`) before they
|
||||
have been fetched and activated, it is recommended you set default values using `setDefaults`:
|
||||
|
||||
```js
|
||||
import config from '@react-native-firebase/config';
|
||||
|
||||
async function bootstrap() {
|
||||
await config().setDefaults({
|
||||
experiment: false,
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Developer mode
|
||||
|
||||
Whilst developing, setting the developer mode to `true` allows config to bypass internal checks such as caching
|
||||
which are applied in a production application. This can be done with the `setConfigSettings` method:
|
||||
|
||||
```js
|
||||
import config from '@react-native-firebase/config';
|
||||
|
||||
async function bootstrap() {
|
||||
await config().setConfigSettings({
|
||||
isDeveloperModeEnabled: __DEV__,
|
||||
});
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user