import React from 'react'; import PropTypes from 'prop-types'; import { Field } from 'formik'; import { FormGroup, TextInput } from '@patternfly/react-core'; function FormField (props) { const { id, name, label, validate, isRequired, ...rest } = props; return ( { const isValid = !form.touched[field.name] || !form.errors[field.name]; return ( { field.onChange(event); }} /> ); }} /> ); } FormField.propTypes = { id: PropTypes.string.isRequired, name: PropTypes.string.isRequired, label: PropTypes.string.isRequired, type: PropTypes.string, validate: PropTypes.func, isRequired: PropTypes.bool, }; FormField.defaultProps = { type: 'text', validate: () => {}, isRequired: false, }; export default FormField;