【问题标题】:How can I customize the message bubble to include also the name of the user and time of the message in react native gifted chat?如何自定义消息气泡以在反应原生天才聊天中还包括用户名和消息时间?
【发布时间】:2019-04-14 22:30:39
【问题描述】:

我在 react native 中使用 gifted chat 库,但默认视图仅显示头像和气泡中的消息。我正在建立一个群聊,我还想在每个气泡中显示用户的姓名以及发送消息的时间。

我添加了renderMessage(props) {...} 属性,如果我在这里返回一个自定义ViewText,我可以显示用户名,但我丢失了库已经制作的所有格式。

有没有一种方法可以切换以显示消息的user.name,而无需从头开始重建所有样式?我没有在文档中找到类似的内容,我认为这会很有帮助。

【问题讨论】:

    标签: react-native chat react-native-gifted-chat


    【解决方案1】:

    您可以在 GiftedChat 组件中使用renderUsernameOnMessage={true}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-15
      • 1970-01-01
      • 2022-11-18
      • 1970-01-01
      • 2021-05-19
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      相关资源
      最近更新 更多