Skip to content

Commit f21757c

Browse files
committed
fix: include back channel image and fix inconsistencies
1 parent cfbff2a commit f21757c

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

package/src/components/ui/Avatar/AvatarGroup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ const useUserAvatarGroupStyles = () => {
197197
);
198198
};
199199

200+
// TODO V9: Add theming support here.
200201
const styles = StyleSheet.create({
201202
container: {
202203
padding: 2,

package/src/components/ui/Avatar/ChannelAvatar.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useMemo } from 'react';
22

33
import { Channel, UserResponse } from 'stream-chat';
44

@@ -19,9 +19,8 @@ export type ChannelAvatarProps = {
1919

2020
export const ChannelAvatar = (props: ChannelAvatarProps) => {
2121
const { channel } = props;
22-
const members = Object.values(channel.state.members);
2322
const online = useChannelPreviewDisplayPresence(channel);
24-
const { showOnlineIndicator = online } = props;
23+
const { showOnlineIndicator = online, size, showBorder = true } = props;
2524

2625
const {
2726
theme: { semantics },
@@ -31,17 +30,16 @@ export const ChannelAvatar = (props: ChannelAvatarProps) => {
3130
const index = ((hashedValue % 5) + 1) as 1 | 2 | 3 | 4 | 5;
3231
const avatarBackgroundColor = semantics[`avatarPaletteBg${index}`];
3332

34-
const { size, showBorder = true } = props;
33+
const channelImage = channel.data?.image;
3534

36-
const channelImage = undefined;
35+
const usersForGroup = useMemo(
36+
() => Object.values(channel.state.members).map((member) => member.user as UserResponse),
37+
[channel.state.members],
38+
);
3739

3840
if (!channelImage) {
3941
return (
40-
<UserAvatarGroup
41-
size='lg'
42-
users={members.map((member) => member.user as UserResponse)}
43-
showOnlineIndicator={showOnlineIndicator}
44-
/>
42+
<UserAvatarGroup size='lg' users={usersForGroup} showOnlineIndicator={showOnlineIndicator} />
4543
);
4644
}
4745

0 commit comments

Comments
 (0)