feat: make substeps updatable

This commit is contained in:
Ali BARIN
2022-01-31 22:12:08 +01:00
committed by Ömer Faruk Aydın
parent 6c0ba197c6
commit 91a1c8b793
9 changed files with 64 additions and 26 deletions

View File

@@ -38,6 +38,8 @@ export default function TextField(props: TextFieldProps): React.ReactElement {
shouldUnregister,
clickToCopy,
readOnly,
onBlur,
onChange,
...textFieldProps
} = props;
@@ -48,10 +50,12 @@ export default function TextField(props: TextFieldProps): React.ReactElement {
defaultValue={defaultValue || ''}
control={control}
shouldUnregister={shouldUnregister}
render={({ field: { ref, ...field } }) => (
render={({ field: { ref, onChange: controllerOnChange, onBlur: controllerOnBlur, ...field } }) => (
<MuiTextField
{...textFieldProps}
{...field}
onChange={(...args) => { controllerOnChange(...args); onChange?.(...args); }}
onBlur={(...args) => { controllerOnBlur(); onBlur?.(...args); }}
inputRef={(element) => { inputRef.current = element; ref(element); }}
InputProps={{ readOnly, endAdornment: clickToCopy ? createCopyAdornment(inputRef) : null}}
/>