Skip to content

Commit 3973a96

Browse files
committed
profile page basic
1 parent 1c87164 commit 3973a96

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

app/(tabs)/profile.tsx

+20-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function Account({ session }: { session: Session }) {
2424

2525
const { data, error, status } = await supabase
2626
.from('profiles')
27-
.select(`username, phone,email`)
27+
.select(`username, phone, email`)
2828
.eq('id', session?.user.id)
2929
.single();
3030
if (error && status !== 406) {
@@ -85,8 +85,25 @@ export default function Account({ session }: { session: Session }) {
8585
<LinearGradient
8686
colors={['#833ab4', '#fd1d1d', '#fcb045']}
8787
style={{ height: Dimensions.get('window').height, flex: 1 }}>
88-
<View className="flex-1">
89-
<FormInput title="Email" input={email} onInputChange={() => setEmail} />
88+
<View className="flex-1 pt-10">
89+
<FormInput
90+
placeholder="Email"
91+
title="Email"
92+
input={email}
93+
onInputChange={() => setEmail}
94+
/>
95+
<FormInput
96+
placeholder="Username"
97+
title="Username"
98+
input={username}
99+
onInputChange={() => setUsername}
100+
/>
101+
<FormInput
102+
placeholder="Phone"
103+
title="Phone"
104+
input={phone}
105+
onInputChange={() => setPhone}
106+
/>
90107
<Button
91108
title="Update Profile"
92109
onPress={() => updateProfile({ username, phone, email })}

components/FormInput.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@ export default function FormInput({
44
title,
55
input,
66
onInputChange,
7+
placeholder,
78
}: {
89
title: string;
910
input: string;
1011
onInputChange: () => void;
12+
placeholder: string;
1113
}) {
1214
return (
13-
<View className="gap-2 p-2">
14-
<Text className="text-lg font-semibold text-white">{title}</Text>
15-
<TextInput className="border-b border-gray-300" value={input} onChangeText={onInputChange} />
15+
<View className="flex-row gap-2 border-b border-gray-300 p-2">
16+
<Text className="pl-2 text-lg font-semibold text-white">{title} :</Text>
17+
<TextInput
18+
className="pl-2"
19+
value={input}
20+
onChangeText={onInputChange}
21+
placeholder={placeholder}
22+
placeholderTextColor="gainsboro"
23+
/>
1624
</View>
1725
);
1826
}

0 commit comments

Comments
 (0)