File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -211,14 +211,17 @@ export const SwapCreateScene = (props: Props) => {
211
211
toTokenId : fromTokenId ,
212
212
errorDisplayInfo
213
213
} )
214
- const newNativeAmountFor = inputNativeAmountFor === 'from' ? 'to' : 'from'
215
214
// Clear amount input state:
216
- setInputNativeAmountFor ( newNativeAmountFor )
215
+ setInputNativeAmountFor ( inputNativeAmountFor === 'from' ? 'to' : 'from' )
216
+
217
217
// Swap the amounts:
218
- const toAmount = newNativeAmountFor === 'to' ? inputFiatAmount : '0'
219
- const fromAmount = newNativeAmountFor === 'from' ? inputFiatAmount : '0'
220
- toInputRef . current ?. setAmount ( 'fiat' , toAmount )
221
- fromInputRef . current ?. setAmount ( 'fiat' , fromAmount )
218
+ if ( inputNativeAmountFor === 'from' ) {
219
+ fromInputRef . current ?. setAmount ( 'fiat' , '0' )
220
+ toInputRef . current ?. setAmount ( 'fiat' , inputFiatAmount )
221
+ } else {
222
+ toInputRef . current ?. setAmount ( 'fiat' , '0' )
223
+ fromInputRef . current ?. setAmount ( 'fiat' , inputFiatAmount )
224
+ }
222
225
} )
223
226
224
227
const handleSelectWallet = useHandler ( async ( walletId : string , tokenId : EdgeTokenId , direction : 'from' | 'to' ) => {
You can’t perform that action at this time.
0 commit comments