@@ -245,65 +245,59 @@ function AvatarWithDisplayName({
245245
246246 const shouldUseFullTitle = isMoneyRequestOrReport || isAnonymous ;
247247
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-
248+ const getAvatar = useCallback ( ( ) => {
249+ if ( shouldShowSubscriptAvatar ) {
271250 return (
272- < SingleReportAvatar
273- reportPreviewDetails = { singleAvatarDetails }
274- personalDetails = { personalDetails }
275- containerStyles = { [ styles . actionAvatar , styles . mr3 ] }
276- actorAccountID = { accountID }
251+ < SubscriptAvatar
252+ backgroundColor = { avatarBorderColor }
253+ mainAvatar = { icons . at ( 0 ) ?? fallbackIcon }
254+ secondaryAvatar = { icons . at ( 1 ) }
255+ size = { size }
277256 />
278257 ) ;
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- }
258+ }
290259
260+ if ( ! singleAvatarDetails || singleAvatarDetails . shouldDisplayAllActors || ! singleAvatarDetails . reportPreviewSenderID ) {
291261 return (
292- < View accessibilityLabel = { title } >
293- < PressableWithoutFeedback
294- onPress = { showActorDetails }
295- accessibilityLabel = { title }
296- role = { getButtonRole ( true ) }
297- >
298- { avatar }
299- </ PressableWithoutFeedback >
300- </ View >
262+ < MultipleAvatars
263+ icons = { icons }
264+ size = { size }
265+ secondAvatarStyle = { [ StyleUtils . getBackgroundAndBorderStyle ( avatarBorderColor ) ] }
266+ />
301267 ) ;
302- } ,
303- [ getAvatar , shouldEnableAvatarNavigation , showActorDetails , title ] ,
304- ) ;
268+ }
269+
270+ return (
271+ < SingleReportAvatar
272+ reportPreviewDetails = { singleAvatarDetails }
273+ personalDetails = { personalDetails }
274+ containerStyles = { [ styles . actionAvatar , styles . mr3 ] }
275+ actorAccountID = { singleAvatarDetails . reportPreviewSenderID }
276+ />
277+ ) ;
278+ } , [ StyleUtils , avatarBorderColor , icons , personalDetails , shouldShowSubscriptAvatar , singleAvatarDetails , size , styles ] ) ;
279+
280+ const getWrappedAvatar = useCallback ( ( ) => {
281+ const avatar = getAvatar ( ) ;
282+
283+ if ( ! shouldEnableAvatarNavigation ) {
284+ return < View accessibilityLabel = { title } > { avatar } </ View > ;
285+ }
305286
306- const WrappedAvatar = getWrappedAvatar ( actorAccountID ?. current ?? CONST . DEFAULT_NUMBER_ID ) ;
287+ return (
288+ < View accessibilityLabel = { title } >
289+ < PressableWithoutFeedback
290+ onPress = { showActorDetails }
291+ accessibilityLabel = { title }
292+ role = { getButtonRole ( true ) }
293+ >
294+ { avatar }
295+ </ PressableWithoutFeedback >
296+ </ View >
297+ ) ;
298+ } , [ getAvatar , shouldEnableAvatarNavigation , showActorDetails , title ] ) ;
299+
300+ const WrappedAvatar = getWrappedAvatar ( ) ;
307301
308302 const headerView = (
309303 < View style = { [ styles . appContentHeaderTitle , styles . flex1 ] } >
0 commit comments