From 69a066657bbd060ca93868ecfd730625c7b0d331 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 12 Mar 2019 16:51:19 +0000 Subject: [PATCH] Remove bits of Field that supported uncontrolled Field is no longer used as an uncontrolled component, so we can remove some supporting code that we no longer need. --- src/components/views/elements/Field.js | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/components/views/elements/Field.js b/src/components/views/elements/Field.js index cd06610c62c..daf6ec0ce19 100644 --- a/src/components/views/elements/Field.js +++ b/src/components/views/elements/Field.js @@ -53,22 +53,9 @@ export default class Field extends React.PureComponent { }; } - /* TODO: Remove me */ - get value() { - if (!this.refs.fieldInput) return null; - return this.refs.fieldInput.value; - } - - set value(newValue) { - if (!this.refs.fieldInput) { - throw new Error("No field input reference"); - } - this.refs.fieldInput.value = newValue; - } - onChange = (ev) => { if (this.props.onValidate) { - const result = this.props.onValidate(this.value); + const result = this.props.onValidate(ev.target.value); this.setState({ valid: result.valid, feedback: result.feedback, @@ -92,12 +79,6 @@ export default class Field extends React.PureComponent { inputProps.onChange = this.onChange; - /* TODO: Remove me */ - // make sure we use the current `value` for the field and not the original one - if (inputProps.value === undefined) { - inputProps.value = this.value || ""; - } - const fieldInput = React.createElement(inputElement, inputProps, children); let prefixContainer = null;