mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
dc959c9271
Summary: In a mono-repo the `react-native` package could be hoisted compared to the app directory, in which case it's not a good strategy for the `react-native-xcode.sh` script to guess the app project root relative to the location of itself. Instead I suggest to relying on a build setting provided by Xcode to derive the default app path. I could have use the `SRCROOT` instead. According to https://stackoverflow.com/questions/36323031/what-the-different-between-srcroot-and-project-dir this is equivalent and also a bit less ambiguous as I see it. I.e. I would expect most Xcode projects to be located in the `ios` directory of the app. As a workaround, before this merge, users can add the following to their "Bundle React Native code and images" build phase or `ios/.xcode.env` file: ```shell export PROJECT_ROOT="$PROJECT_DIR/.." ``` This build phase can also be used for users wanting to revert this default behaviour once merged. ## Changelog [iOS] [Changed] - Changed default `PROJECT_ROOT` (used in when bundling for iOS) to rely on the `PROJECT_DIR` build setting. Pull Request resolved: https://github.com/facebook/react-native/pull/35970 Test Plan: I've updated this locally and verified this does indeed pick up the correct app path - even in a mono-repo. To verify this: - Instantiate the template with this patch applied. - Update the "Run scheme"'s "Build Configuration" to "Release". - Build the app without errors. Reviewed By: cortinico Differential Revision: D42842636 Pulled By: cipolleschi fbshipit-source-id: 040c31ac59a8abec5f5b38f795c8e74649420bac