Closed GiorgioBertolotti closed 2 years ago
Hi @GiorgioBertolotti
Ah, interesting. Makes sense. Thanks for reporting this. I'm actually not sure if this is issue of the plugin itself or rather just wrongly written integration docs. 🤔 From what I can see, your workaround sounds like way how one should use this plugin. That way also seems to be suggested in here. If we would want to see plugin working with import { PlayInstallReferrer } from 'react-native-play-install-referrer'
line, then I would probably need to create implementation of plugin for iOS as well so that iOS app compiles as well. And that doesn't sound to me like a nice way to go.
Hello @uerceg, thanks for the quick reply! Unfortunately, the workaround doesn't provide the best experience for the development because breaks Typescript (PlayInstallReferrer is any), maybe there's another way to solve this without creating an empty iOS NativeModule... Let me know if there's any way to use Typescript correctly with the conditional import, thanks! 😄
Hopefully solved with #10 and #20. In case you still end up facing this issue with v1.1.8 and later, please feel free to reopen the issue. Cheers!
Describe the bug Running the app on iOS causes the following error:
Invariant Violation: Native module cannot be null.
Removing the import line causes iOS to runs correctly.
import { PlayInstallReferrer } from 'react-native-play-install-referrer';
To temporarily solve the issue I imported the library like this:
const PlayInstallReferrer = Platform.OS === 'android' ? require('react-native-play-install-referrer') : null;
To Reproduce Just running the app on iOS simulator caused the crash in my case...
Expected behaviour I expect that importing the library doesn't create any problem to iOS, it just doesn't do anything.
Environment
Screenshots![Invariant Violation: Native module cannot be null](https://user-images.githubusercontent.com/15264288/117149287-629cdd80-adb7-11eb-9894-3857fdd434af.png)