react-native-firebase
Expo with-An Expo config plugin for paineless setup of react-native-firebase
, without touching any native code!
You can learn more about it here:
- Config Plugins - Expo docs
- Expo Managed Workflow in 2021: part 1, part 2
- How to integrate
react-native-firebase
with Expo
📛 Deprecated
Since React Native Firebase 12.4.0 this plugin is deprecated in favor of built-in plugins. Learn more here.
If you're using @react-native-firebase/app@12.3.0
or older, you may still want to use this plugin.
Installation
Prerequisites:
- App project using Expo SDK 41+.
- Installed
expo-cli@4.4.4
or later. - Installed
react-native-firebase
JavaScript libraries:yarn add @react-native-firebase/app yarn add @react-native-firebase/firestore # ...
expo install
With expo install with-rn-firebase
expo install
Without # using yarn
yarn add with-rn-firebase
# using npm
npm install with-rn-firebase
Open your app.json
and update your plugins
section (expo install
would do it for you):
{
"plugins": ["with-rn-firebase"]
}
Configuration
The plugin needs to know the location of your app's Google Services files generated by Firebase. By default, it searches for them in <project-root>/firebase
directory, but you can put them in any location. You can configure it by setting plugin properties in app.json
:
{
"plugins": [
[
"with-rn-firebase",
{
"androidGoogleServicesPath": "./firebase/google-services.json",
"iosGoogleServicesPath": "./firebase/GoogleServices-Info.plist"
}
]
]
}
The paths should be relative to your project root.
The plugin can also resolve them from traditional Expo config values expo.[ios|android].googleServicesFile
. Be aware that these values are also used by built-in Expo plugins, which shouldn't, but in extreme cases may interfere with this plugin.
Other configuration options
Install Performance Monitoring for Android
In order to install Performance Monitoring on Android, set androidOptions.installPerfMonitoring
to true
:
{
"plugins": [
[
"with-rn-firebase",
{
//...
"androidOptions": {
"installPerfMonitoring": true
}
}
]
]
}
Install Crashlytics for Android
In order to install Crashlytics on Android, set androidOptions.installCrashlytics
to true
:
{
"plugins": [
[
"with-rn-firebase",
{
...
"androidOptions": {
"installCrashlytics": true
}
}
]
]
}
Building and running
You can either:
- use
expo prebuild
orexpo run:android
/expo run:ios
to update your native projects, - use EAS Build to build your development client.
Contributing
Contributions are very welcome! The package uses expo-module-scripts
for most tasks. You can find detailed information at this link.
Please make sure to run yarn build
/yarn rebuild
to update the build
directory before pushing. The CI will fail otherwise.
Credits
- the Expo team
License
MIT