Skip to content

Commit

Permalink
fixes chain badge not respecting pixel ratio on android (#5833)
Browse files Browse the repository at this point in the history
  • Loading branch information
walmat authored Jun 11, 2024
1 parent 2654e86 commit f232316
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/__swaps__/screens/Swap/components/AnimatedChainImage.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand All @@ -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';

Expand All @@ -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: '',
},
};
Expand Down

0 comments on commit f232316

Please sign in to comment.