Show ios notifications in foreground

Here - https://docs.expo.io/versions/v34.0.0/guides/push-notifications/#push-notifications

It says:

For iOS, if you do not set notification.iosDisplayInForeground (in your app.json ) or _displayInForeground (in your push message) to true

So I did this in my app.json -

"notification": {
  "iosDisplayInForeground": true
},

However its not doing the trick. I also on startup of expo I get this error:

• Field: notification - should NOT have additional property ‘iosDisplayInForeground’.

I don’t see on the app.json docs anything called iosDisplayInForeground - https://docs.expo.io/versions/v34.0.0/workflow/configuration/#__next - Is it missing in the docs?

Not sure about the documentation; but the way I handle notifications in iOS if the app is foreground is I display in an Alert modal.

The property iosDisplayInForeground isnt working since v33. Hopefully looking forward to sdk35. For now i do the same as fanofskynyrd and catch the notifications into an alert window. Alternativly you can try react-native-dropdownalert which is working too. But you have to know, you have to use the data attribute to receive and show the data.
example:

{ "title" : "mytitle",
  "body" : "mybody",
 "data" : {
    "title" : "this title u can use",
    "body" : "this body u can use in your alert"
    }
}
1 Like

Thank you!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.