question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disable avatar issue

See original GitHub issue

Issue Description

Avatar component is still rendering and taking space for upcoming messages even renderAvatar={() => null}

Is there a way to hide it?

image

Additional Information

  • React Native version: 0.64.2
  • react-native-gifted-chat version: 0.16.3
  • Platform(s) (iOS, Android, or both?): both

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

3reactions
jgablecommented, Oct 6, 2021

I was able to subclass the default Message component to overcome the display of the empty avatar;

import {
  GiftedChat,
  Message as GiftedChatMessage,
  MessageProps,
  IMessage,
} from "react-native-gifted-chat";

// Subclass the existing Message
class NoAvatarMessage extends GiftedChatMessage {
  // This fixes an issue where blank avatars are rendered;
  // https://github.com/FaridSafi/react-native-gifted-chat/issues/2093
  renderAvatar() {
    return null;
  }
}

// Render custom blank avatar messages
const CustomMessage = (props: MessageProps<IMessage>): JSX.Element => (
  <NoAvatarMessage
    {...props}
  />
);

<GiftedChat
  messages={displayedMessages}
  onSend={onMessageSend}
  renderMessage={CustomMessage}
  user={user}
/>

Hope that helps someone else.

0reactions
Bhavya0101commented, Nov 29, 2022

I solved this issue by adding

renderAvatar={() => null}

but it had a few glitches in the UI. So, it was solved by adding

showAvatarForEveryMessage={true}

So that it renders avatar for every message and all of them are set to null.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable Avatar and force Gravatar usage - GitLab.org
When using various DevOps tools you may want to force your users to maintain the same Avatar between them using Gravatar. Feature checklist....
Read more >
Disable avatar picture of User Picker custom field in ... - Jira
Would like to request an option to turn off avatar (pictures) in the Issue search result. Suggested Solution. Some option in the setting...
Read more >
How do you remove Account Avatar? - eM Client
Change your Gravatar on the Gravatar website and then in eM Client do to “Menu / Settings / Contacts / General” and remove...
Read more >
Can you remove the avatar - Meta Community Forums - 858628
- Select People from the navigation menu, then select Profile. - Select Edit Avatar to open the avatar editor. - Select Face, Hair,...
Read more >
How do I disable the Windows Live avatar (a photo) in my
1. Login your account at https://profile.live.com · 2. On the left hand side, click Change picture · 3. Click Remove · 4. A...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found