Ensure we always set some value in Field

Always set some value on the Field's input so that it doesn't flip flop between
controlled and uncontrolled.
This commit is contained in:
J. Ryan Stinnett 2019-03-07 16:41:44 +00:00
parent ea050683bd
commit 5a648ecfe4

View file

@ -88,8 +88,8 @@ export default class Field extends React.PureComponent {
inputProps.onChange = this.onChange;
// make sure we use the current `value` for the field and not the original one
if (this.value != undefined) {
inputProps.value = this.value;
if (inputProps.value === undefined) {
inputProps.value = this.value || "";
}
const fieldInput = React.createElement(inputElement, inputProps, children);