mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-01-12 22:53:27 +08:00
fix: remove disabling on send input click
This commit is contained in:
@@ -38,6 +38,7 @@ interface AmountFieldProps {
|
||||
isSendingMax?: boolean;
|
||||
switchableAmount?: React.JSX.Element;
|
||||
tokenSymbol?: string;
|
||||
onSetIsSendingMax?(value: boolean): void;
|
||||
}
|
||||
export function AmountField({
|
||||
autoComplete = 'on',
|
||||
@@ -45,10 +46,11 @@ export function AmountField({
|
||||
balance,
|
||||
bottomInputOverlay,
|
||||
isSendingMax,
|
||||
onSetIsSendingMax,
|
||||
switchableAmount,
|
||||
tokenSymbol,
|
||||
}: AmountFieldProps) {
|
||||
const [field, meta] = useField('amount');
|
||||
const [field, meta, helpers] = useField('amount');
|
||||
const [fontSize, setFontSize] = useState(maxFontSize);
|
||||
const [previousTextLength, setPreviousTextLength] = useState(1);
|
||||
|
||||
@@ -89,8 +91,16 @@ export function AmountField({
|
||||
|
||||
// TODO: could be implemented with html using padded label element
|
||||
const onClickFocusInput = useCallback(() => {
|
||||
document.getElementById(amountInputId)?.focus();
|
||||
}, []);
|
||||
if (isSendingMax) {
|
||||
helpers.setValue('');
|
||||
onSetIsSendingMax?.(false);
|
||||
}
|
||||
|
||||
// put focus in the queue, otherwise it won't work
|
||||
setTimeout(() => {
|
||||
document.getElementById(amountInputId)?.focus();
|
||||
});
|
||||
}, [isSendingMax, helpers, onSetIsSendingMax]);
|
||||
|
||||
return (
|
||||
<Stack
|
||||
|
||||
@@ -58,7 +58,7 @@ export function BitcoinSendMaxButton({
|
||||
width="fit-content"
|
||||
{...props}
|
||||
>
|
||||
Sending max
|
||||
{isSendingMax ? 'Sending max' : 'Send max'}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
@@ -73,6 +73,7 @@ export function BtcSendForm() {
|
||||
sendMaxFee={sendMaxCalculation.spendAllFee.toString()}
|
||||
/>
|
||||
}
|
||||
onSetIsSendingMax={onSetIsSendingMax}
|
||||
isSendingMax={isSendingMax}
|
||||
switchableAmount={
|
||||
<SendFiatValue marketData={btcMarketData} assetSymbol={'BTC'} />
|
||||
|
||||
Reference in New Issue
Block a user