iOS New Architecture codegen fails in brownfield app with custom React Native root directory #312
Unanswered
sandeep3690Butte
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
We have a brownfield React Native app on iOS with a custom directory structure that we’ve been using successfully for years with the old architecture.
`Root
├── ios/ # All native iOS code (Xcode project lives here)
└── reactnative/ # All React Native JS + node_modules`
This structure was chosen when React Native was integrated into an existing native iOS app, and it has worked fine with minor path overrides in react-native.config.js and the Podfile.
Problem
We are now upgrading to the latest React Native version to enable the New Architecture (Fabric + TurboModules).
On iOS, the build fails during codegen, specifically in:
However, our actual .xcodeproj lives in:
Root/ios/*.xcodeprojAs a result, codegen fails while trying to locate the Xcode project.
Relevant source:
https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js#L28
Inside this file:
generateReactCodegenPodspec calls getInputFiles
getInputFiles tries to find an .xcodeproj relative to the React Native app path
This assumption breaks for brownfield setups with split directories
Observations
This issue is iOS-only
Android works fine because this code path is not used there
The setup works correctly with the old architecture
The failure happens before native module artifacts can be generated
Questions
Is the New Architecture codegen expected to support brownfield apps with a custom RN root directory?
Is there an officially supported way to tell codegen where the .xcodeproj actually lives?
Would it be acceptable to add a fallback mechanism, for example:
If .xcodeproj is not found relative to the RN app path
Then try resolving it from an ios/ directory (or configurable path)
Would changing the working directory (cwd) for codegen to the iOS folder have any unintended side effects elsewhere?
Why this matters
Brownfield integrations are very common in large production apps.
Requiring the React Native root and the iOS project to live in the same directory makes upgrading to the New Architecture difficult without restructuring long-standing repositories.
A configurable or fallback-based resolution for .xcodeproj would make the New Architecture much easier to adopt for existing apps.
Environment
React Native: latest (New Architecture enabled v0.83.0)
iOS: Xcode + CocoaPods
App type: Brownfield
Directory structure: custom RN root separate from iOS root
Thanks for any guidance or recommendations.
Happy to contribute a PR if this is something the team agrees should be supported.
Beta Was this translation helpful? Give feedback.
All reactions