Fix for avatar preloading (#7816)

* mobile avatar profile preloading fix

* updating fix to include moderation

* removing comments, adding disableNavigation to PreviewableUserAvatarProps
This commit is contained in:
Seth Wood
2025-02-26 07:33:27 -08:00
committed by GitHub
parent c5b831d5d8
commit b924c53b23
2 changed files with 26 additions and 15 deletions
@@ -77,6 +77,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
profile={replyTo.author}
moderation={replyTo.moderation?.ui('avatar')}
type={replyTo.author.associated?.labeler ? 'labeler' : 'user'}
disableNavigation={true}
/>
<View style={styles.replyToPost}>
<Text type="xl-medium" style={t.atoms.text} numberOfLines={1} emoji>
+25 -15
View File
@@ -66,6 +66,7 @@ interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
moderation?: ModerationUI
profile: bsky.profile.AnyProfileView
disableHoverCard?: boolean
disableNavigation?: boolean
onBeforePress?: () => void
}
@@ -439,6 +440,7 @@ let PreviewableUserAvatar = ({
moderation,
profile,
disableHoverCard,
disableNavigation,
onBeforePress,
...rest
}: PreviewableUserAvatarProps): React.ReactNode => {
@@ -450,23 +452,31 @@ let PreviewableUserAvatar = ({
precacheProfile(queryClient, profile)
}, [profile, queryClient, onBeforePress])
const avatarEl = (
<UserAvatar
avatar={profile.avatar}
moderation={moderation}
type={profile.associated?.labeler ? 'labeler' : 'user'}
{...rest}
/>
)
return (
<ProfileHoverCard did={profile.did} disable={disableHoverCard}>
<Link
label={_(msg`${profile.displayName || profile.handle}'s avatar`)}
accessibilityHint={_(msg`Opens this profile`)}
to={makeProfileLink({
did: profile.did,
handle: profile.handle,
})}
onPress={onPress}>
<UserAvatar
avatar={profile.avatar}
moderation={moderation}
type={profile.associated?.labeler ? 'labeler' : 'user'}
{...rest}
/>
</Link>
{disableNavigation ? (
avatarEl
) : (
<Link
label={_(msg`${profile.displayName || profile.handle}'s avatar`)}
accessibilityHint={_(msg`Opens this profile`)}
to={makeProfileLink({
did: profile.did,
handle: profile.handle,
})}
onPress={onPress}>
{avatarEl}
</Link>
)}
</ProfileHoverCard>
)
}