Components
import React from "react";
import { Image, View, Text, Pressable } from "react-native"
type Profile = {
src: string;
title: string;
subTitle: string;
buttonLabel?: string
}
export default ({ src, title, subTitle, buttonLabel = "Added" }: Profile) =>{
return (
<View className="w-60 h-56 border border-neutral-300 absolute bg-yellow-200/40 rounded-xl p-1 shadow-md">
<View className="w-60 h-56 border border-neutral-300 rounded-xl flex items-center py-5 shadow-md">
<View className=" size-16 my-2 ">
<Image source={{uri : src}} className="object-cover rounded-full w-full h-full overflow-hidden" />
</View>
<Text className="font-medium text-2xl">
{
title
}
</Text>
<Text className="text-neutral-500">
{
subTitle
}
</Text>
<Pressable className="bg-violet-300 w-fit p-2 px-4 my-4 rounded-xl ">
<Text className="font-medium">{buttonLabel}</Text>
</Pressable>
</View>
</View>
)
}
Installation
npx solui@latest add profile-cardInstall dependencies
pnpm add nativewind react-native-reanimated@~3.17.4 react-native-safe-area-context@5.4.0 --dev tailwindcss@^3.4.17 prettier-plugin-tailwindcss@^0.5.11 react-native-vector-icons Copy the code
Copy the code from the Code tab above into components/ui/profile-card.tsx.
Update imports
Update the imports to match your project structure.
Usage
import ProfileCard from "@/components/ui/profile-card";
export default function ProfileCardDemo() {
return <ProfileCard src="image.jpg" subTitle='@sol-auth' title='Satish' />
}Props
| Prop Name | Type | Default | Description |
|---|---|---|---|
| src | string | '' | showing Image on profile |
| title | string | '' | Title on profile |
| subTitle | string | '' | subTitle on profile |
| buttonLabel | string | Added | Button label for profile |