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.
This commit is contained in:
J. Ryan Stinnett 2019-03-12 16:51:19 +00:00
parent d4dbba3938
commit 69a066657b

View file

@ -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;