From 8ed2f51bd523c8d1cb6e187ca8b6ac4a80824515 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Wed, 13 May 2026 08:00:08 -0700 Subject: [PATCH 1/2] RU-T50 Build fix --- plugins/withWebRTCFrameworkFix.js | 36 ++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/plugins/withWebRTCFrameworkFix.js b/plugins/withWebRTCFrameworkFix.js index 81bc27e..3c0a6f0 100644 --- a/plugins/withWebRTCFrameworkFix.js +++ b/plugins/withWebRTCFrameworkFix.js @@ -3,15 +3,18 @@ const fs = require('fs'); const path = require('path'); /** - * Config plugin that patches the Podfile for Xcode 26+ compatibility with - * use_frameworks! :linkage => :static (required by @react-native-firebase). + * Config plugin that patches the Podfile and source files for Xcode 26+ + * compatibility with use_frameworks! :linkage => :static (required by + * @react-native-firebase). * - * Fixes two classes of errors: + * Fixes three classes of errors: * 1. "include of non-modular header inside framework module" — sets * CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES for all pods. * 2. "declaration of 'X' must be imported from module 'Y' before it is required" * — adds use_modular_headers! so #import statements resolve correctly across * framework module boundaries. + * 3. "RCTPromiseRejectBlock must be imported from module 'RNFBApp.RNFBAppModule'" + * — patches RNFBMessaging source files to import RNFBAppModule explicitly. */ const withWebRTCFrameworkFix = (config) => { return withDangerousMod(config, [ @@ -76,6 +79,33 @@ const withWebRTCFrameworkFix = (config) => { } fs.writeFileSync(podfilePath, contents); + + // 3. Patch RNFBMessaging source files to import RNFBAppModule explicitly. + // With use_frameworks! :linkage => :static on Xcode 26, the module + // system requires RNFBMessaging to import RNFBAppModule to access + // RCTPromiseRejectBlock and RCTPromiseResolveBlock. + const projectRoot = config.modRequest.projectRoot; + const appDelegatePath = path.join( + projectRoot, + 'node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.h' + ); + + if (fs.existsSync(appDelegatePath)) { + let appDelegate = fs.readFileSync(appDelegatePath, 'utf-8'); + const rnfbImport = '#import '; + if (!appDelegate.includes(rnfbImport)) { + // Insert after the last #import line. + const lastImportIdx = appDelegate.lastIndexOf('#import'); + const endOfLine = appDelegate.indexOf('\n', lastImportIdx); + appDelegate = + appDelegate.slice(0, endOfLine + 1) + + rnfbImport + + '\n' + + appDelegate.slice(endOfLine + 1); + fs.writeFileSync(appDelegatePath, appDelegate); + } + } + return config; }, ]); From 22ee4769f8cef121561e0488cef45e2780eabbf2 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Wed, 13 May 2026 11:26:14 -0700 Subject: [PATCH 2/2] RU-T50 PR#244 fix --- plugins/withWebRTCFrameworkFix.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/withWebRTCFrameworkFix.js b/plugins/withWebRTCFrameworkFix.js index 3c0a6f0..268c7b1 100644 --- a/plugins/withWebRTCFrameworkFix.js +++ b/plugins/withWebRTCFrameworkFix.js @@ -94,14 +94,20 @@ const withWebRTCFrameworkFix = (config) => { let appDelegate = fs.readFileSync(appDelegatePath, 'utf-8'); const rnfbImport = '#import '; if (!appDelegate.includes(rnfbImport)) { - // Insert after the last #import line. + // Insert after the last #import line, or at the start if none exist. const lastImportIdx = appDelegate.lastIndexOf('#import'); - const endOfLine = appDelegate.indexOf('\n', lastImportIdx); + let insertAt; + if (lastImportIdx === -1) { + insertAt = 0; + } else { + const endOfLine = appDelegate.indexOf('\n', lastImportIdx); + insertAt = endOfLine === -1 ? appDelegate.length : endOfLine + 1; + } appDelegate = - appDelegate.slice(0, endOfLine + 1) + + appDelegate.slice(0, insertAt) + rnfbImport + '\n' + - appDelegate.slice(endOfLine + 1); + appDelegate.slice(insertAt); fs.writeFileSync(appDelegatePath, appDelegate); } }