Skip to content

Commit

Permalink
Update components using FastCoinIcon to pass network instead of asset…
Browse files Browse the repository at this point in the history
…Type
  • Loading branch information
jinchung committed Oct 21, 2023
1 parent c682bda commit e9833ed
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const MemoizedBalanceCoinRow = React.memo(
<View style={[sx.container]}>
<FastCoinIcon
address={item.address}
assetType={item.type}
network={item.network}
mainnetAddress={item.mainnet_address}
symbol={item.symbol}
theme={theme}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default React.memo(function FastCurrencySelectionRow({
<View style={sx.rootContainer}>
<FastCoinIcon
address={address || item?.address}
assetType={type ?? item?.type}
network={network}
mainnetAddress={mainnet_address ?? item?.mainnet_address}
symbol={symbol ?? item?.symbol}
theme={theme}
Expand Down
15 changes: 12 additions & 3 deletions src/components/coin-icon/CoinIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import { Network } from '@/helpers';
import { useColorForAsset } from '@/hooks';
import { ImgixImage } from '@/components/images';
import styled from '@/styled-thing';
import { isETH, magicMemo, CoinIcon as ReactCoinIcon } from '@/utils';
import {
ethereumUtils,
isETH,
magicMemo,
CoinIcon as ReactCoinIcon,
} from '@/utils';
import { ChainBadgeType } from '@/components/coin-icon/ChainBadgeSizeConfigs';

export const CoinIconSize = 40;
Expand All @@ -33,7 +38,7 @@ type Props = {
forcedShadowColor?: string;
size?: number;
symbol?: string;
type?: string;
type: string;
mainnet_address?: string;
shadowOpacity?: number;
} & Pick<ViewProps, 'testID' | 'style'>;
Expand Down Expand Up @@ -62,6 +67,10 @@ const CoinIcon: React.FC<Props> = ({

const theme = useTheme();

const network = mainnet_address
? Network.mainnet
: ethereumUtils.getNetworkFromType(type);

return (
<View>
{isNotContractInteraction ? (
Expand All @@ -78,7 +87,7 @@ const CoinIcon: React.FC<Props> = ({
}
size={size}
symbol={symbol}
network={mainnet_address ? Network.mainnet : type}
network={network}
theme={theme}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions src/components/coin-row/FastTransactionCoinRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo } from 'react';
import React, { useCallback } from 'react';
import { StyleSheet, View } from 'react-native';
import { ButtonPressAnimation } from '../animations';
import FastCoinIcon from '../asset-list/RecyclerAssetList2/FastComponents/FastCoinIcon';
Expand Down Expand Up @@ -154,7 +154,7 @@ export default React.memo(function TransactionCoinRow({
) : (
<FastCoinIcon
address={mainnetAddress || item.address}
assetType={item.network}
network={item.network}
mainnetAddress={mainnetAddress}
symbol={item.symbol}
theme={theme}
Expand Down
2 changes: 1 addition & 1 deletion src/components/exchange/ExchangeTokenRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default React.memo(function ExchangeTokenRow({
<Box
as={FastCoinIcon}
address={address || item?.address}
assetType={type ?? item?.type}
network={network}
mainnetAddress={mainnet_address ?? item?.mainnet_address}
symbol={symbol ?? item?.symbol}
theme={theme}
Expand Down

0 comments on commit e9833ed

Please sign in to comment.