Skip to content

Commit

Permalink
fix(mobile): reflect token fiat value in account list (#14446)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nodonisko authored Sep 21, 2024
1 parent 1a4daf5 commit 95604a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
24 changes: 19 additions & 5 deletions suite-native/accounts/src/components/AccountListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { useFormatters } from '@suite-common/formatters';
import { AccountsRootState, selectFormattedAccountType } from '@suite-common/wallet-core';
import { Account, AccountKey } from '@suite-common/wallet-types';
import { Badge, RoundedIcon } from '@suite-native/atoms';
import { CryptoAmountFormatter, CryptoToFiatAmountFormatter } from '@suite-native/formatters';
import {
CryptoAmountFormatter,
CryptoToFiatAmountFormatter,
FiatAmountFormatter,
} from '@suite-native/formatters';
import { Translation } from '@suite-native/intl';
import {
isCoinWithTokens,
Expand All @@ -19,6 +23,7 @@ import { AccountListItemBase } from './AccountListItemBase';

export type AccountListItemProps = {
account: Account;
fiatBalance?: string | null;
hideTokens?: boolean;

onPress?: TouchableOpacityProps['onPress'];
Expand All @@ -44,6 +49,7 @@ export const AccountListItem = ({
onPress,
disabled,
hideTokens = false,
fiatBalance,
}: AccountListItemProps) => {
const { accountLabel } = account;
const { NetworkNameFormatter } = useFormatters();
Expand Down Expand Up @@ -80,10 +86,18 @@ export const AccountListItem = ({
</>
}
mainValue={
<CryptoToFiatAmountFormatter
value={account.availableBalance}
network={account.symbol}
/>
shouldShowTokenBadge && fiatBalance !== undefined ? (
<FiatAmountFormatter
numberOfLines={1}
adjustsFontSizeToFit
value={fiatBalance}
/>
) : (
<CryptoToFiatAmountFormatter
value={account.availableBalance}
network={account.symbol}
/>
)
}
secondaryValue={
<CryptoAmountFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const AccountListItemInteractive = ({
key={account.key}
account={account}
hideTokens={hideTokens}
fiatBalance={fiatBalance}
onPress={() =>
onSelectAccount({
account,
Expand Down

0 comments on commit 95604a1

Please sign in to comment.