Skip to content

Commit 6d0612c

Browse files
chrfalchmeta-codesync[bot]
authored andcommitted
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 `<React/RCTFabricComponentsPlugins.h>` resolves. The quoted import makes `MyNativeView` fail to compile when rn-tester is converted to SwiftPM (surfaced by the new SPM CI lane in #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: #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
1 parent eda6f4f commit 6d0612c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
#import <react/renderer/components/AppSpecs/Props.h>
1414
#import <react/renderer/components/AppSpecs/RCTComponentViewHelpers.h>
1515

16+
#if __has_include(<React/RCTFabricComponentsPlugins.h>)
17+
#import <React/RCTFabricComponentsPlugins.h>
18+
#else
1619
#import "RCTFabricComponentsPlugins.h"
20+
#endif
1721

1822
using namespace facebook::react;
1923

0 commit comments

Comments
 (0)