import {Text, TextInput, View} from 'react-native'; import {Section} from '../common/Section'; import {styles, TextTheme} from '../common/styles'; import {useState} from 'react'; interface MedicineForm { name?: string; dosage_form?: string; strength?: string; quantity?: string; refills?: string; directions?: string; } interface MedicineFormProps { nestedFormCallback: (tag: string, form: Object) => void; } export const MedicineForm: React.FC = ({ nestedFormCallback, }) => { const [form, setForm] = useState({}); const handleTextChange = (tag: keyof MedicineForm, text: string) => { let newForm = {...form}; newForm[tag] = text; setForm(newForm); nestedFormCallback('MedicationPrescribed', newForm); }; return ( Name of Medicine handleTextChange('name', text)} /> Form of Dosage handleTextChange('dosage_form', text)} /> Strength handleTextChange('strength', text)} /> Quantity handleTextChange('quantity', text)} /> Refills handleTextChange('refills', text)} /> Directions handleTextChange('directions', text)} /> ); };