sorry, it's probably a stupid question, but is there any example or description how to use avatars or images in messages with local images? All the examples always use a web url and e.g.
require("./imgs/1.png")
as param doesn't seem to do anything :)
has been answered at other places already.
@sagax85 How did you do ? I can not integrate the local images for the photos and the avatar 馃槶
So if you could help me, I would be grateful 馃榾
@sagax85 in the componentWillMount of the demo code provided on the main page, try adding a relative path:
componentWillMount() {
this.setState({
messages: [
{
_id: 1,
text: 'Hello User',
createdAt: new Date(),
user: {
_id: 2,
name: 'User',
avatar: require('./my_picture.png'),
},
},
],
});
}
@wrightmk it is not working with me
This isn't working for me either.
It works if I add the relative path to the user prop of GiftedChat, but if i try adding a local picture with relative path to a message in onSend it will get the wrong image number. It is seemingly picking a random number.
requiring an image from a local folder and adding as an avatar is working.