Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

How can I send files ( pdf, text, jpg) through react-native-gifted-chat?

Writer Sebastian Wright

Can any one help me through react native gifted chat? I want to share files like (.pdf, docs, .txt, .jpg.) How to do that?

2

2 Answers

You have to use renderCustomView (Function) - Custom view inside the bubble prop. And add some meta information into your message data like this is a SPECIAL message and finally test in renderCustomView if you are in the case of a special message.

react-native-gifted-chat already includes support for images and videos, using the properties video and image of IMessage, just past pass the the link of the resource

{ _id: 1, text: 'My message', createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)), user: { _id: 2, name: 'React Native', avatar: ' }, image: ' // You can also add a video prop: video: ' // 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
}

For the rest of types you have to implement your own logic, using one of the render functions, i think you could renderMessageImage with a link to the icon of the resources and add a description, also you should handle the click event to start download

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy