-
Notifications
You must be signed in to change notification settings - Fork 33
Description
I am working on a project that includes radar and firebase, but I am running into an issue where the remote-notifications UIBackgroundMode is being overwritten by the radar expo plugin.
I have set up radar and used the expo plugin configuration example from the documentation. Specifically related to the issue, I am setting iosBackgroundMode to true as I require background location for my project.
I am also using firebase for notifications. This issue is not specific to firebase but it is a good example of a real world issue that I am encountering. Firebase in their documentation tells me to add "remote-notifcation" to my expo config expo.ios.infoPlist.UIBackgroundModes. But the remote-notification UIBackgroundMode is being overwritten by the radar plugin.
react-native-radar/plugin/src/withRadarIOS.ts
Lines 15 to 17 in 11fa3f6
| if (args.iosBackgroundMode) { | |
| config.modResults.UIBackgroundModes = ["location", "fetch"]; | |
| } |
I believe this line ^ should instead maybe merge with existing UIBackgroundModes array instead of overwriting/setting it to a new array. That way, it does not overwrite other plugins or custom configuratio options set by user in their expo config.
To recreate/test this, create a new expo application, include radar SDK, then set your expo app.json to something like this. In this example, I am setting some UIBackgroundModes via infoPlist.
{
"expo": {
"ios": {
"infoPlist": {
"UIBackgroundModes": [
"location",
"remote-notification",
"fetch"
]
},
"plugins": [
[
"react-native-radar",
{
"iosBackgroundMode": true
}
]
]
}
}
What you will see after a expo prebuild --clean is that the Info.plist will not contain the 'remote-notification' UIBackgroundMode/entitlement. It should include at a minimum all three specified in my expo config.