-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[馃悰] Passing a Custom MessageAvatar component shows the wrong avatar in a Message Reply 馃敟馃敟 #2522
Comments
Hi khushal87 is this a bug or am i misconfiguring something? Thx |
following up @khushal87 |
Hey @magiusdarrigo, please do the following in your code: import {
MessageAvatar,
MessageAvatarProps,
MessageType,
Reply,
ReplyProps,
useMessageContext,
} from 'stream-chat-react-native';
const CustomMessageAvatar = (props: MessageAvatarProps) => {
return (
<Pressable onPress={() => console.log('Normal Avatar')}>
<MessageAvatar {...props} />
</Pressable>
);
};
const CustomMessageReplyAvatar = (props: MessageAvatarProps) => {
const { message } = useMessageContext();
return (
<Pressable onPress={() => console.log('Quoted Avatar')}>
<MessageAvatar
{...props}
size={50}
message={message.quoted_message as MessageType<StreamChatGenerics>}
/>
</Pressable>
);
};
const CustomReplies = (props: ReplyProps) => {
return <Reply {...props} MessageAvatar={CustomMessageReplyAvatar} />;
}; Then pass the |
Getting: When pressing on the "reply" option on a message |
works if I add:
right after the useMessageContext hook. Thanks! |
Issue
I need to pass a custom message avatar so i can make the component pressable. The replier's avatar gets changed to the sender's avatar when passing in a custom MessageAvatar component to the MessageAvatar prop in the Channel component.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
The expected behavior is for user A's avatar to remain its own. See below ss without the CustomChatAvatar being passed in:
Project Related Information
Customization
Click To Expand
Offline support
Environment
Click To Expand
MacOS Sonoma 14.2.1
package.json
:react-native info
output:I don't have this CLI command. I am using
expo v50.0.14
stream-chat-react-native
version you're using that has this issue:Additional context
Screenshots
Click To Expand
The text was updated successfully, but these errors were encountered: