summaryrefslogtreecommitdiff
path: root/src/components/Input.tsx
diff options
context:
space:
mode:
authorMatain <[email protected]>2022-06-12 23:34:56 +0800
committerMatain <[email protected]>2022-06-12 23:34:56 +0800
commitea5d7cf003eeef30cb7bbe789c6ba7f314bf1ce4 (patch)
treebff1bd7b0e8e8eb753d373b57f007bbe97f96c76 /src/components/Input.tsx
parent4fd2c8f646e48dd0c07d0c2041de52e9a4f8bc82 (diff)
parent38571da24ac54137564be5e41b7a409009e2ee10 (diff)
Merge branch 'master' of https://github.com/haishanh/yacd into haishanh-master
Diffstat (limited to 'src/components/Input.tsx')
-rw-r--r--src/components/Input.tsx17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/components/Input.tsx b/src/components/Input.tsx
index c132a3b..efb5665 100644
--- a/src/components/Input.tsx
+++ b/src/components/Input.tsx
@@ -7,7 +7,8 @@ const { useState, useRef, useEffect, useCallback } = React;
type InputProps = {
value?: string | number;
type?: string;
- onChange?: (...args: any[]) => any;
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
name?: string;
placeholder?: string;
};
@@ -26,17 +27,7 @@ export function SelfControlledInput({ value, ...restProps }) {
}
refValue.current = value;
}, [value]);
- const onChange = useCallback(
- (e) => setInternalValue(e.target.value),
- [setInternalValue]
- );
+ const onChange = useCallback((e) => setInternalValue(e.target.value), [setInternalValue]);
- return (
- <input
- className={s0.input}
- value={internalValue}
- onChange={onChange}
- {...restProps}
- />
- );
+ return <input className={s0.input} value={internalValue} onChange={onChange} {...restProps} />;
}