iOS notification customUI?

#1

So i’m reading the documentation about notificationhandling, but for iOS, i have to use some custom-UI if the app is in foreground, right?
Does Expo has something already build in? Because i can’t get it to work. I can already handle notifications, but i have nothing to display for the user.

For example, if you get a message on Messenger for iOS, have the app foregrounded, but do not have that conversation open, you will see the notification slide down from the top of the screen with a custom notification UI.

Thankfully, handling push notifications is straightforward with Expo, all you need to do is add a listener to the Notifications object.

  _handleNotification = (notification) => {
    
    if(notification.origin == 'received'){
      //something should be shown here, ios :(
      Notifications.presentLocalNotificationAsync(localNotification);
    }
    Notifications.setBadgeNumberAsync(0);
  };

ends in a loop, so it seems that i really need some custome-component… does somebody has a hint for me how to archive this?

#2

This is something I’m currently looking into as well. The best approach I thought of so far is to use something like https://github.com/testshallpass/react-native-dropdownalert. Other libraries such as https://github.com/wix/react-native-notifications are more elaborate, but require you to eject from expo.

1 Like
#3

I used this to implement in app notifications:

https://github.com/robcalcroft/react-native-in-app-notification

Works on iOS/Android.

1 Like