From 6d0612c27ca8a4d828cdcb156f9f4e92cca96865 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Mon, 27 Jul 2026 11:04:05 -0700 Subject: [PATCH] fix(rn-tester): use framework-style import for RCTFabricComponentsPlugins.h (#57697) Summary: rn-tester's `MyNativeView` example imports `RCTFabricComponentsPlugins.h`. The quoted form resolves under CocoaPods (the bare filename is re-vended via `FACADE_REEXPOSED_HEADERS` in `rncore_facades.rb`) and under the internal Meta build (the per-target header generated by buck's `plugins_header`), but not under SwiftPM. Under SwiftPM the header is exposed as an include directory, so only `` resolves. The quoted import makes `MyNativeView` fail to compile when rn-tester is converted to SwiftPM (surfaced by the new SPM CI lane in https://github.com/react/react-native/issues/57659), and switching to the angle form alone would instead break the internal build. The fix uses a `__has_include` conditional: the angle form when it is available (SwiftPM and CocoaPods) with the quoted form as a fallback (the internal build). This matches the existing pattern in rn-tester's own `NativeCxxModuleExample.h` and keeps all three build stacks compiling. ## Changelog: [INTERNAL] [FIXED] - Make rn-tester's NativeComponentExample header import resolve under SwiftPM, CocoaPods and the internal build Pull Request resolved: https://github.com/react/react-native/pull/57697 Test Plan: - Repro on clean `main`: converting rn-tester to SwiftPM (`spm add --deintegrate`) and building fails at `RNTMyNativeViewComponentView.mm` with `fatal error: 'RCTFabricComponentsPlugins.h' file not found`. - With this change: the same SwiftPM conversion plus `xcodebuild -configuration Debug -sdk iphonesimulator` gives `BUILD SUCCEEDED`. - Internal build: `buck2 build fbsource//xplat/js/react-native-github/packages/rn-tester:NativeComponentExampleApple` succeeds (it takes the quoted fallback). - Existing CocoaPods CI (`test_ios_rntester`) covers the CocoaPods path. Reviewed By: cipolleschi Differential Revision: D113771766 Pulled By: fabriziocucci fbshipit-source-id: e4549508f8e56942b45fa128b2391a290499d4a8 --- .../ios/RNTMyNativeViewComponentView.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm index 2eb7bff28e6..b46d5ef6b17 100644 --- a/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm +++ b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm @@ -13,7 +13,11 @@ #import #import +#if __has_include() +#import +#else #import "RCTFabricComponentsPlugins.h" +#endif using namespace facebook::react;