@@ -3,7 +3,6 @@ import {View} from 'react-native';
33import type { ColorValue , TextStyle } from 'react-native' ;
44import type { OnyxEntry } from 'react-native-onyx' ;
55import type { ValueOf } from 'type-fest' ;
6- import SingleReportAvatar from '@components/ReportActionItem/SingleReportAvatar' ;
76import useOnyx from '@hooks/useOnyx' ;
87import type { ReportAvatarDetails } from '@hooks/useReportAvatarDetails' ;
98import useReportIsArchived from '@hooks/useReportIsArchived' ;
@@ -41,6 +40,7 @@ import {FallbackAvatar} from './Icon/Expensicons';
4140import MultipleAvatars from './MultipleAvatars' ;
4241import ParentNavigationSubtitle from './ParentNavigationSubtitle' ;
4342import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback' ;
43+ import SingleReportAvatar from './ReportActionItem/SingleReportAvatar' ;
4444import type { TransactionListItemType } from './SelectionList/types' ;
4545import SubscriptAvatar from './SubscriptAvatar' ;
4646import Text from './Text' ;
@@ -245,55 +245,71 @@ function AvatarWithDisplayName({
245245
246246 const shouldUseFullTitle = isMoneyRequestOrReport || isAnonymous ;
247247
248- const getAvatar = useCallback ( ( ) => {
249- if ( shouldShowSubscriptAvatar ) {
248+ const getAvatar = useCallback (
249+ ( accountID : number ) => {
250+ if ( shouldShowSubscriptAvatar ) {
251+ return (
252+ < SubscriptAvatar
253+ backgroundColor = { avatarBorderColor }
254+ mainAvatar = { icons . at ( 0 ) ?? fallbackIcon }
255+ secondaryAvatar = { icons . at ( 1 ) }
256+ size = { size }
257+ />
258+ ) ;
259+ }
260+
261+ if ( ! singleAvatarDetails || singleAvatarDetails . shouldDisplayAllActors || ! singleAvatarDetails . reportPreviewSenderID ) {
262+ return (
263+ < MultipleAvatars
264+ icons = { icons }
265+ size = { size }
266+ secondAvatarStyle = { [ StyleUtils . getBackgroundAndBorderStyle ( avatarBorderColor ) ] }
267+ />
268+ ) ;
269+ }
270+
250271 return (
251- < SubscriptAvatar
252- backgroundColor = { avatarBorderColor }
253- mainAvatar = { icons . at ( 0 ) ?? fallbackIcon }
254- secondaryAvatar = { icons . at ( 1 ) }
255- size = { size }
272+ < SingleReportAvatar
273+ reportPreviewDetails = { singleAvatarDetails }
274+ personalDetails = { personalDetails }
275+ containerStyles = { [ styles . actionAvatar , styles . mr3 ] }
276+ actorAccountID = { accountID }
256277 />
257278 ) ;
258- }
279+ } ,
280+ [ StyleUtils , avatarBorderColor , icons , personalDetails , shouldShowSubscriptAvatar , singleAvatarDetails , size , styles ] ,
281+ ) ;
282+
283+ const getWrappedAvatar = useCallback (
284+ ( accountID : number ) => {
285+ const avatar = getAvatar ( accountID ) ;
286+
287+ if ( ! shouldEnableAvatarNavigation ) {
288+ return < View accessibilityLabel = { title } > { avatar } </ View > ;
289+ }
259290
260- if ( ! singleAvatarDetails || singleAvatarDetails . shouldDisplayAllActors || ! singleAvatarDetails . reportPreviewSenderID ) {
261291 return (
262- < MultipleAvatars
263- icons = { icons }
264- size = { size }
265- secondAvatarStyle = { [ StyleUtils . getBackgroundAndBorderStyle ( avatarBorderColor ) ] }
266- />
292+ < View accessibilityLabel = { title } >
293+ < PressableWithoutFeedback
294+ onPress = { showActorDetails }
295+ accessibilityLabel = { title }
296+ role = { getButtonRole ( true ) }
297+ >
298+ { avatar }
299+ </ PressableWithoutFeedback >
300+ </ View >
267301 ) ;
268- }
269-
270- return (
271- < SingleReportAvatar
272- reportPreviewDetails = { singleAvatarDetails }
273- personalDetails = { personalDetails }
274- containerStyles = { [ styles . actionAvatar , styles . mr3 ] }
275- actorAccountID = { actorAccountID . current }
276- />
277- ) ;
278- } , [ StyleUtils , avatarBorderColor , icons , personalDetails , shouldShowSubscriptAvatar , singleAvatarDetails , size , styles ] ) ;
302+ } ,
303+ [ getAvatar , shouldEnableAvatarNavigation , showActorDetails , title ] ,
304+ ) ;
279305
280- const avatar = < View accessibilityLabel = { title } > { getAvatar ( ) } </ View > ;
306+ const WrappedAvatar = getWrappedAvatar ( actorAccountID ?. current ?? CONST . DEFAULT_NUMBER_ID ) ;
281307
282308 const headerView = (
283309 < View style = { [ styles . appContentHeaderTitle , styles . flex1 ] } >
284310 { ! ! report && ! ! title && (
285311 < View style = { [ styles . flex1 , styles . flexRow , styles . alignItemsCenter , styles . justifyContentBetween ] } >
286- { shouldEnableAvatarNavigation ? (
287- < PressableWithoutFeedback
288- onPress = { showActorDetails }
289- accessibilityLabel = { title }
290- role = { getButtonRole ( true ) }
291- >
292- { avatar }
293- </ PressableWithoutFeedback >
294- ) : (
295- avatar
296- ) }
312+ { WrappedAvatar }
297313 < View style = { [ styles . flex1 , styles . flexColumn ] } >
298314 { getCustomDisplayName (
299315 shouldUseCustomSearchTitleName ,
0 commit comments