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

ken*_*i91 6 autolink react-native

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

Muh*_*bal 12

您可以通过在 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
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)