Skip to content

Commit

Permalink
save native value when focusing
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Jun 28, 2023
1 parent 6d6475a commit 78df99b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/entries/popup/hooks/swap/useSwapInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const useSwapInputs = ({
setAssetToSellNativeValue(value);
setIndependentField('sellNativeField');
setIndependentValue(value);

setAssetToSellValue(
value
? convertAmountFromNativeValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export const TokenToSellInfo = ({
assetToSellNativeValue,
]);

const onFocus = useCallback(() => {
setAssetToSellInputNativeValue(nativeFieldValue ?? '');
setIndependentField('sellNativeField');
}, [nativeFieldValue, setAssetToSellInputNativeValue, setIndependentField]);

if (!asset) return null;
return (
<Box width="full">
Expand Down Expand Up @@ -101,7 +106,7 @@ export const TokenToSellInfo = ({
fontFamily: 'rounded',
}),
]}
onFocus={() => setIndependentField('sellNativeField')}
onFocus={onFocus}
disabled={!asset?.native?.price?.amount}
/>
</Bleed>
Expand Down

0 comments on commit 78df99b

Please sign in to comment.