From 03d6e1322653159102e45e042a9f6db28c781124 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Wed, 27 Sep 2023 10:55:48 +0300 Subject: [PATCH] submit pin prompt by pressing enter --- packages/app/src/Element/AsyncButton.tsx | 3 +- packages/app/src/Element/PinPrompt.tsx | 56 ++++++++++++++---------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/packages/app/src/Element/AsyncButton.tsx b/packages/app/src/Element/AsyncButton.tsx index c4118afa..180ea705 100644 --- a/packages/app/src/Element/AsyncButton.tsx +++ b/packages/app/src/Element/AsyncButton.tsx @@ -6,6 +6,7 @@ interface AsyncButtonProps extends React.ButtonHTMLAttributes disabled?: boolean; onClick(e: React.MouseEvent): Promise | void; children?: React.ReactNode; + ref?: React.Ref; } export default function AsyncButton(props: AsyncButtonProps) { @@ -28,7 +29,7 @@ export default function AsyncButton(props: AsyncButtonProps) { } return ( - - submitPin()}> - - +
{ + e.preventDefault(); + if (submitButtonRef.current) { + submitButtonRef.current.click(); + } + }} + > +
+

+ +

+ {subTitle} + setPin(e.target.value)} + value={pin} + autoFocus={true} + maxLength={20} + minLength={4} + /> + {error && {error}} +
+ + submitPin()} type="submit"> + + +
- +
); }