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:
@@ -77,6 +77,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
|
|||||||
profile={replyTo.author}
|
profile={replyTo.author}
|
||||||
moderation={replyTo.moderation?.ui('avatar')}
|
moderation={replyTo.moderation?.ui('avatar')}
|
||||||
type={replyTo.author.associated?.labeler ? 'labeler' : 'user'}
|
type={replyTo.author.associated?.labeler ? 'labeler' : 'user'}
|
||||||
|
disableNavigation={true}
|
||||||
/>
|
/>
|
||||||
<View style={styles.replyToPost}>
|
<View style={styles.replyToPost}>
|
||||||
<Text type="xl-medium" style={t.atoms.text} numberOfLines={1} emoji>
|
<Text type="xl-medium" style={t.atoms.text} numberOfLines={1} emoji>
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
|
|||||||
moderation?: ModerationUI
|
moderation?: ModerationUI
|
||||||
profile: bsky.profile.AnyProfileView
|
profile: bsky.profile.AnyProfileView
|
||||||
disableHoverCard?: boolean
|
disableHoverCard?: boolean
|
||||||
|
disableNavigation?: boolean
|
||||||
onBeforePress?: () => void
|
onBeforePress?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +440,7 @@ let PreviewableUserAvatar = ({
|
|||||||
moderation,
|
moderation,
|
||||||
profile,
|
profile,
|
||||||
disableHoverCard,
|
disableHoverCard,
|
||||||
|
disableNavigation,
|
||||||
onBeforePress,
|
onBeforePress,
|
||||||
...rest
|
...rest
|
||||||
}: PreviewableUserAvatarProps): React.ReactNode => {
|
}: PreviewableUserAvatarProps): React.ReactNode => {
|
||||||
@@ -450,8 +452,20 @@ let PreviewableUserAvatar = ({
|
|||||||
precacheProfile(queryClient, profile)
|
precacheProfile(queryClient, profile)
|
||||||
}, [profile, queryClient, onBeforePress])
|
}, [profile, queryClient, onBeforePress])
|
||||||
|
|
||||||
|
const avatarEl = (
|
||||||
|
<UserAvatar
|
||||||
|
avatar={profile.avatar}
|
||||||
|
moderation={moderation}
|
||||||
|
type={profile.associated?.labeler ? 'labeler' : 'user'}
|
||||||
|
{...rest}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProfileHoverCard did={profile.did} disable={disableHoverCard}>
|
<ProfileHoverCard did={profile.did} disable={disableHoverCard}>
|
||||||
|
{disableNavigation ? (
|
||||||
|
avatarEl
|
||||||
|
) : (
|
||||||
<Link
|
<Link
|
||||||
label={_(msg`${profile.displayName || profile.handle}'s avatar`)}
|
label={_(msg`${profile.displayName || profile.handle}'s avatar`)}
|
||||||
accessibilityHint={_(msg`Opens this profile`)}
|
accessibilityHint={_(msg`Opens this profile`)}
|
||||||
@@ -460,13 +474,9 @@ let PreviewableUserAvatar = ({
|
|||||||
handle: profile.handle,
|
handle: profile.handle,
|
||||||
})}
|
})}
|
||||||
onPress={onPress}>
|
onPress={onPress}>
|
||||||
<UserAvatar
|
{avatarEl}
|
||||||
avatar={profile.avatar}
|
|
||||||
moderation={moderation}
|
|
||||||
type={profile.associated?.labeler ? 'labeler' : 'user'}
|
|
||||||
{...rest}
|
|
||||||
/>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
)}
|
||||||
</ProfileHoverCard>
|
</ProfileHoverCard>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user