Skip to content

Commit

Permalink
removes unnecessary constructor in EuiFormRow
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitropoulos committed Feb 22, 2020
1 parent 85217af commit 39c1833
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/components/form/form_row/form_row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,12 @@ export class EuiFormRow extends Component<EuiFormRowProps, EuiFormRowState> {
hasChildLabel: true,
};

constructor(props: EuiFormRowProps) {
super(props);

this.state = {
isFocused: false,
id: props.id || makeId(),
};

this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
}
state: EuiFormRowState = {
isFocused: false,
id: this.props.id || makeId(),
};

onFocus(...args: any[]) {
onFocus = (...args: any[]) => {
// Doing this to allow onFocus to be called correctly from the child input element as this component overrides it
const onChildFocus = get(this.props, 'children.props.onFocus');
if (onChildFocus) {
Expand All @@ -126,9 +119,9 @@ export class EuiFormRow extends Component<EuiFormRowProps, EuiFormRowState> {
this.setState({
isFocused: true,
});
}
};

onBlur(...args: any[]) {
onBlur = (...args: any[]) => {
// Doing this to allow onBlur to be called correctly from the child input element as this component overrides it
const onChildBlur = get(this.props, 'children.props.onBlur');
if (onChildBlur) {
Expand All @@ -138,7 +131,7 @@ export class EuiFormRow extends Component<EuiFormRowProps, EuiFormRowState> {
this.setState({
isFocused: false,
});
}
};

render() {
const {
Expand Down

0 comments on commit 39c1833

Please sign in to comment.