How can i use blur hash or thumb hash as fallback of avatar component? #244
Unanswered
krishna-gujjjar
asked this question in
Q&A
Replies: 2 comments
-
|
Should i use it like this: import type { ImageProps } from "expo-image";
import { Image as ImageComponent } from "expo-image";
import { Avatar } from "heroui-native";
import { withUniwind } from "uniwind";
const blurhash = "UcN,VfNe?FxW~ojF%Lof-:t6M|ay${oLE3R*";
const uri = "https://picsum.photoss/id/64/1200";
const Img = withUniwind(ImageComponent);
const Image = (props: ImageProps) => {
return <Img {...props} />;
};
export default () => (
<Avatar alt="avatar">
<Avatar.Image asChild source={{ uri }}>
<Image className="size-full" contentFit="cover" />
</Avatar.Image>
<Avatar.Fallback asChild>
<Image
className="size-full"
contentFit="cover"
placeholder={{ blurhash }}
/>
</Avatar.Fallback>
</Avatar>
); |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Almost correct, but no need to use Also, one thing. If you're going to use <Avatar alt="avatar">
<Avatar.Image asChild source={{ uri }}>
<Img className="size-full" contentFit="cover" placeholder={{ blurhash }} transition={200} />
</Avatar.Image>
</Avatar> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to use blur hash or thumb hash as fallback of avatar component.
Also it's fully supported expo-image.
Beta Was this translation helpful? Give feedback.
All reactions