From 249c2526edcd34314b3400b9e64e1a363e1552d8 Mon Sep 17 00:00:00 2001 From: apanizo Date: Wed, 3 Oct 2018 17:38:41 +0200 Subject: [PATCH] Custom SelectField for react-final-form --- src/components/forms/SelectField/index.jsx | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/components/forms/SelectField/index.jsx diff --git a/src/components/forms/SelectField/index.jsx b/src/components/forms/SelectField/index.jsx new file mode 100644 index 00000000..451e95d6 --- /dev/null +++ b/src/components/forms/SelectField/index.jsx @@ -0,0 +1,47 @@ +// @flow +import React from 'react' +import Select, { type SelectFieldProps } from '@material-ui/core/Select' +import FormControl from '@material-ui/core/FormControl' +import InputLabel from '@material-ui/core/InputLabel' +import FormHelperText from '@material-ui/core/FormHelperText' + +const style = { + minWidth: '100%', +} + +const SelectInput = ({ + input: { + name, value, onChange, ...restInput + }, + meta, + label, + formControlProps, + ...rest +}: SelectFieldProps) => { + const showError = ((meta.submitError && !meta.dirtySinceLastSubmit) || meta.error) && meta.touched + const inputProps = { ...restInput, name } + + return ( + + {label} +