0

I have implemented Local Notification in my React Native App.

Package using react-native-push-notification-ios/push-notification-ios

I have tried to fire local notification and it's a success. But local notification does not show all the Text of the body. Any maximum length or any solution for showing full text ?

My code :

  showNotification = (id, title, message, data = {}, options = {}, channel) => {
    console.log('SHOWWWWWW');
    PushNotification.localNotification({
      /* Android Only Properties */
      ...this.buildAndroidNotification(
        id,
        title,
        message,
        data,
        options,
        channel,
      ),
      /* iOS and Android properties */
      ...this.buildIOSNotification(id, title, message, data, options),
      /* iOS and Android properties */
      title: title || '',
      message: message || '',
      playSound: options.playSound || false,
      soundName: options.soundName || 'default',
      userInteraction: true, // BOOLEAN: If the notification was opened by the user from the notification area or not
    });
  };

  buildIOSNotification = (id, title, message, data = {}, options = {}) => {
    return {
      alertAction: options.alertAction || 'view',
      alertBody: message || '',
      category: options.category || '',
      userInfo: {
        id: id,
        item: data,
      },
    };
  };

enter image description here

UPDATED SOLUTION :

Maximum character length is 256 on iOS Side

Akila Devinda
  • 3,391
  • 1
  • 12
  • 29
  • This is the “preview” of the notification. It should be short! If you have a longer message to deliver, this is not the place. – matt Apr 30 '21 at 10:08
  • @matt the thing this it only shows 256 characters.. I think apple has limit the length.. Any solution – Akila Devinda Apr 30 '21 at 10:14
  • ascandroli has answered your question here: [https://stackoverflow.com/questions/6307748/what-is-the-maximum-length-of-a-push-notification-alert-text](https://stackoverflow.com/questions/6307748/what-is-the-maximum-length-of-a-push-notification-alert-text) – Steven Apr 30 '21 at 10:15
  • @Steven thanks – Akila Devinda Apr 30 '21 at 10:16
  • you are welcome : ) – Steven Apr 30 '21 at 11:08

1 Answers1

0

ascandroli has answered your question here: What is the maximum length of a Push Notification alert text?

Steven
  • 497
  • 8
  • 21