Files
waseel/app/(root)/(tabs)/profile.tsx

64 lines
2.3 KiB
TypeScript

import { Image, ScrollView, Text, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { InputField } from "@/components/input-field";
import { icons } from "@/constants";
import { useT } from "@/lib/i18n";
import { useSession } from "@/lib/session";
const Profile = () => {
const { user } = useSession();
const t = useT();
return (
<SafeAreaView className="flex-1 bg-general-500 dark:bg-neutral-950">
<ScrollView
className="px-5"
contentContainerStyle={{ paddingBottom: 120 }}
>
<Text className="text-2xl font-JakartaBold my-5 text-black dark:text-white">
{t("profile.title")}
</Text>
<View className="flex items-center justify-center my-5">
<Image
source={user?.avatarUrl ? { uri: user.avatarUrl } : icons.profile}
alt={t("profile.avatarAlt")}
style={{ width: 110, height: 110, borderRadius: 110 / 2 }}
className=" rounded-full h-[110px] w-[110px] border-[3px] border-white dark:border-neutral-800 shadow-sm shadow-neutral-300 dark:shadow-neutral-950/40"
/>
</View>
<View className="flex flex-col items-start justify-center bg-white dark:bg-neutral-900 rounded-lg shadow-sm shadow-neutral-300 dark:shadow-neutral-950/40 px-5 py-3">
<View className="flex flex-col items-start justify-start w-full">
<InputField
label={t("profile.firstName")}
placeholder={user?.name?.split(" ")[0] || t("profile.firstNamePlaceholder")}
containerStyles="w-full mb-4"
inputStyles="p-3.5"
editable={false}
/>
<InputField
label={t("profile.lastName")}
placeholder={user?.name?.split(" ").slice(1).join(" ") || t("profile.lastNamePlaceholder")}
containerStyles="w-full mb-4"
inputStyles="p-3.5"
editable={false}
/>
<InputField
label={t("profile.email")}
placeholder={user?.email ?? t("profile.emailPlaceholder")}
containerStyles="w-full mb-4"
inputStyles="p-3.5"
editable={false}
/>
</View>
</View>
</ScrollView>
</SafeAreaView>
);
};
export default Profile;