React原生0.62自动链接只是在安卓系统中进行的

问题描述 投票:0回答:1

我使用的是react-native 0.62,使用的是自动链接,我想知道是否有办法只在android或ios上自动链接。

我真正的问题是,我使用 react-native-firebsae 和 react-native-push-notification 来发送本地通知,而我需要'react-native-push-notification'只适用于 android 系统。

当我添加了'react-native-push-notification'并安装后,我的IOS显示错误 "Invarian Violation: Native module cannot be null".Thank you in advance.

react-native react-native-firebase react-native-push-notification
1个回答
1
投票

在单一平台上的链接可以这样做。

第一个选择

react-native link your-library-js-package-name --platform (android or ios)

第二种选择

Create a react-native.config.js file in the root of your project.

module.exports = {
  dependencies: {
    'some-unsupported-package': {
      platforms: {
        android: null, // disable Android platform, other platforms will still autolink if provided
      },
    },
  },
};

链接到文档

https:/github.comreact-native-communitycliblobmasterdocsautolinking.md#how-can-i-customize-how-autolinking-works-for-my-package。

© www.soinside.com 2019 - 2024. All rights reserved.