From 371f6e70c01e1f916a1294932537a26d1b529141 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Mon, 24 Jun 2024 19:57:39 -0400 Subject: [PATCH] input asset regression fix on v1 --- .../sheet/sheet-action-buttons/SwapActionButton.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/sheet/sheet-action-buttons/SwapActionButton.tsx b/src/components/sheet/sheet-action-buttons/SwapActionButton.tsx index df93878873c..0615f2f4f0c 100644 --- a/src/components/sheet/sheet-action-buttons/SwapActionButton.tsx +++ b/src/components/sheet/sheet-action-buttons/SwapActionButton.tsx @@ -1,7 +1,7 @@ import lang from 'i18n-js'; import React, { useCallback } from 'react'; import SheetActionButton from './SheetActionButton'; -import { useExpandedStateNavigation, useWallets } from '@/hooks'; +import { useExpandedStateNavigation, useSwapCurrencyHandlers, useWallets } from '@/hooks'; import Routes from '@/navigation/routesNames'; import { useTheme } from '@/theme'; import { RainbowToken } from '@/entities'; @@ -16,6 +16,7 @@ import assetInputTypes from '@/helpers/assetInputTypes'; import { swapsStore } from '@/state/swaps/swapsStore'; import { InteractionManager } from 'react-native'; import { AddressOrEth, AssetType, ParsedSearchAsset } from '@/__swaps__/types/assets'; +import exchangeModalTypes from '@/helpers/exchangeModalTypes'; type SwapActionButtonProps = { asset: RainbowToken; @@ -35,6 +36,13 @@ function SwapActionButton({ asset, color: givenColor, inputType, label, fromDisc const color = givenColor || colors.swapPurple; + useSwapCurrencyHandlers({ + defaultInputAsset: inputType === assetInputTypes.in ? asset : null, + defaultOutputAsset: inputType === assetInputTypes.out ? asset : null, + shouldUpdate: true, + type: exchangeModalTypes.swap, + }); + const old_navigate = useExpandedStateNavigation(inputType, fromDiscover, asset); const goToSwap = useCallback(async () => { if (swapsV2Enabled || swaps_v2) {