Skip to content

Commit 8b7fc94

Browse files
authored
style(docs): format documentation using prettier (#5302)
1 parent 87840c3 commit 8b7fc94

File tree

22 files changed

+142
-202
lines changed

22 files changed

+142
-202
lines changed

docs/analytics/usage/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ and use of Firebase Analytics without needing the App Tracking Transparency hand
153153
of your app handle data in a way that requires ATT)
154154

155155
Note that for obvious reasons, configuring Firebase Analytics for use without IDFA is incompatible with AdMob
156+
156157
# firebase.json
157158

158159
## Disable Auto-Initialization

docs/app/json-config.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ previous: /app/usage
88
You can configure the modules creating a file named `firebase.json` at the root of your project directory.
99

1010
## JSON Schema
11+
1112
Add the Config Schema to your `firebase.json` file to use the Editor Intellisense
1213

1314
```json
1415
{
15-
"$schema":"./node_modules/@react-native-firebase/app/firebase-schema.json"
16+
"$schema": "./node_modules/@react-native-firebase/app/firebase-schema.json"
1617
}
1718
```

docs/app/usage.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,29 @@ await firebase.initializeApp(credentials, config);
5959
Note that if you use multiple platforms, you will need to use the credentials relevant to that platform:
6060

6161
```js
62-
import firebase from "@react-native-firebase/app";
63-
import { Platform } from "react-native";
62+
import firebase from '@react-native-firebase/app';
63+
import { Platform } from 'react-native';
6464

6565
// Your secondary Firebase project credentials for Android...
6666
const androidCredentials = {
67-
clientId: "",
68-
appId: "",
69-
apiKey: "",
70-
databaseURL: "",
71-
storageBucket: "",
72-
messagingSenderId: "",
73-
projectId: "",
67+
clientId: '',
68+
appId: '',
69+
apiKey: '',
70+
databaseURL: '',
71+
storageBucket: '',
72+
messagingSenderId: '',
73+
projectId: '',
7474
};
7575

7676
// Your secondary Firebase project credentials for iOS...
7777
const iosCredentials = {
78-
clientId: "",
79-
appId: "",
80-
apiKey: "",
81-
databaseURL: "",
82-
storageBucket: "",
83-
messagingSenderId: "",
84-
projectId: "",
78+
clientId: '',
79+
appId: '',
80+
apiKey: '',
81+
databaseURL: '',
82+
storageBucket: '',
83+
messagingSenderId: '',
84+
projectId: '',
8585
};
8686

8787
// Select the relevant credentials
@@ -91,7 +91,7 @@ const credentials = Platform.select({
9191
});
9292

9393
const config = {
94-
name: "SECONDARY_APP",
94+
name: 'SECONDARY_APP',
9595
};
9696

9797
await firebase.initializeApp(credentials, config);

docs/auth/phone-auth.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@ Enter a new phone number (e.g. `+44 7444 555666`) and a test code (e.g. `123456`
9393
Once added, the number can be used with the `signInWithPhoneNumber` method, and entering the code specified will
9494
cause a successful sign-in.
9595

96-
9796
# MFA-like Account Creation
9897

9998
After successfully creating a user with an email and password (see Authentication/Usage/Email/Password sign-in), use the `verifyPhoneNumber` method to send a verification code to a user's phone number and if the user enters the correct code, link the phone number to the authenticated user's account. This creates a MFA-like authentication flow for account creation. However, to implement MFA with firebase, your app must call additional methods and use Google Cloud Identity Platform, which is a paid service, details available in this guide https://cloud.google.com/identity-platform/docs/web/mfa
10099

101100
```jsx
102-
import React, {useState, useEffect} from 'react';
103-
import {Button, TextInput, Text} from 'react-native';
101+
import React, { useState, useEffect } from 'react';
102+
import { Button, TextInput, Text } from 'react-native';
104103
import auth from '@react-native-firebase/auth';
105104

