react-native-gifted-chat How to display user avatar as user's initial if image is null

1.9k views Asked by At

setup Expo react native Gifted-chat

Question In chat screen , I want to display initial of user's name (other than the current user) if the the user has no image for avatar. I dont know how to use or which props to use.

Can anyone please help? Thanks

1

There are 1 answers

0
Bhol On BEST ANSWER

Solved it by following config:

Message object--> user: { _id: database_user_sender, avatar: Avatar_Image? Avatar_Image : https://ui-avatars.com/api/?background=0dbc3f&color=FFF&name=${FirstName_LastName} },