feat: add name and email inputs on profile screen

This commit is contained in:
Vinicius Souza 2024-10-26 15:20:30 -03:00
parent 255f845965
commit 09773ed3e5
2 changed files with 18 additions and 9 deletions

View file

@ -1,27 +1,30 @@
import { Input as GSInput, InputField } from "@gluestack-ui/themed"; import { Input as GSInput, InputField } from '@gluestack-ui/themed';
import { ComponentProps } from "react"; import { ComponentProps } from 'react';
type Props = ComponentProps<typeof InputField>; type Props = ComponentProps<typeof InputField> & {
isReadOnly?: boolean;
};
export function Input({ ...others }: Props) { export function Input({ isReadOnly = false, ...others }: Props) {
return ( return (
<GSInput <GSInput
bg="$gray700"
h="$14" h="$14"
px="$4"
borderColor="$gray700" borderColor="$gray700"
borderWidth="$1" borderWidth="$1"
borderRadius="$md" borderRadius="$md"
$focus={{ $focus={{
borderColor: "$green500" borderColor: '$green500',
}} }}
> isReadOnly={isReadOnly}
opacity={isReadOnly ? 0.5 : 1}>
<InputField <InputField
bg="$gray700"
px="$4"
color="$white" color="$white"
fontFamily="$body" fontFamily="$body"
placeholderTextColor="$gray300" placeholderTextColor="$gray300"
{...others} {...others}
/> />
</GSInput> </GSInput>
) );
} }

View file

@ -3,6 +3,7 @@ import { Center, Text, VStack } from '@gluestack-ui/themed';
import { ScreenHeader } from '@components/ScreenHeader'; import { ScreenHeader } from '@components/ScreenHeader';
import { UserPhoto } from '@components/UserPhoto'; import { UserPhoto } from '@components/UserPhoto';
import { Input } from '@components/Input';
export function Profile() { export function Profile() {
return ( return (
@ -22,6 +23,11 @@ export function Profile() {
Alterar foto Alterar foto
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
<Center w="$full" gap="$4">
<Input placeholder="Nome" bg="$gray600" />
<Input value="john.doe@email.com" bg="$gray600" isReadOnly />
</Center>
</Center> </Center>
</ScrollView> </ScrollView>
</VStack> </VStack>