106105
export default function PhoneVerification() {
@@ -127,10 +126,7 @@ export default function PhoneVerification() {
127126
// Handle create account button press
128127
async function createAccount() {
129128
try {
130-
await auth().createUserWithEmailAndPassword(
131-
132-
'SuperSecretPassword!',
133-
);
129+
await auth().createUserWithEmailAndPassword('[email protected]', 'SuperSecretPassword!');
134130
console.log('User account created & signed in!');
135131
} catch (error) {
136132
if (error.code === 'auth/email-already-in-use') {
@@ -153,10 +149,7 @@ export default function PhoneVerification() {
153149
// Handle confirm code button press
154150
async function confirmCode() {
155151
try {
156-
const credential = auth.PhoneAuthProvider.credential(
157-
confirm.verificationId,
158-
code,
159-
);
152+
const credential = auth.PhoneAuthProvider.credential(confirm.verificationId, code);
160153
let userData = await auth().currentUser.linkWithCredential(credential);
161154
setUser(userData.user);
162155
} catch (error) {
@@ -177,9 +170,7 @@ export default function PhoneVerification() {
177170
return (
178171
<Button
179172
title="Verify Phone Number"
180-
onPress={() =>
181-
verifyPhoneNumber('ENTER A VALID TESTING OR REAL PHONE NUMBER HERE')
182-
}
173+
onPress={() => verifyPhoneNumber('ENTER A VALID TESTING OR REAL PHONE NUMBER HERE')}
183174
/>
184175
);
185176
}

docs/auth/social-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Ensure the "Google" sign-in provider is enabled on the [Firebase Console](https:
211211
Follow [these](https://github.com/react-native-google-signin/google-signin#project-setup-and-initialization) instructions to install and setup `google-signin`
212212

213213
Before triggering a sign-in request, you must initialize the Google SDK using your any required scopes and the
214-
`webClientId`, which can be found in the `android/app/google-services.json` file as the `client/oauth_client/client_id` property (the id ends with `.apps.googleusercontent.com`). Make sure to pick the `client_id` with `client_type: 3`
214+
`webClientId`, which can be found in the `android/app/google-services.json` file as the `client/oauth_client/client_id` property (the id ends with `.apps.googleusercontent.com`). Make sure to pick the `client_id` with `client_type: 3`
215215

216216
```js
217217
import { GoogleSignin } from '@react-native-google-signin/google-signin';

docs/database/usage/index.md

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ function User({ userId }) {
106106
});
107107

108108
// Stop listening for updates when no longer required
109-
return () =>
110-
database()
111-
.ref(`/users/${userId}`)
112-
.off('value', onValueChange);
109+
return () => database().ref(`/users/${userId}`).off('value', onValueChange);
113110
}, [userId]);
114111
}
115112
```
@@ -136,10 +133,7 @@ function User({ userId }) {
136133
});
137134

138135
// Stop listening for updates when no longer required
139-
return () =>
140-
database()
141-
.ref('/users')
142-
.off('child_added', onChildAdd);
136+
return () => database().ref('/users').off('child_added', onChildAdd);
143137
}, [userId]);
144138
}
145139
```
@@ -169,10 +163,7 @@ and Firebase will automatically order the results. The example below would retur
169163
* }
170164
*/
171165

172-
const scores = database()
173-
.ref('scores')
174-
.orderByValue()
175-
.once('value');
166+
const scores = database().ref('scores').orderByValue().once('value');
176167
```
177168

178169
Please note that the ordering will not be respected if you do not use the `forEach` method provided on the `DataSnapshot`.
@@ -183,22 +174,15 @@ You can limit the number of results returned from a query by using one of the `l
183174
first 10 results:
184175

185176
```js
186-
const users = database()
187-
.ref('users')
188-
.limitToFirst(10)
189-
.once('value');
177+
const users = database().ref('users').limitToFirst(10).once('value');
190178
```
191179

192180
Firebase also provides the ability to return the last set of results in a query via the `limitToLast` method.
193181

194182
Instead of limiting to a specific number of documents, you can also start from, or end at a specific reference node value:
195183

196184
```js
197-
await database()
198-
.ref('users')
199-
.orderByChild('age')
200-
.startAt(21)
201-
.once('value');
185+
await database().ref('users').orderByChild('age').startAt(21).once('value');
202186
```
203187

204188
## Writing data
@@ -251,9 +235,7 @@ sent to remote Firebase database.
251235
The `push` method will automatically generate a new key if one is not provided:
252236

253237
```js
254-
const newReference = database()
255-
.ref('/users')
256-
.push();
238+
const newReference = database().ref('/users').push();
257239

258240
console.log('Auto generated key: ', newReference.key);
259241

@@ -272,17 +254,13 @@ sorted by default.
272254
To remove data, you can call the `remove` method on a reference:
273255

274256
```js
275-
await database()
276-
.ref('/users/123')
277-
.remove();
257+
await database().ref('/users/123').remove();
278258
```
279259

280260
Optionally, you can also set the value of a reference node to `null` to remove it from the database:
281261

282262
```js
283-
await database()
284-
.ref('/users/123')
285-
.set(null);
263+
await database().ref('/users/123').set(null);
286264
```
287265

288266
## Transactions
@@ -330,8 +308,10 @@ It is important that you understand how to write rules in your Firebase console
330308
Please follow the Firebase Realtime Database documentation on [security](https://firebase.google.com/docs/database/security)
331309

332310
# Using Emulator
311+
333312
The Realtime Database currently has no direct support to use Firebase emulator, meaning that there is no "useEmulator" function to be used.
334313
To use Firebase emulator with Realtime Database, please, refer to "Using a secondary database section" or use approach from the code snippet below:
314+
335315
```
336316
// databaseWrapper.js
337317
import {firebase} from '@react-native-firebase/database';
@@ -343,7 +323,7 @@ class DatabaseWrapper {
343323
this.database = firebase.app().database("http://localhost:9000?ns=YOUR_EMULATOR_DATABASE_NAME");
344324
} else {
345325
this.database = firebase.app().database("http://yourProductionUrl?ns=YOUR_PRODUCTION_DATABASE_NAME");
346-
}
326+
}
347327
}
348328
}
349329
export const RealtimeDatabase = new DatabaseWrapper();

docs/dynamic-links/usage/index.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ To setup Dynamic Links on iOS, it is a **prerequisite** that you have an Apple d
7474

7575
### Dynamic Links With Custom Domains
7676

77-
If you have set up a [custom domain](https://firebase.google.com/docs/dynamic-links/custom-domains) for your Firebase project, you must add the dynamic link URL prefix into your iOS project's `info.plist` file by using the `FirebaseDynamicLinksCustomDomains` key. You can add multiple URLs as well.
77+
If you have set up a [custom domain](https://firebase.google.com/docs/dynamic-links/custom-domains) for your Firebase project, you must add the dynamic link URL prefix into your iOS project's `info.plist` file by using the `FirebaseDynamicLinksCustomDomains` key. You can add multiple URLs as well.
7878

7979
Example:
8080

@@ -88,9 +88,9 @@ Example:
8888
<string>https://custom.domain.io/bla</string>
8989
<string>https://custom.domain.io/bla2</string>
9090
</array>
91-
91+
9292
...other settings
93-
93+
9494
</dict>
9595
</plist>
9696
```
@@ -143,7 +143,6 @@ The iOS Notes app is a good place to paste your dynamic link and test it opens y
143143

144144
2. Test the domain you created in your Firebase console (first step in `Firebase Setup`). Go to the following location in your browser `[your-domain]/.well-known/assetlinks.json`. The response will have a `target` object containing a `package_name` which ought to have your app's package name. Please
145145
do not proceed until you see this, it may take a while to register.
146-
147146
3. Add your domains to the android/app/src/main/AndroidManifest.xml so that your app knows what links to open in the app. Refer to [the official docs](https://firebase.google.com/docs/dynamic-links/android/receive#add-an-intent-filter-for-deep-links) for example code.
148147

149148
4. Test the dynamic link works via your emulator by pasting it into in a text message, notepad or email, and checking that it does open your application (ensure the app is installed on the emulator).

docs/faqs-and-tips.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ The longer you stay on v5, the more your project will be out of sync with the of
2020

2121
We highly recommend taking the necessary pains to update to v6.
2222

23-
### My CI build hangs at the "Running script '[CP-User] [RNFB] Core Configuration'" step.
23+
### My CI build hangs at the "Running script '[CP-User] [RNFB] Core Configuration'" step.
2424

25-
This may be fixed by creating a `firebase.json` file at the root of your project if it's not there already. If you don't want to change any of the default React Native Firebase configurations, you can leave it empty in the following way:
25+
This may be fixed by creating a `firebase.json` file at the root of your project if it's not there already. If you don't want to change any of the default React Native Firebase configurations, you can leave it empty in the following way:
2626

2727
```
2828
{
@@ -31,26 +31,26 @@ This may be fixed by creating a `firebase.json` file at the root of your project
3131
}
3232
```
3333

34-
3534
### I have a custom Analytics parameter called 'items' and it's not showing up on the Firebase console. How come?
3635

3736
This happens to be a known problem with the upstream Analytics SDKs. The Firebase team doesn't have any plans to fix it soon. More information about this can be found [here](https://github.com/invertase/react-native-firebase/issues/4018#issuecomment-682174087).
3837

39-
4038
### I'm receiving `InternalFirebaseAuth.FIREBASE_AUTH_API is not available on this device`. How do I fix this?
4139

4240
To use some Firebase services (like auth) in an emulator, you need an Android virtual device with Google Play services installed. Check this [Stack Overflow post](https://stackoverflow.com/a/46246782/2275865) for instructions on creating a new Android virtual device with the necessary APIs installed.
4341

4442
### I'm getting an SIGABRT error in Xcode when faking a crash on iOS. How do I fix this?
4543

46-
When you get an error on this line when faking a crash on iOS:
44+
When you get an error on this line when faking a crash on iOS:
45+
4746
```
4847
RCT_EXPORT_METHOD(crash) {
4948
if ([RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled]) {
5049
assert(NO);
5150
}
5251
}
5352
```
53+
5454
Just disable your debugger in Xcode. 'Project name' -> 'Edit Scheme...' -> 'Run' -> deselect "Debug executable"
5555

5656
### I have the latest SDK installed, but I can't send a test in app message from the console. How do I fix this?

docs/firestore/emulator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const db = firestore();
3535

3636
// set the host property to connect to the emulator
3737
// set these before any read/write operations occur to ensure it doesn't affect your Cloud Firestore data!
38-
db.settings({ host: 'localhost:8080', ssl: false });
38+
db.settings({ host: 'localhost:8080', ssl: false });
3939
```
4040
4141
# Clear locally stored emulator data

0 commit comments

Comments
 (0)