Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove the default variant style, fix type issue #97

Merged
merged 1 commit into from
Aug 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import MuiTextField, {
import { FieldProps, getIn } from 'formik';

export type TextFieldProps = FieldProps &
Omit<MuiTextFieldProps, 'error' | 'name' | 'onChange' | 'value'>;
Omit<MuiTextFieldProps, 'error' | 'name' | 'onChange' | 'value'> & {
// Fix for the type for variant which is using union
// https://stackoverflow.com/questions/55664421
variant: 'standard' | 'filled' | 'outlined' | undefined;
};

export const fieldToTextField = ({
field,
form,
variant = 'standard',
disabled,
...props
}: TextFieldProps): MuiTextFieldProps => {
Expand All @@ -23,7 +26,6 @@ export const fieldToTextField = ({
return {
...props,
...field,
variant,
error: showError,
helperText: showError ? fieldError : props.helperText,
disabled: disabled != undefined ? disabled : isSubmitting,
Expand Down