我使用的是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 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
},
},
},
};
链接到文档