From 011e73f24f8ae15091d41781c93c313d0167d887 Mon Sep 17 00:00:00 2001 From: muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> Date: Mon, 31 Oct 2022 05:20:17 +0530 Subject: Convert LoginScreen component tree to typescript (#721) --- src/components/ui/input/index.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/components/ui/input/index.tsx') diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx index 3bafc93e7..2a36d7aa9 100644 --- a/src/components/ui/input/index.tsx +++ b/src/components/ui/input/index.tsx @@ -1,7 +1,13 @@ import { mdiEye, mdiEyeOff } from '@mdi/js'; import Icon from '@mdi/react'; import classnames from 'classnames'; -import { Component, createRef, InputHTMLAttributes } from 'react'; +import { + Component, + createRef, + InputHTMLAttributes, + ReactElement, + RefObject, +} from 'react'; import injectSheet, { WithStylesProps } from 'react-jss'; import { noop } from 'lodash'; import { IFormField } from '../typings/generic'; @@ -26,7 +32,7 @@ interface IProps showPasswordToggle?: boolean; data?: IData; inputClassName?: string; - onEnterKey?: Function; + onEnterKey?: () => {}; } interface IState { @@ -35,7 +41,7 @@ interface IState { } class InputComponent extends Component { - private inputRef = createRef(); + private inputRef: RefObject = createRef(); constructor(props: IProps) { super(props); @@ -73,14 +79,14 @@ class InputComponent extends Component { } } - onInputKeyPress(e: React.KeyboardEvent) { + onInputKeyPress(e: React.KeyboardEvent): void { if (e.key === 'Enter') { const { onEnterKey } = this.props; onEnterKey && onEnterKey(); } } - render() { + render(): ReactElement { const { classes, className, -- cgit v1.2.3-70-g09d2