From a3ed822bf49fa751485119d991876c9e12d1c9d9 Mon Sep 17 00:00:00 2001 From: Gauvain Date: Fri, 29 May 2026 08:20:05 +0200 Subject: [PATCH] test(ios): use_modular_headers! for legacy pods after dropping useFrameworks Without useFrameworks:static, old Obj-C pods (react-native-udp -> ) lose the React umbrella header. use_modular_headers! restores module header maps so 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] --- app.json | 1 + plugins/withModularHeaders.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 plugins/withModularHeaders.js diff --git a/app.json b/app.json index 6caffc47..083b9c60 100644 --- a/app.json +++ b/app.json @@ -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"], diff --git a/plugins/withModularHeaders.js b/plugins/withModularHeaders.js new file mode 100644 index 00000000..24d22123 --- /dev/null +++ b/plugins/withModularHeaders.js @@ -0,0 +1,24 @@ +const { withPodfile } = require("expo/config-plugins"); + +// Without `useFrameworks: static`, older Obj-C pods that do `#import ` +// (e.g. react-native-udp's UdpSockets.m -> ) can't resolve the +// React umbrella. `use_modular_headers!` restores module-style header maps for all +// pods so resolves again. Inserted at the top of the main target. +const MARKER = "use_modular_headers! # streamyfin: 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; + }); +};