Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Remove bits of Field that supported uncontrolled
Browse files Browse the repository at this point in the history
Field is no longer used as an uncontrolled component, so we can remove some
supporting code that we no longer need.
  • Loading branch information
jryans committed Mar 12, 2019
1 parent d4dbba3 commit 69a0666
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/components/views/elements/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 69a0666

Please sign in to comment.