import {Text, TextInput, View} from 'react-native'; import {styles, TextTheme} from '../common/styles'; import {useState} from 'react'; import {Section} from '../common/Section'; interface AddressForm { address_line_1?: string; city?: string; state_province?: string; postal_code?: string; country_code?: string; } interface AddressFormProps { nestedFormCallback: (tag: string, form: Object) => void; } export const AddressForm: React.FC = ({ nestedFormCallback, }) => { const [form, setForm] = useState({}); const handleTextChange = (tag: keyof AddressForm, text: string) => { let newForm = {...form}; newForm[tag] = text; setForm(newForm); nestedFormCallback('Address', newForm); }; return (
Address Line 1 handleTextChange('address_line_1', text) } /> City handleTextChange('city', text)} /> State Provice handleTextChange('state_province', text) } /> Postal Code handleTextChange('postal_code', text) } /> Country Code handleTextChange('country_code', text) } />
); };