Fix error due to async validators for <Input> (#3823)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and Jari Kolehmainen committed 2021-09-21 08:38:15 +03:00
1 parent ae726f936e
commit 9c516cbde4
1 file changed
+2 -2
+2 -2
View File
@@ -91,7 +91,7 @@ const defaultProps: Partial<InputProps> = {
export class Input extends React.Component<InputProps, State> {
static defaultProps = defaultProps as object;
public input: InputElement;
public input: InputElement | null = null;
public validators: InputValidator[] = [];
public state: State = {
@@ -191,7 +191,7 @@ export class Input extends React.Component<InputProps, State> {
}
}
this.input.setCustomValidity(errors.length ? errors[0].toString() : "");
this.input?.setCustomValidity(errors.length ? errors[0].toString() : "");
}
setValidation(errors: React.ReactNode[]) {