From f23231627a37835b6fbfade605ec7eed31db52be Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Tue, 11 Jun 2024 14:20:46 -0400 Subject: [PATCH] fixes chain badge not respecting pixel ratio on android (#5833) --- .../screens/Swap/components/AnimatedChainImage.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/__swaps__/screens/Swap/components/AnimatedChainImage.tsx b/src/__swaps__/screens/Swap/components/AnimatedChainImage.tsx index a7656ca54eb..30b5c1a67e4 100644 --- a/src/__swaps__/screens/Swap/components/AnimatedChainImage.tsx +++ b/src/__swaps__/screens/Swap/components/AnimatedChainImage.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Image, StyleSheet, View } from 'react-native'; +import { Image, PixelRatio, StyleSheet, View } from 'react-native'; import ArbitrumBadge from '@/assets/badges/arbitrum.png'; import BaseBadge from '@/assets/badges/base.png'; @@ -20,6 +20,7 @@ import { globalColors } from '@/design-system'; import { customChainIdsToAssetNames } from '@/__swaps__/utils/chains'; import { AddressZero } from '@ethersproject/constants'; import { ETH_ADDRESS } from '@/references'; +import { IS_ANDROID } from '@/env'; const networkBadges = { [ChainId.mainnet]: Image.resolveAssetSource(EthereumBadge).uri, @@ -44,6 +45,8 @@ const networkBadges = { [ChainId.degen]: Image.resolveAssetSource(DegenBadge).uri, }; +const PIXEL_RATIO = PixelRatio.get(); + export const getCustomChainIconUrlWorklet = (chainId: ChainId, address: AddressOrEth) => { 'worklet'; @@ -70,7 +73,7 @@ export function AnimatedChainImage({ const base = { source: { ...DEFAULT_FASTER_IMAGE_CONFIG, - borderRadius: size / 2, + borderRadius: IS_ANDROID ? (size / 2) * PIXEL_RATIO : undefined, url: '', }, };