Skip to content

Commit

Permalink
[5.3] bugfix: for network asset education modal when network is added (
Browse files Browse the repository at this point in the history
…#4552)

* educational modal should close when a network is added from popular network

* network asset education modal shouldn't not be minimised without tapping on the CTA button

* refactor value into variable

* refactor value into variable
  • Loading branch information
blackdevelopa authored Jun 22, 2022
1 parent 987504b commit ef04558
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions app/components/UI/DrawerView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ class DrawerView extends PureComponent {
currentRoute,
networkOnboarding,
networkOnboardedState,
switchedNetwork,
switchedNetwork: { networkUrl, networkStatus },
networkModalVisible,
} = this.props;
const colors = this.context.colors || mockTheme.colors;
Expand Down Expand Up @@ -1196,9 +1196,19 @@ class DrawerView extends PureComponent {
const fiatBalanceStr = renderFiat(this.currentBalance, currentCurrency);
const accountName = isDefaultAccountName(name) && ens ? ens : name;
const checkIfCustomNetworkExists = networkOnboardedState.filter(
(item) => item.network === sanitizeUrl(switchedNetwork.networkUrl),
(item) => item.network === sanitizeUrl(networkUrl),
);

const networkSwitchedAndInWalletView =
currentRoute === 'WalletView' &&
networkStatus &&
checkIfCustomNetworkExists.length === 0;

const canShowNetworkInfoModal =
showModal ||
networkOnboarding.showNetworkOnboarding ||
networkSwitchedAndInWalletView;

return (
<View style={styles.wrapper} testID={'drawer-screen'}>
<ScrollView>
Expand Down Expand Up @@ -1365,19 +1375,17 @@ class DrawerView extends PureComponent {
isVisible={
networkModalVisible || networkOnboarding.showNetworkOnboarding
}
onBackdropPress={showModal ? null : this.toggleNetworksModal}
onBackdropPress={
canShowNetworkInfoModal ? null : this.toggleNetworksModal
}
onBackButtonPress={showModal ? null : this.toggleNetworksModa}
onSwipeComplete={showModal ? null : this.toggleNetworksModa}
swipeDirection={'down'}
propagateSwipe
backdropColor={colors.overlay.default}
backdropOpacity={1}
>
{showModal ||
networkOnboarding.showNetworkOnboarding ||
(currentRoute === 'WalletView' &&
switchedNetwork.networkStatus &&
checkIfCustomNetworkExists.length === 0) ? (
{canShowNetworkInfoModal ? (
<NetworkInfo
onClose={this.onInfoNetworksModalClose}
type={networkType || networkOnboarding.networkType}
Expand Down

0 comments on commit ef04558

Please sign in to comment.