You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
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:
@@ -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) => {
|
onChange = (ev) => {
|
||||||
if (this.props.onValidate) {
|
if (this.props.onValidate) {
|
||||||
const result = this.props.onValidate(this.value);
|
const result = this.props.onValidate(ev.target.value);
|
||||||
this.setState({
|
this.setState({
|
||||||
valid: result.valid,
|
valid: result.valid,
|
||||||
feedback: result.feedback,
|
feedback: result.feedback,
|
||||||
@@ -92,12 +79,6 @@ export default class Field extends React.PureComponent {
|
|||||||
|
|
||||||
inputProps.onChange = this.onChange;
|
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);
|
const fieldInput = React.createElement(inputElement, inputProps, children);
|
||||||
|
|
||||||
let prefixContainer = null;
|
let prefixContainer = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user