Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: cannot disable auto linking for Android without disabling it for iOS aswell #1584

Closed
berendsliedrecht opened this issue Apr 1, 2022 · 1 comment

Comments

@berendsliedrecht
Copy link

berendsliedrecht commented Apr 1, 2022

Environment

npx react-native info
System:
    OS: macOS 12.1
    CPU: (8) arm64 Apple M1
    Memory: 3.15 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.11.0 - ~/.config/noot/using/node
    Yarn: 1.22.17 - ~/.config/noot/using/yarn
    npm: 8.5.2 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 29, 30, 31, 32
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 32.0.0, 32.1.0
      System Images: android-32 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8193401
    Xcode: 13.3/13E113 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /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: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

I control a library with some native code using turbo modules. I fixed auto linking for iOS in this library but I did not get it working for Android. I would like to disable Autolinking for android only and keep iOS enabled. I checked the docs and it says I have to add this to my library:

// react-native.config.js
module.exports = {
  dependency: {
    platforms: {
      android: null, // disable Android platform, other platforms will still autolink if provided
    },
  },
};

And I believe that here schema.ts the schema does not allow for null. Which is incompatible then with the example. Keeping it like android: {} will result in it being filled with the default values again. Also, adding all the default values with an empty string also results in an invalid configuration.

Reproducible Demo

  1. Create a react native library.
  2. Execute the following command
cat <<EOF >> react-native.config.js
module.exports = {
  dependency: {
    platforms: {
      android: null,
    },
  },
};
EOF
  1. add the library to your project
  2. Execute the following command:
react-native config
# or 
react-native config | jq ".dependencies"

And it should show that the dependencies object is empty.


I am not an expert with Autolinking and the whole process around it. Maybe I interpreted something wrong and please correct me if I made a simple mistake somewhere.

possibly related PR: #1297

@github-actions
Copy link

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant