fix(mobile): no preview for avatar at header action (#3066)

* fix(mobile): no preview for avatar at header action

* update
This commit is contained in:
Stephen Zhou 2025-03-13 11:34:53 +08:00 committed by GitHub
parent 50a39f993f
commit 2c64d28bdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 13 deletions

View File

@ -12,9 +12,17 @@ interface UserAvatarProps {
name?: string | null
className?: string
color?: string
noPreview?: boolean
}
export const UserAvatar = ({ image, size = 24, name, className, color }: UserAvatarProps) => {
export const UserAvatar = ({
image,
size = 24,
name,
className,
color,
noPreview,
}: UserAvatarProps) => {
if (!image) {
return (
<View
@ -40,19 +48,23 @@ export const UserAvatar = ({ image, size = 24, name, className, color }: UserAva
)
}
return (
const imageContent = (
<Image
source={{ uri: image }}
className={cn("rounded-full", className)}
style={{ width: size, height: size }}
proxy={{
width: size,
height: size,
}}
/>
)
return noPreview ? (
imageContent
) : (
<Galeria urls={[image]}>
<Galeria.Image index={0}>
<Image
source={{ uri: image }}
className={cn("rounded-full", className)}
style={{ width: size, height: size }}
proxy={{
width: size,
height: size,
}}
/>
</Galeria.Image>
<Galeria.Image index={0}>{imageContent}</Galeria.Image>
</Galeria>
)
}

View File

@ -42,6 +42,7 @@ export function HomeLeftAction() {
name={user?.name}
className="rounded-full"
color={accentColor}
noPreview
/>
</TouchableOpacity>
</ActionGroup>