1

I'm use react-native 0.62 that use autolinking i would like to know if there is a way to auto linking just for android or just for ios.

My real problem is that i use react-native-firebsae with react-native-push-notification for sending local notification, and i need 'react-native-push-notification' just for android.

After i yarn add 'react-native-push-notification' and do pod install my IOS show the error "Invarian Violation: Native module cannot be null". Thank you in advance

Barak
  • 654
  • 13
  • 30

1 Answers1

6

Linking on a single platform can be done like this.

First Option

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

Second Option

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
      },
    },
  },
};

Link to docs

https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-customize-how-autolinking-works-for-my-package

Waheed Akhtar
  • 3,110
  • 1
  • 16
  • 30
  • Thank you, but i still have the problem with 'react-native-push-notification'. i think they build it this way that it must to work for android and ios as dependency.. – Barak May 05 '20 at 11:34