React-Native 0.60+ 从自动链接中排除库

React-Native 0.60+ Exclude library from autolink

在 RN 0.60 中,我们获得了自动link 功能,该功能将在运行时 link 本机依赖项。我的问题是有没有办法从 autolink 中排除一些库。我认为这可以使用 react-native.config.js 文件来实现,但我还没有找到实现它的方法。如果有这方面的任何例子,那就太好了。

您可以通过在 RN 项目顶层的 react-native.config.js 中添加此代码来忽略自动链接。

module.exports = {
  dependencies: {
    "your_package": {
      platforms: {
        android: null,
        ios: null
        // add more platform to disable auto-linking for them too
      }
    }
  }
}