mirror of
https://github.com/abhay-raizada/PeerScribe.git
synced 2026-04-26 16:24:03 +00:00
Add nested xml
This commit is contained in:
51
components/PrescriptionCreator/AddressForm.tsx
Normal file
51
components/PrescriptionCreator/AddressForm.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import {Text, TextInput, View} from 'react-native';
|
||||
import {Section} from './Section';
|
||||
import {styles, TextTheme} from './styles';
|
||||
import {useState} from 'react';
|
||||
import DatePicker from 'react-native-date-picker';
|
||||
import {Button} from '@ant-design/react-native';
|
||||
|
||||
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<AddressFormProps> = ({
|
||||
nestedFormCallback,
|
||||
}) => {
|
||||
const [form, setForm] = useState<AddressForm>({});
|
||||
const [openDate, setOpenDate] = useState<boolean>(false);
|
||||
|
||||
const handleTextChange = (tag: keyof AddressForm, text: string) => {
|
||||
let newForm = {...form};
|
||||
newForm[tag] = text;
|
||||
setForm(newForm);
|
||||
nestedFormCallback('Address', newForm);
|
||||
};
|
||||
|
||||
return (
|
||||
<Section title="Address">
|
||||
<View>
|
||||
<View>
|
||||
<Text style={TextTheme}>Name</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
placeholder="Address Line 1"
|
||||
value={form.address_line_1}
|
||||
placeholderTextColor="white"
|
||||
onChangeText={(text: string) =>
|
||||
handleTextChange('address_line_1', text)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user