diff options
Diffstat (limited to 'packages/bank/src/components/fields/NumberInput.tsx')
-rw-r--r-- | packages/bank/src/components/fields/NumberInput.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/bank/src/components/fields/NumberInput.tsx b/packages/bank/src/components/fields/NumberInput.tsx index 196d5ca..881c61c 100644 --- a/packages/bank/src/components/fields/NumberInput.tsx +++ b/packages/bank/src/components/fields/NumberInput.tsx @@ -14,9 +14,9 @@ export interface TextInputProps { export function PhoneNumberInput(props: TextInputProps): VNode { const inputRef = useRef<HTMLInputElement>(null); useLayoutEffect(() => { - if (props.grabFocus) { + if (props.grabFocus) inputRef.current?.focus(); - } + }, [props.grabFocus]); const value = props.bind[0]; const [dirty, setDirty] = useState(false); @@ -38,9 +38,9 @@ export function PhoneNumberInput(props: TextInputProps): VNode { placeholder={props.placeholder} class={showError ? 'input is-danger' : 'input'} onKeyPress={(e) => { - if (e.key === 'Enter' && props.onConfirm) { + if (e.key === 'Enter' && props.onConfirm) props.onConfirm() - } + }} onInput={(e) => { setDirty(true); |