Skip to content

Commit de2503b

Browse files
authored
docs(app): install doc preening (#8420)
* docs(app): fix heading levels and internal anchor in Expo section - headings increased by 2 from h2 to h4, should go one step at a time - internal anchor was incorrect for CLI projects * docs(app): drop install guidance for outdated react-native versions - gradle 7.3+ has been default for quite some time - multidex is not valid on android minSdk level in place for quite some time - hermes works fine now and has for quite some time - android build memory we suggested as a fix has been default fo rquite some time - manual linking is history from another era * docs(app): add language specifiers to fenced code blocks suggested by lint
1 parent 31e9239 commit de2503b

File tree

1 file changed

+9
-45
lines changed

1 file changed

+9
-45
lines changed

docs/index.md

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,19 @@ Integration with Expo is possible when using a [development build](https://docs.
2626

2727
_NOTE:_ React Native Firebase cannot be used in the pre-compiled [Expo Go app](https://docs.expo.dev/workflow/overview/#expo-go-an-optional-tool-for-learning) because React Native Firebase uses native code that is not compiled into Expo Go.
2828

29-
#### Your Expo project
30-
3129
To create a new Expo project, see the [Get started](https://docs.expo.dev/get-started/create-a-project/) guide in Expo documentation.
3230

33-
#### Install React Native Firebase modules
31+
### Install React Native Firebase modules
3432

3533
To install React Native Firebase's base `app` module, use the command `npx expo install @react-native-firebase/app`.
3634

3735
Similarly you can install other React Native Firebase modules such as for Authentication and Crashlytics: `npx expo install @react-native-firebase/auth @react-native-firebase/crashlytics`.
3836

39-
#### Configure React Native Firebase modules
37+
### Configure React Native Firebase modules
4038

4139
The recommended approach to configure React Native Firebase is to use [Expo Config Plugins](https://docs.expo.dev/config-plugins/introduction/). You will add React Native Firebase modules to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`. See the note below to determine which modules require Config Plugin configurations.
4240

43-
If you are instead manually adjusting your Android and iOS projects (this is not recommended), follow the same instructions as [React Native CLI projects](#installation-for-react-native-cli-projects).
41+
If you are instead manually adjusting your Android and iOS projects (this is not recommended), follow the same instructions as [React Native CLI projects](#Installation for React Native CLI (non-Expo) projects).
4442

4543
To enable Firebase on the native Android and iOS platforms, create and download Service Account files for each platform from your Firebase project. Then provide paths to the downloaded `google-services.json` and `GoogleService-Info.plist` files in the following `app.json` fields: [`expo.android.googleServicesFile`](https://docs.expo.io/versions/latest/config/app/#googleservicesfile-1) and [`expo.ios.googleServicesFile`](https://docs.expo.io/versions/latest/config/app/#googleservicesfile). See the example configuration below.
4644

@@ -78,13 +76,13 @@ The following is an example `app.json` to enable the React Native Firebase modul
7876

7977
> Listing a module in the Config Plugins (the `"plugins"` array in the JSON above) is only required for React Native Firebase modules that involve _native installation steps_ - e.g. modifying the Xcode project, `Podfile`, `build.gradle`, `AndroidManifest.xml` etc. React Native Firebase modules without native steps will work out of the box; no `"plugins"` entry is required. Not all modules have Expo Config Plugins provided yet. A React Native Firebase module has Config Plugin support if it contains an `app.plugin.js` file in its package directory (e.g.`node_modules/@react-native-firebase/app/app.plugin.js`).
8078
81-
#### Local app compilation
79+
### Local app compilation
8280

8381
If you are compiling your app locally, run [`npx expo prebuild --clean`](https://docs.expo.dev/workflow/prebuild/) to generate the native project directories. Then, follow the local app compilation steps described in [Local app development](https://docs.expo.dev/guides/local-app-development/) guide in Expo docs. If you prefer using a build service, refer to [EAS Build](https://docs.expo.dev/build/setup/).
8482

8583
Note that if you have already installed the `Expo Go` app (using something like `npx expo run` instead of doing the `--prebuild` local development steps...) then you must uninstall it first. The `Expo Go` app does not contain most non-Expo native modules like react-native-firebase, and you will see errors related to the native modules not being loaded if you try to use it.
8684

87-
#### Expo Tools for VSCode
85+
### Expo Tools for VSCode
8886

8987
If you are using the [Expo Tools](https://marketplace.visualstudio.com/items?itemName=expo.vscode-expo-tools) VSCode extension, the IntelliSense will display a list of available plugins when editing the `plugins` section of `app.json`.
9088

@@ -138,8 +136,6 @@ First, add the `google-services` plugin as a dependency inside of your `/android
138136
buildscript {
139137
dependencies {
140138
// ... other dependencies
141-
// NOTE: if you are on react-native 0.71 or below, you must not update
142-
// the google-services plugin past version 4.3.15 as it requires gradle >= 7.3.0
143139
classpath 'com.google.gms:google-services:4.4.2'
144140
// Add me --- /\
145141
}
@@ -182,13 +178,13 @@ To do this, open your `/ios/{projectName}/AppDelegate.swift` file and add the fo
182178

183179
At the top of the file, import the Firebase SDK right after `'import ReactAppDependencyProvider'`:
184180

185-
```
181+
```swift
186182
import Firebase
187183
```
188184

189185
Within your existing `didFinishLaunchingWithOptions` method, add the following to the top of the method:
190186

191-
```
187+
```swift
192188
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
193189
// Add me --- \/
194190
FirebaseApp.configure()
@@ -205,13 +201,13 @@ To do this, open your `/ios/{projectName}/AppDelegate.mm` file (or `AppDelegate.
205201

206202
At the top of the file, import the Firebase SDK right after `'#import "AppDelegate.h"'`:
207203

208-
```
204+
```objectivec
209205
#import <Firebase.h>
210206
```
211207

212208
Within your existing `didFinishLaunchingWithOptions` method, add the following to the top of the method:
213209

214-
```
210+
```objectivec
215211
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
216212
// Add me --- \/
217213
[FIRApp configure];
@@ -263,11 +259,6 @@ npx react-native run-ios
263259

264260
Once successfully linked and rebuilt, your application will be connected to Firebase using the `@react-native-firebase/app` module. This module does not provide much functionality, therefore to use other Firebase services, each of the modules for the individual Firebase services need installing separately.
265261

266-
#### Manual Linking
267-
268-
If you're using an older version of React Native without autolinking support, or wish to integrate into an existing project,
269-
you can follow the manual installation steps for [iOS](/install-ios) and [Android](/install-android).
270-
271262
---
272263

273264
## Other / Web
@@ -298,20 +289,6 @@ const firebaseApp = getApp();
298289

299290
## Miscellaneous
300291

301-
### Android Enabling Multidex
302-
303-
As your application starts to grow with more native dependencies, your builds may start to fail with the common
304-
`Execution failed for task ':app:mergeDexDebug'` error. This error occurs when Android reaches the
305-
[64k methods](https://developer.android.com/studio/build/multidex) limit.
306-
307-
One common solution is to [enable multidex](/enabling-multidex) support for Android. This is a common solution to solving
308-
the problem, however it is recommended you read the Android documentation to understand how it may impact your application.
309-
310-
### Hermes Support
311-
312-
To support the [Hermes](https://hermesengine.dev/) JavaScript engine, React Native 0.64.0 or newer is required.
313-
However, we cannot guarantee that React Native Firebase works perfectly on it, so please test your project carefully.
314-
315292
### Overriding Native SDK Versions
316293

317294
React Native Firebase internally sets the versions of the native SDKs which each module uses. Each release of the library
@@ -363,19 +340,6 @@ Once changed, reinstall your projects pods via pod install and rebuild your proj
363340

364341
Alternatively, if you cannot edit the Podfile easily (as when using Expo), you may add the environment variable `FIREBASE_SDK_VERSION=11.10.0` (or whatever version you need) to the command line that installs pods. For example `FIREBASE_SDK_VERSION=11.10.0 yarn expo prebuild --clean`
365342

366-
### Increasing Android build memory
367-
368-
As you add more Firebase modules, there is an incredible demand placed on the Android build system, and the default memory
369-
settings will not work. To avoid `OutOfMemory` errors during Android builds, you should uncomment the alternate Gradle memory
370-
setting present in `/android/gradle.properties`:
371-
372-
```
373-
# Specifies the JVM arguments used for the daemon process.
374-
# The setting is particularly useful for tweaking memory settings.
375-
# Default value: -Xmx10248m -XX:MaxPermSize=256m
376-
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
377-
```
378-
379343
### Android Performance
380344

381345
On Android, React Native Firebase uses [thread pool executor](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor) to provide improved performance and managed resources.

0 commit comments

Comments
 (0)