diff --git a/native/chat/composed-message.react.js b/native/chat/composed-message.react.js --- a/native/chat/composed-message.react.js +++ b/native/chat/composed-message.react.js @@ -6,7 +6,6 @@ import { StyleSheet, View } from 'react-native'; import Animated from 'react-native-reanimated'; -import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; import { createMessageReply } from 'lib/shared/message-utils.js'; import { assertComposableMessageType } from 'lib/types/message-types.js'; @@ -22,7 +21,7 @@ import { useNavigateToSidebar } from './sidebar-navigation.js'; import SwipeableMessage from './swipeable-message.react.js'; import { useContentAndHeaderOpacity, useDeliveryIconOpacity } from './utils.js'; -import Avatar from '../components/avatar.react.js'; +import UserAvatar from '../components/user-avatar.react.js'; import { type InputState, InputStateContext } from '../input/input-state.js'; import { type Colors, useColors } from '../themes/colors.js'; import type { ChatMessageInfoItemWithHeight } from '../types/chat-types.js'; @@ -137,10 +136,9 @@ let avatar; if (!isViewer && item.endsCluster && shouldRenderAvatars) { - const avatarInfo = getAvatarForUser(item.messageInfo.creator); avatar = ( - + ); } else if (!isViewer && shouldRenderAvatars) { diff --git a/native/chat/message-reactions-modal.react.js b/native/chat/message-reactions-modal.react.js --- a/native/chat/message-reactions-modal.react.js +++ b/native/chat/message-reactions-modal.react.js @@ -7,11 +7,10 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import type { ReactionInfo } from 'lib/selectors/chat-selectors.js'; -import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; import { useMessageReactionsList } from 'lib/shared/reaction-utils.js'; -import Avatar from '../components/avatar.react.js'; import Modal from '../components/modal.react.js'; +import UserAvatar from '../components/user-avatar.react.js'; import type { RootNavigationProp } from '../navigation/root-navigator.react.js'; import type { NavigationRoute } from '../navigation/route-names.js'; import { useColors, useStyles } from '../themes/colors.js'; @@ -48,21 +47,17 @@ ); const renderItem = React.useCallback( - ({ item }) => { - const avatarInfo = getAvatarForUser(item); - - return ( - - - - - {item.username} - - - {item.reaction} + ({ item }) => ( + + + + + {item.username} + - ); - }, + {item.reaction} + + ), [ marginLeftStyle, styles.reactionsListReactionText, diff --git a/native/chat/message-tooltip-button-avatar.react.js b/native/chat/message-tooltip-button-avatar.react.js --- a/native/chat/message-tooltip-button-avatar.react.js +++ b/native/chat/message-tooltip-button-avatar.react.js @@ -3,10 +3,8 @@ import * as React from 'react'; import { View, StyleSheet } from 'react-native'; -import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; - import { avatarOffset } from './chat-constants.js'; -import Avatar from '../components/avatar.react.js'; +import UserAvatar from '../components/user-avatar.react.js'; import type { ChatMessageInfoItemWithHeight } from '../types/chat-types.js'; import { useShouldRenderAvatars } from '../utils/avatar-utils.js'; @@ -17,11 +15,6 @@ function MessageTooltipButtonAvatar(props: Props): React.Node { const { item } = props; - const avatarInfo = React.useMemo( - () => getAvatarForUser(item.messageInfo.creator), - [item.messageInfo.creator], - ); - const shouldRenderAvatars = useShouldRenderAvatars(); if (item.messageInfo.creator.isViewer || !shouldRenderAvatars) { @@ -29,7 +22,7 @@ } return ( - + ); } diff --git a/native/chat/settings/thread-settings-member.react.js b/native/chat/settings/thread-settings-member.react.js --- a/native/chat/settings/thread-settings-member.react.js +++ b/native/chat/settings/thread-settings-member.react.js @@ -16,7 +16,6 @@ } from 'lib/actions/thread-actions.js'; import { useENSNames } from 'lib/hooks/ens-cache.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; -import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; import { memberIsAdmin, memberHasAdminPowers, @@ -30,9 +29,9 @@ } from 'lib/types/thread-types.js'; import type { ThreadSettingsNavigate } from './thread-settings.react.js'; -import Avatar from '../../components/avatar.react.js'; import PencilIcon from '../../components/pencil-icon.react.js'; import { SingleLine } from '../../components/single-line.react.js'; +import UserAvatar from '../../components/user-avatar.react.js'; import { type KeyboardState, KeyboardContext, @@ -75,7 +74,6 @@ render() { const userText = stringForUser(this.props.memberInfo); - const avatarInfo = getAvatarForUser(this.props.memberInfo); const marginLeftStyle = { marginLeft: this.props.shouldRenderAvatars ? 8 : 0, @@ -162,7 +160,7 @@ - + {usernameInfo} {editButton} diff --git a/native/chat/typeahead-tooltip.react.js b/native/chat/typeahead-tooltip.react.js --- a/native/chat/typeahead-tooltip.react.js +++ b/native/chat/typeahead-tooltip.react.js @@ -4,7 +4,6 @@ import { Platform, Text } from 'react-native'; import { PanGestureHandler, FlatList } from 'react-native-gesture-handler'; -import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; import { type TypeaheadMatchedStrings, type Selection, @@ -12,8 +11,8 @@ } from 'lib/shared/mention-utils.js'; import type { RelativeMemberInfo } from 'lib/types/thread-types.js'; -import Avatar from '../components/avatar.react.js'; import Button from '../components/button.react.js'; +import UserAvatar from '../components/user-avatar.react.js'; import { useStyles } from '../themes/colors.js'; import { useShouldRenderAvatars } from '../utils/avatar-utils.js'; @@ -61,11 +60,9 @@ }); }; - const avatarInfo = getAvatarForUser(item); - return (