Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ICAT
Datahub
Commits
03bfa137
Commit
03bfa137
authored
Aug 26, 2020
by
Axel Bocciarelli
Browse files
Fix text fields cleared on every render
parent
2e87f72e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/Form/TextFieldGroup.js
View file @
03bfa137
...
...
@@ -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
}
>
<
Label
Wrapper
>
<
Wrapper
{...(
layout
&&
layout
.
labelCol
)}
>
<
ControlLabel
>
{
fieldLabel
}
{
registerOptions
.
required
&&
<
RequiredStar
/>
}
<
/ControlLabel
>
<
/
Label
Wrapper
>
<
Field
Wrapper
>
<
/Wrapper
>
<
Wrapper
{...(
layout
&&
layout
.
fieldCol
)}
>
<
FormControl
type
=
{
type
}
name
=
{
name
}
...
...
@@ -48,7 +43,7 @@ function TextFieldGroup(props) {
{...
controlProps
}
/
>
{
error
&&
<
FieldAlert
fieldLabel
=
{
fieldLabel
}
error
=
{
error
}
/>
}
<
/
Field
Wrapper
>
<
/Wrapper
>
<
/FormGroup
>
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment