Environment
System:
OS: macOS 11.6.5
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 23.41 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.19.0 - /private/var/folders/qc/zygl93h53zb3ctbyw0f0jbzm0000gn/T/xfs-ac3821f8/node
Yarn: 3.1.1 - /private/var/folders/qc/zygl93h53zb3ctbyw0f0jbzm0000gn/T/xfs-ac3821f8/yarn
npm: 8.6.0 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.66.4 => 0.66.4
react-native-macos: ^0.66.14 => 0.66.55
npmGlobalPackages:
*react-native*: Not Found
Description
According to the docs, it is possible to disable autolinking for certain platforms:
|
## How can I customize how autolinking works for my package? |
|
|
|
A library can add a `react-native.config.js` configuration file, which will customize the defaults, example: |
|
|
|
```js |
|
// react-native.config.js |
|
module.exports = { |
|
dependency: { |
|
platforms: { |
|
android: null, // disable Android platform, other platforms will still autolink if provided |
|
}, |
|
}, |
|
}; |
|
``` |
However, this seems to no longer work.
This is what react-native config looks normally:
{
"root": "/~/example",
"reactNativePath": "/~/example/node_modules/react-native",
"dependencies": {
"react-native-test-app": {
"root": "/~",
"name": "react-native-test-app",
"platforms": {
"ios": {
"sourceDir": "/~/example/ios",
"folder": "/~",
"pbxprojPath": "/~/ios/ReactTestApp.xcodeproj/project.pbxproj",
"podfile": "/~/example/ios/Podfile",
"podspecPath": "/~/ReactTestApp-DevSupport.podspec",
"projectPath": "/~/ios/ReactTestApp.xcodeproj",
"projectName": "ReactTestApp.xcodeproj",
"libraryFolder": "Libraries",
"sharedLibraries": [],
"plist": [],
"scriptPhases": [],
"configurations": []
},
"android": null,
"macos": null,
"windows": null
},
"assets": [],
"hooks": {},
"params": []
}
}
}
If I change react-native.config.js to:
module.exports = {
dependency: {
platforms: {
android: null,
},
},
};
The output becomes:
{
"root": "/~/example",
"reactNativePath": "/~/example/node_modules/react-native",
"dependencies": {}
}
Reproducible Demo
git clone https://github.com/microsoft/react-native-test-app.git
cd react-native-test-app
yarn
# open react-native.config.js and add `android: null`
cd example
yarn react-native config
Environment
Description
According to the docs, it is possible to disable autolinking for certain platforms:
cli/docs/autolinking.md
Lines 73 to 86 in c4179d8
However, this seems to no longer work.
This is what
react-native configlooks normally:{ "root": "/~/example", "reactNativePath": "/~/example/node_modules/react-native", "dependencies": { "react-native-test-app": { "root": "/~", "name": "react-native-test-app", "platforms": { "ios": { "sourceDir": "/~/example/ios", "folder": "/~", "pbxprojPath": "/~/ios/ReactTestApp.xcodeproj/project.pbxproj", "podfile": "/~/example/ios/Podfile", "podspecPath": "/~/ReactTestApp-DevSupport.podspec", "projectPath": "/~/ios/ReactTestApp.xcodeproj", "projectName": "ReactTestApp.xcodeproj", "libraryFolder": "Libraries", "sharedLibraries": [], "plist": [], "scriptPhases": [], "configurations": [] }, "android": null, "macos": null, "windows": null }, "assets": [], "hooks": {}, "params": [] } } }If I change
react-native.config.jsto:The output becomes:
{ "root": "/~/example", "reactNativePath": "/~/example/node_modules/react-native", "dependencies": {} }Reproducible Demo