【问题标题】:How to display multiline notification on react native android?如何在反应原生android上显示多行通知?
【发布时间】:2019-05-23 05:04:15
【问题描述】:

我创建了这样的通知:

const notification = new firebase.notifications.Notification()
    .setNotificationId('1')
    .setTitle('Reminder')
    .setBody('Looooooooooooooooooooooonggggggg messageeeeeeeeeeeeeeeeeeeeee longggggggggggggg messsssssagggeeeeeeeeee')
    .setData({
      key: true,
      data: {},
    })
    .android.setChannelId('test-channel')
    .android.setAutoCancel(true)
    .android.setPriority(firebase.notifications.Android.Priority.Max);

我想在通知中显示所有正文消息。但它只显示一行消息。

【问题讨论】:

    标签: android react-native react-native-android react-native-firebase


    【解决方案1】:

    android 对象中有一个 bigText 道具。您可以在此处查看文档 https://rnfirebase.io/docs/v5.x.x/notifications/reference/AndroidNotification#setBigText,但要对其进行总结,就像这样 shoudlwork

    const notification = new firebase.notifications.Notification()
        .setNotificationId('1')
        .setTitle('Reminder')
        .setBody('Looooooooooooooooooooooonggggggg messageeeeeeeeeeeeeeeeeeeeee longggggggggggggg messsssssagggeeeeeeeeee')
        .setData({
          key: true,
          data: {},
        })
        .android.setChannelId('test-channel')
        .android.setAutoCancel(true)
        .android.setBigText('Looooooooooooooooooooooonggggggg messageeeeeeeeeeeeeeeeeeeeee longggggggggggggg messsssssagggeeeeeeeeee')
        .android.setPriority(firebase.notifications.Android.Priority.Max);
    

    【讨论】:

      猜你喜欢
      • 2020-08-09
      • 1970-01-01
      • 2019-05-16
      • 2017-12-18
      • 2016-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多