Closed
Description
Environment
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 938.13 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.1 - /usr/local/opt/node@12/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/opt/node@12/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 26, 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.2, 29.0.3
System Images: android-28 | Google APIs Intel x86 Atom
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
Description
In monorepos where packages are split by platform, react-native config
is not able to populate projects
because it makes assumptions on the folder structure of the package. For example, given a project like below:
my-component
└── packages
├── my-component-core
│ ├── package.json
│ └── src
├── my-component-android
│ ├── build.gradle
│ ├── package.json
│ └── src
└── my-component-ios
├── TestApp.xcworkspace
├── package.json
└── src
The output of react-native config
in my-component-android
/-ios
is currently:
{
"..."
"project": {
"ios": null,
"android": null
}
}
This had no consequences up until 3.0, when autolinking started using it in #768. Autolinking is currently broken for repos with a different folder structure.
It is possible to work around this issue by adding a react-native.config.js
with the following content:
module.exports = {
project: {
ios: {
project: "ReactTestApp-Dummy.xcodeproj"
}
}
};
Reproducible Demo
Checkout this repo and branch: https://github.com/microsoft/react-native-test-app/tree/tido/autolink-fail-repro.
Then run the following:
cd example
yarn
pod install --project-directory=ios
Output:
% pod install --project-directory=ios
[!] Invalid `Podfile` file: undefined method `[]' for nil:NilClass.
# from /~/react-native-test-app/example/ios/Podfile:5
# -------------------------------------------
#
> use_test_app! __dir__ do |target|
# case target
# -------------------------------------------
cc @arazabishov in case you need more Android details.