From d8400cf1d922347110de356d053f087c01445128 Mon Sep 17 00:00:00 2001 From: elocin Date: Tue, 23 Jan 2024 04:24:21 +0800 Subject: [PATCH] fix(core): fixed issue of tokens not showing in EVM domain (#4166) * added check for evm empty portfolio * updated condition --- .../AppNavigator/screens/Portfolio/PortfolioScreen.tsx | 7 ++++++- .../screens/Portfolio/components/PortfolioCard.tsx | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx index cb0ea37076..cefc8676d4 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx @@ -132,6 +132,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element { const dispatch = useAppDispatch(); const [refreshing, setRefreshing] = useState(false); const [isZeroBalance, setIsZeroBalance] = useState(true); + const [isEvmZeroBalance, setIsEvmZeroBalance] = useState(true); const { hasFetchedToken, allTokens } = useSelector( (state: RootState) => state.wallet, ); @@ -455,7 +456,10 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element { setIsZeroBalance( !tokens.some((token) => new BigNumber(token.amount).isGreaterThan(0)), ); - }, [tokens]); + setIsEvmZeroBalance( + !evmTokens.some((token) => new BigNumber(token.amount).isGreaterThan(0)), + ); + }, [tokens, evmTokens]); const assetSortBottomSheetScreen = useMemo(() => { return [ @@ -695,6 +699,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element { ) : ( ; buttonGroupOptions?: { @@ -35,6 +36,7 @@ interface PortfolioCardProps { export function PortfolioCard({ isZeroBalance, + isEvmZeroBalance, filteredTokens, navigation, buttonGroupOptions, @@ -44,7 +46,7 @@ export function PortfolioCard({ const { hasFetchedToken } = useSelector((state: RootState) => state.wallet); const { domain } = useDomainContext(); // return empty portfolio if no DFI and other tokens - if (isZeroBalance) { + if ((isZeroBalance && !isEvmDomain) || (isEvmZeroBalance && isEvmDomain)) { const screenDetails = getEmptyScreenDetails( ButtonGroupTabKey.AllTokens, domain,