test(ios): use_modular_headers! for legacy pods after dropping useFrameworks

Without useFrameworks:static, old Obj-C pods (react-native-udp -> <React/RCTAssert.h>) lose the React umbrella header. use_modular_headers! restores module header maps so <React/...> resolves for udp and any other legacy pod, in one shot. SwiftUICore already gone (build #5). udp is abandoned (4.1.7, 2023) with no drop-in replacement, so patching headers beats replacing it. [unsigned: GPG]
This commit is contained in:
Gauvain
2026-05-29 08:20:05 +02:00
parent f8414194f0
commit a3ed822bf4
2 changed files with 25 additions and 0 deletions

View File

@@ -131,6 +131,7 @@
],
"expo-web-browser",
["./plugins/with-runtime-framework-headers.js"],
["./plugins/withModularHeaders.js"],
["./plugins/withChangeNativeAndroidTextToWhite.js"],
["./plugins/withAndroidAlertColors.js"],
["./plugins/withAndroidManifest.js"],

View File

@@ -0,0 +1,24 @@
const { withPodfile } = require("expo/config-plugins");
// Without `useFrameworks: static`, older Obj-C pods that do `#import <React/...>`
// (e.g. react-native-udp's UdpSockets.m -> <React/RCTAssert.h>) can't resolve the
// React umbrella. `use_modular_headers!` restores module-style header maps for all
// pods so <React/...> resolves again. Inserted at the top of the main target.
const MARKER = "use_modular_headers! # streamyfin: <React/...> for legacy pods";
module.exports = function withModularHeaders(config) {
return withPodfile(config, (config) => {
let podfile = config.modResults.contents;
if (!podfile.includes(MARKER)) {
podfile = podfile.replace(
/^(target\s+['"][^'"]+['"]\s+do)\s*$/m,
(match) => `${match}\n ${MARKER}`,
);
config.modResults.contents = podfile;
console.log("✅ withModularHeaders: use_modular_headers! injected");
}
return config;
});
};