import {Text, TextInput, View, Button} from 'react-native'; import {Section} from '../common/Section'; import {styles, TextTheme} from '../common/styles'; import {useState} from 'react'; import DatePicker from 'react-native-date-picker'; interface PatientForm { name?: string; date_of_birth?: string; } interface PatientFormProps { nestedFormCallback: (tag: string, form: Object) => void; } export const PatientForm: React.FC = ({ nestedFormCallback, }) => { const [form, setForm] = useState({}); const [openDate, setOpenDate] = useState(false); const handleTextChange = (tag: 'name' | 'date_of_birth', text: string) => { let newForm = {...form}; newForm[tag] = text; setForm(newForm); nestedFormCallback('patient', {human_patient: newForm}); }; return ( Name handleTextChange('name', text)} /> Date of Birth {form.date_of_birth ? ( {form.date_of_birth}