Closed
Description
Issue
Got this issue while upgrading react native version to 0.78, i have tried cleaning the project, node_modules, yarn cache and Pods and podfile.lock. Also my AppDelegate.swift has import FirebaseCore
and FirebaseApp.configure()
which i saw were solutions to a similar issue that was reporeted. Could get the app running fine on android.
Project Files
Javascript
Click To Expand
package.json
:
{
"name": "appname",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"lint:fix": "yarn lint -- --fix",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"buildApk": "cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..",
"postinstall": "patch-package",
"cleanProject": "watchman watch-del-all && rm -rf yarn.lock package-lock.json node_modules ios/Pods ios/Podfile.lock android/app/build && npm install && cd ios && pod update && cd .. && npm start -- --reset-cache"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"./src/*.js": [
"yarn format && yarn format:fix && yarn lint"
]
},
"dependencies": {
"@gorhom/bottom-sheet": "^5.1.2",
"@notifee/react-native": "^9.1.8",
"@react-native-async-storage/async-storage": "^2.0.0",
"@react-native-camera-roll/camera-roll": "^7.3.0",
"@react-native-clipboard/clipboard": "^1.16.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native-community/datetimepicker": "^8.0.0",
"@react-native-community/geolocation": "^3.4.0",
"@react-native-community/netinfo": "^11.3.3",
"@react-native-firebase/app": "^21.13.0",
"@react-native-firebase/crashlytics": "^21.13.0",
"@react-native-firebase/messaging": "^21.13.0",
"@react-native-picker/picker": "^2.4.1",
"@react-native/babel-preset": "^0.78.0",
"@react-navigation/bottom-tabs": "^7.3.3",
"@react-navigation/drawer": "^7.3.2",
"@react-navigation/elements": "^2.3.1",
"@react-navigation/material-top-tabs": "^7.2.3",
"@react-navigation/native": "^7.0.19",
"@react-navigation/stack": "^6.3.21",
"@rematch/core": "^2.2.0",
"@rematch/loading": "^2.1.2",
"@rematch/persist": "^2.1.2",
"accordion-collapse-react-native": "^1.1.1",
"axios": "^1.8.4",
"axios-retry": "^4.5.0",
"babel-eslint": "^10.1.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint-plugin-prettier": "^5.2.5",
"eslint-plugin-react-native": "^4.0.0",
"jwt-decode": "3.1.2",
"lodash.debounce": "^4.0.8",
"lodash.groupby": "^4.6.0",
"moment": "^2.29.3",
"patch-package": "^8.0.0",
"payu-non-seam-less-react": "^3.3.0",
"query-string": "^8.1.0",
"react": "19.0.0",
"react-content-loader": "^6.2.1",
"react-hook-form": "^7.49.3",
"react-native": "^0.78.0",
"react-native-app-auth": "^6.4.3",
"react-native-calendars": "^1.1284.0",
"react-native-camera": "^4.2.1",
"react-native-country-flag": "^2.0.2",
"react-native-country-picker-modal": "^2.0.0",
"react-native-device-info": "^10.12.0",
"react-native-drop-shadow": "^1.0.0",
"react-native-fs": "^2.18.0",
"react-native-gesture-handler": "^2.24.0",
"react-native-get-random-values": "^1.8.0",
"react-native-iap": "^12.10.5",
"react-native-image-crop-picker": "^0.42.0",
"react-native-image-picker": "^8.2.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.8.3",
"react-native-localize": "^3.4.1",
"react-native-maps": "^1.20.1",
"react-native-modal": "^14.0.0-rc.1",
"react-native-modal-datetime-picker": "^18.0.0",
"react-native-otp-entry": "^1.8.2",
"react-native-pager-view": "^6.7.0",
"react-native-paper": "5.1.3",
"react-native-permissions": "3.3.1",
"react-native-phone-input": "^1.3.3",
"react-native-popup-menu": "^0.16.1",
"react-native-qrcode-svg": "^6.1.2",
"react-native-reanimated": "^3.17.2",
"react-native-reanimated-carousel": "^3.1.5",
"react-native-safe-area-context": "^5.3.0",
"react-native-screens": "^4.9.2",
"react-native-share": "^12.0.9",
"react-native-simple-toast": "^3.2.0",
"react-native-slider": "^0.11.0",
"react-native-sound-player": "^0.14.5",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^15.11.2",
"react-native-switch-selector": "^2.3.0",
"react-native-tab-view": "^3.1.1",
"react-native-toast-message": "^2.1.5",
"react-native-url-polyfill": "^2.0.0",
"react-native-version-info": "^1.1.1",
"react-native-webview": "^13.13.1",
"react-redux": "8.0.2",
"redux": "^4.2.0",
"update": "^0.7.4",
"uuid": "^9.0.0",
"victory-native": "^36.6.8"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.23.8",
"@babel/runtime": "^7.23.8",
"@react-native/babel-preset": "^0.78.0",
"@react-native/eslint-config": "^0.73.2",
"@react-native/metro-config": "^0.78.0",
"@react-native/typescript-config": "0.74.0",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"lint-staged": "^15.2.0",
"metro": "^0.82.1",
"metro-config": "^0.82.1",
"prettier": "3.2.2",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "19.0.0",
"redux-persist": "^6.0.0",
"typescript": "5.1.6"
},
"jest": {
"preset": "react-native"
}
}
firebase.json
for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile
:
- I'm not using PodsI'm using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym # For Firebase
end
target 'AppName' do
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'RNIap', :path => '../node_modules/react-native-iap'
pod 'TrustKit'
config = use_native_modules!
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
flags = get_default_flags()
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleDataTransport', :modular_headers => true
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'FirebaseInstallations', :modular_headers => true
pod 'nanopb', :modular_headers => true
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'react-native-google-maps', :path => '../node_modules/react-native-maps' # This script is for the google maps if not needed then please skip this one
# <--- FCM(Firebase push notification) setup scripts End
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end
AppDelegate.swift
:
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import RNBootSplash
import FirebaseCore // ⬅️ this
import FirebaseMessaging
@main
class AppDelegate: RCTAppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.moduleName = "AppName"
self.dependencyProvider = RCTAppDependencyProvider()
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = [:]
FirebaseApp.configure() // ⬅️ this
Messaging.messaging().delegate = self
application.registerForRemoteNotifications()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
// ⬇️ override this method
override func customize(_ rootView: RCTRootView!) {
super.customize(rootView)
RNBootSplash.initWithStoryboard("BootSplash", rootView: rootView) // ⬅️ initialize the splash screen
}
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
}
// Add the following function if needed (for firebase)
// MARK: - MessagingDelegate
extension AppDelegate: MessagingDelegate {
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
// // Send token to your server if needed
if let token = fcmToken {
let dataDict: [String: String] = ["token": token]
NotificationCenter.default.post(
name: Notification.Name("FCMToken"),
object: nil,
userInfo: dataDict
)
}
}
}
}
Environment
Click To Expand
react-native info
output:
System:
OS: macOS 15.3.2
CPU: (10) x64 Apple M4
Memory: 36.07 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 23.10.0
path: ~/.nvm/versions/node/v23.10.0/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 10.9.2
path: ~/.nvm/versions/node/v23.10.0/bin/npm
Watchman:
version: 2025.03.10.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.4
- iOS 18.4
- macOS 15.4
- tvOS 18.4
- visionOS 2.4
- watchOS 11.4
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.12816248
Xcode:
version: 16.3/16E140
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.14
path: /usr/bin/javac
Ruby:
version: 3.2.0
path: /.rvm/rubies/ruby-3.2.0/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.78.2
wanted: ^0.78.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
- Platform that you're experiencing the issue on:
- iOSAndroidiOS but have not tested behavior on AndroidAndroid but have not tested behavior on iOSBoth
react-native-firebase
version you're using that has this issue:21.13.0
Firebase
module(s) you're using that has the issue:e.g. crashlytics, messaging
- Are you using
TypeScript
?N
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
mikehardy commentedon Apr 9, 2025
This has been brought up a few times, but I've never reproduced it locally.
I have an automated build script that works every time - something it is doing is missing in your project
https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
Last time someone brought this up, they hadn't properly added their GoogleServices-Info.plist to their project, could be that?
Check the script though, it definitely works. There is no problem with react-native-firebase current and react-native 0.78 and iOS in general, just project-specific problems for some folks
DonovanEnas commentedon Apr 22, 2025
I could get the app Initialized from the script running, but it still doesnt fix my issue @mikehardy
mikehardy commentedon Apr 22, 2025
We're not able to fix every project-specific problem for every project, that's an unrealistic expectation given it's an infinite demand for support on a limited support resource.
We can prove it can work, and we can show you how in a reproducible way - which we have done - and by comparison with your project you can find the integration error in your project
DonovanEnas commentedon Apr 22, 2025
@mikehardy I dont intend so. But i have run the script compared it with my project files (focused more on comparing Pods, Gemfile and AppDelegate, but could not find any major deviations. Are there any more file or areas that u suggest i might need to check?
mikehardy commentedon Apr 22, 2025
Read the entire script, it's well commented, and verify every single item
haddad-yacine commentedon Apr 26, 2025
If you are using
Expo 53
orReact Native 0.79
, you might encounter this issue with React Native Firebase. The problem is that the Firebase plugin is looking for a specific pattern in the AppDelegate.swift file:self.moduleName = "main"
However, in Expo 53, this pattern has been replaced with:
The Firebase plugin uses a regex pattern to find where to insert
FirebaseApp.configure()
, but it can't find the expected pattern in the new AppDelegate structure.Solution:
After running
expo prebuild
, you need to manually addFirebaseApp.configure()
to your AppDelegate.swift file. Add it right before the reactNativeFactory?.startReactNative call:This is a temporary workaround until the Firebase plugin is updated to support the new AppDelegate structure in Expo 53. The issue is in the plugin's regex pattern that's looking for the old structure.
iM-GeeKy commentedon Apr 26, 2025
@haddad-yacine Do you have a patch for this and are you seeing it on Android as well with
Expo 53
andReact Native 0.79
?haddad-yacine commentedon Apr 26, 2025
@iM-GeeKy
No, I only see that in iOS, as I said, I just add the
FirebaseApp.configure()
right before thereactNativeFactory?.startReactNative
call in the AppDelegate.swift file, after doing thenpx expo prebuild --clean
.iM-GeeKy commentedon Apr 26, 2025
@haddad-yacine Okay I'm having some issues on Android with this as well after upgrading to
Expo 53
andReact Native 0.79
. I have been talking with one of the Expo developers and he said sdk 53 introduces the AppDelegate in swift as well as using the RCTReactNativeFactory in all apps. This is a breaking change and third party config plugins will need changes, so that makes sense why iOS may have related issues and tracks with your workaround. It actually looks like there is a merge request for it.haddad-yacine commentedon Apr 26, 2025
@iM-GeeKy I just rechecked the android build, and it's working fine, so it's working in both iOS and Android, just make sure to clean the project before prebuilding, remove node modules and yarn lock file.
iM-GeeKy commentedon Apr 26, 2025
@haddad-yacine I'm not using
expo-prebuild
with my dev client, but I appreciate the heads up 👍🏻hirbod commentedon Apr 28, 2025
The PR #8490 adds auth support, but SDK 53 initialization is still failing for the core package
@react-native-firebase/app
because, as @haddad-yacine correctly pointed out, the AppDelegate.swift has changed and this regexp is failing, thus not addingFirebaseApp.configure()
.You can also see
during the prebuild phase.
The patch is pretty easily done by changing the regular expression to
I'm preparing a PR now.
hirbod commentedon Apr 28, 2025
The PR draft is here:
#8495
A temp patch is here:
markwitt1 commentedon May 19, 2025
Can this issue be closed now as the PR is merged?
benevolentsocialplanner commentedon May 26, 2025
which version should i update package to get rid of the error?
mkhbragg commentedon May 27, 2025
@benevolentsocialplanner it looks like
@react-native-firebase
should work with Expo 53+ as of version22.2.0
(https://github.com/invertase/react-native-firebase/blob/main/CHANGELOG.md#2220-2025-05-12)MichaelVerdon commentedon Jun 10, 2025
Closing this as it looks like its resolved, don't hesitate to reopen this if issues persist. @benevolentsocialplanner always use the latest version available.
HammzaHM commentedon Jul 8, 2025
Hi there, please use this plugin and don't forget to add it in your app.json plugins "plugins": [..., "./with-fix-firebase-plugin"]
mikehardy commentedon Jul 9, 2025
@HammzaHM how is that plugin superior to the plugin for
@react-native-firebase/app
that we include in repo here? And if it's actually fixing something that the in-repo plugin doesn't handle, would you be interested in posting a PR so everyone benefits from an official PR vs a custom code snippet added as a local plugin?HammzaHM commentedon Jul 10, 2025
@mikehardy I agree with you, I will do it.