Skip to content

Commit

Permalink
input asset regression fix on v1
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobar79 authored and ibrahimtaveras00 committed Jun 25, 2024
1 parent 954bd38 commit 371f6e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/sheet/sheet-action-buttons/SwapActionButton.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 371f6e7

Please sign in to comment.