React Native Gifted Chat 附加多个图像

Tha*_*jan 5 react-native react-native-gifted-chat

我正在为我的一个项目使用 React Native Gifted Chat。我知道有一个图像选项可用,我可以将单个图像附加到聊天中。但是,有没有办法可以将多个图像附加到单个聊天中?

小智 0

从文档来看,图像的类型是字符串。所以它的目的是附加一张图像。但一个简单的解决方案是像 image:"img1,img2,.." 一样,然后使用

renderMessageImage={(props)=> customMessageImages(props)} 
Run Code Online (Sandbox Code Playgroud)

在哪里

customMessageImages=(props:MessageImageProps<IMessage>)=>{
   const imgs = props.image.split(',')
   return(
      {
         imgs.map(img=>(
            <Image source={img} />
         ))
       }
   )
}
Run Code Online (Sandbox Code Playgroud)