Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: fix for swaps button displaying on unsupported networks #6473

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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