import * as React from 'react'; import { Formik } from 'formik'; import * as Yup from 'yup'; import DisplayFormikState from './DisplayFormikState'; import Form from './EzForm'; import Field from './EzField'; import Button from './EzButton'; const schema = Yup.object().shape({ email: Yup.string().required('Email is required!'), dob: Yup.string().required('Birthday is required!') }); const animals = [ { value: '', label: 'Select an animal'}, { value: 'TIGER', label: 'Tiger'}, { value: 'BEAR', label: 'Bear'} ] const genders = [ { value: '', label: 'N/A'}, { value: 'MALE', label: 'Male'}, { value: 'FEMALE', label: 'Female'} ] const roles = [ { value: 'ADMIN', label: 'Admin'}, { value: 'USER', label: 'User'} ] export default class extends React.Component { state: any = {}; onSubmit = (values: any, { setSubmitting }: any) => { setTimeout(() => { alert(JSON.stringify(values, null, 2)); setSubmitting(false); }, 800); setSubmitting(true); } renderForm = (props: any) => (
Email | email Birthday | Date of birth (mm/dd/yyyy) | dob {genders.map(gender => {gender.label} | gender)} {animals.map(opt => )} {roles.map(role => {role.label} | roles)} ) renderHorizontalForm = (props: any) => { const css = { label: 'col-3 col-sm-12', control: 'col-9 col-sm-12', error: 'left25pct' } return (
Email | email Birthday | Date of birth (mm/dd/yyyy) | dob ) } render() { return (

Horizontal Form

); } }