Commit 03bfa137 authored by Axel Bocciarelli's avatar Axel Bocciarelli
Browse files

Fix text fields cleared on every render

parent 2e87f72e
......@@ -24,22 +24,17 @@ function TextFieldGroup(props) {
);
const fieldLabel = label || capitalize(unpackedName.pop());
const LabelWrapper = layout
? (props) => <Col {...layout.labelCol}> {props.children}</Col>
: Fragment;
const FieldWrapper = layout
? (props) => <Col {...layout.fieldCol}> {props.children}</Col>
: Fragment;
const Wrapper = layout ? Col : Fragment;
return (
<FormGroup controlId={controlId}>
<LabelWrapper>
<Wrapper {...(layout && layout.labelCol)}>
<ControlLabel>
{fieldLabel}
{registerOptions.required && <RequiredStar />}
</ControlLabel>
</LabelWrapper>
<FieldWrapper>
</Wrapper>
<Wrapper {...(layout && layout.fieldCol)}>
<FormControl
type={type}
name={name}
......@@ -48,7 +43,7 @@ function TextFieldGroup(props) {
{...controlProps}
/>
{error && <FieldAlert fieldLabel={fieldLabel} error={error} />}
</FieldWrapper>
</Wrapper>
</FormGroup>
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment