Skip to content

fix(app, expo): SDK 53 config plugin #8500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged

Conversation

hirbod
Copy link
Contributor

@hirbod hirbod commented Apr 29, 2025

Description

Hey @mikehardy, we just talked about it in #8495 and it happened. The template change got merged.

Expo SDK 53.0.1 is already out and I think there is no need to keep the change we merged a couple of hours ago.
I updated the mod. In the future, we could think about using AppDelegate subscriber instead. These dangerous mod are annoying :D

Related issues

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

Screenshot 2025-04-29 at 04 43 03

Think react-native-firebase is great? Please consider supporting the project with any of the below:

Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 2:48am

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the AppDelegate subscriber path does look interesting for the future - in the meantime I'll continue to be grateful folks like yourself keep the config plugin working - thank you

@mikehardy mikehardy merged commit 3d3c4ec into invertase:main Apr 29, 2025
16 checks passed
@hirbod hirbod deleted the patch-1 branch April 29, 2025 04:23
@Kudo
Copy link

Kudo commented Apr 29, 2025

much appreciated for helping the update ❤️

@iM-GeeKy
Copy link

Thanks for the SDK 53 support! When can we expect a release for these changes?

@f5io
Copy link
Contributor

f5io commented Apr 29, 2025

thanks for your work on this @hirbod! looking forward to this dropping imminently 🙌

@compojoom
Copy link
Contributor

@mikehardy would you mind triggering a release with that fix? The latest expo version is now 53.0.1 and I don't think that they treat it as beta anymore.

I patched v22:

diff --git a/plugin/build/ios/appDelegate.js b/plugin/build/ios/appDelegate.js
index c1e95803368b6b6bb1ddf9cdcbdade2a8a91a664..68bc955660961f0d3b833a5f7ff5b160568c3d7d 100644
--- a/plugin/build/ios/appDelegate.js
+++ b/plugin/build/ios/appDelegate.js
@@ -61,7 +61,7 @@ function modifyObjcAppDelegate(contents) {
 }
 function modifySwiftAppDelegate(contents) {
     const methodInvocationBlock = `FirebaseApp.configure()`;
-    const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")/g;
+    const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")|(?:factory\.startReactNative\()/;
     // Add import
     if (!contents.includes('import FirebaseCore')) {
         contents = contents.replace(/import Expo/g, `import Expo
diff --git a/plugin/src/ios/appDelegate.ts b/plugin/src/ios/appDelegate.ts
index e611cd3e28832349a034a74df1728263a1797efb..b87fd7a3e3bfd4f7635758f409fdfc25413ac7c6 100644
--- a/plugin/src/ios/appDelegate.ts
+++ b/plugin/src/ios/appDelegate.ts
@@ -70,7 +70,7 @@ export function modifyObjcAppDelegate(contents: string): string {
 
 export function modifySwiftAppDelegate(contents: string): string {
   const methodInvocationBlock = `FirebaseApp.configure()`;
-  const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")/g;
+  const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")|(?:factory\.startReactNative\()/;
 
   // Add import
   if (!contents.includes('import FirebaseCore')) {

And was able to get firebase now working once I ran npx expo prebuild -p ios --clean. Thanks @hirbod !

@mikehardy
Copy link
Collaborator

Sure @compojoom - have another couple merges I want to get in quickly then can trigger a release

@mikehardy
Copy link
Collaborator

@compojoom @iM-GeeKy @f5io @hirbod this is releasing right now - thanks again for the care+attention on the Expo plugins, always appreciated

@mikehardy
Copy link
Collaborator

Note that you'll need Xcode 16.2+ for the current version of react-native-firebase, apparently this is how to make it work on EAS

#8503 (comment)

In my case no extra flags or prebuild changes necessary. Simply use the latest image (in eas.json) something like this:
"build": { "base": { "ios": { "image": "latest" } }, and the build worked fine.

@evelant
Copy link

evelant commented Apr 30, 2025

Attempting to update my app to expo 53, I installed rnfirebase 22.1.0 with expo 53.0.3 and the app isn't initialized. Did expo change things yet again that broke the config plugin?

ios: @react-native-firebase/app: Unable to determine correct Firebase insertion point in AppDelegate.swift. Skipping Firebase addition.

edit: nevermind 🤦 I still had 22.0.0 installed. 22.1.0 works fine.

@a-eid
Copy link

a-eid commented May 1, 2025

I think app-check plugin has the same issue. we're getting this error thrown when using it with expo 53.

Cannot add Firebase code to AppDelegate of language "Swift"

@hirbod
Copy link
Contributor Author

hirbod commented May 2, 2025

The app-check plugin doesn't even support the new Swift App Delegate File at all. Supporting it shouldn't be hard, most stuff can be copy pasted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants