Reputation: 150
I have already implemented PushnotificationIos , an api provided by react-native working fine.
Lately I have to implement pushnotification for android and I am trying to use [email protected] . I have platform specific handler but Works fine for android , but for IOS the app crashes while builing with the following error
VERSIONS DETAILS: react-native : 0.55 react-native-firebase:4.0.0
I tried to do dynamic import to get rid of react-native-firebase for ios but I am not convinced with the idea as its kind of hack , gives parser error. Dynamic import feature itself is not a stable one.
Upvotes: 1
Views: 381
Reputation: 36
I do not know how your code is, but what you can do is depending on the platform, import the library or not. Something like this would be:
if (Platform.OS == 'android') {
firebase = require('react-native-firebase');
}
(this would not work with import)
Another thing that I do not recommend at all, but it would work, is to link firebase to iOS so that it does not launch an error, and when using the library, you can limit it depending on the platform. Like this:
if (Platform.OS == 'android') {
const notificationsOpen = await firebase.notifications().getInitialNotification()
}
Upvotes: 1