Skip to content

Commit

Permalink
bugfix: fix for swaps button displaying on unsupported networks (#6473)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoferro authored Jun 7, 2023
1 parent e7c9419 commit bd283e2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/components/Views/Asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ class Asset extends PureComponent {
});
};

const displaySwapsButton =
isSwapsFeatureLive &&
isNetworkAllowed &&
isAssetAllowed &&
AppConstants.SWAPS.ACTIVE;

const displayBuyButton =
asset.isETH && this.props.isNetworkBuyNativeTokenSupported;

return (
<View style={styles.wrapper}>
{loading ? (
Expand All @@ -496,9 +505,9 @@ class Asset extends PureComponent {
onScrollThroughContent={this.onScrollThroughContent}
/>
)}
{!asset.balanceError && (
{!asset.balanceError && (displayBuyButton || displaySwapsButton) && (
<View style={styles.footer}>
{asset.isETH && this.props.isNetworkBuyNativeTokenSupported && (
{displayBuyButton && (
<Button
variant={ButtonVariants.Secondary}
size={ButtonSize.Lg}
Expand All @@ -511,11 +520,8 @@ class Asset extends PureComponent {
onPress={onBuy}
/>
)}
{AppConstants.SWAPS.ACTIVE && (
{displaySwapsButton && (
<Button
disabled={
!isSwapsFeatureLive || !isNetworkAllowed || !isAssetAllowed
}
variant={ButtonVariants.Primary}
size={ButtonSize.Lg}
label={strings('asset_overview.swap')}
Expand Down

0 comments on commit bd283e2

Please sign in to comment.