do not open keyboard on page load
This commit is contained in:
parent
30b0d4d394
commit
21b2e983eb
@ -78,11 +78,18 @@ function useDebouncedOnChangeCallback(
|
||||
|
||||
function useFocus(isPending: boolean) {
|
||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||
const [isInitialRender, setIsInitialRender] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (inputRef.current) {
|
||||
if (isInitialRender) {
|
||||
setIsInitialRender(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (inputRef.current && isPending) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
}, [isPending]);
|
||||
}, [isInitialRender, isPending]);
|
||||
|
||||
return inputRef;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user