任何人都可以通过反应原生天才聊天来帮助我吗?我想共享(.pdf、docs、.txt、.jpg)之类的文件。该怎么做?
问问题
1491 次
2 回答
2
你必须使用renderCustomView (Function) - Custom view inside the bubble
道具。并将一些元信息添加到您的消息数据this is a SPECIAL message
中,如果您遇到特殊消息,最后在 renderCustomView 中进行测试。
于 2021-02-12T09:54:59.440 回答
1
react-native-gifted-chat 已经包含了对图片和视频的支持,使用了 IMessage 的 video 和 image 属性,只是通过了资源的链接
{
_id: 1,
text: 'My message',
createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)),
user: {
_id: 2,
name: 'React Native',
avatar: 'https://facebook.github.io/react/img/logo_og.png',
},
image: 'https://facebook.github.io/react/img/logo_og.png',
// You can also add a video prop:
video: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4',
// Mark the message as sent, using one tick
sent: true,
// Mark the message as received, using two tick
received: true,
// Mark the message as pending with a clock loader
pending: true,
// Any additional custom parameters are passed through
}
对于其余类型,您必须使用其中一个渲染函数来实现自己的逻辑,我认为您可以使用资源图标的链接 renderMessageImage 并添加描述,您还应该处理单击事件以开始下载
于 2021-02-12T06:01:50.527 回答