import React from 'react'; import { View, Text, TextInput, TouchableOpacity } from 'react-native'; import { useForm, Controller } from 'react-hook-form'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; const profileFormSchema = z.object({ username: z .string() .min(2, { message: "Username must be at least 2 characters.", }) .max(30, { message: "Username must not be longer than 30 characters.", }), email: z .string({ required_error: "Please select an email to display.", }) .email(), bio: z.string().max(160).min(4), }); type ProfileFormValues = z.infer; const defaultValues: Partial = { bio: "I own a computer.", }; export function ProfileForm() { const { control, handleSubmit } = useForm({ resolver: zodResolver(profileFormSchema), defaultValues, }); const onSubmit = (data: ProfileFormValues) => { console.log(JSON.stringify(data, null, 2)); }; return ( ( Username {error && {error.message}} This is your public display name. It can be your real name or a pseudonym. You can only change this once every 30 days. )} /> ( Email {error && {error.message}} You can manage verified email addresses in your email settings. )} /> ( Bio {error && {error.message}} You can @mention other users and organizations to link to them. )} /> Update profile ); }