diff --git a/src/views/Wallet/components/LeftNavigation/components/AccountMenu/index.js b/src/views/Wallet/components/LeftNavigation/components/AccountMenu/index.js index 4ebb7cb7..cc64b98f 100644 --- a/src/views/Wallet/components/LeftNavigation/components/AccountMenu/index.js +++ b/src/views/Wallet/components/LeftNavigation/components/AccountMenu/index.js @@ -141,7 +141,7 @@ const AccountMenu = (props: Props) => { {...l10nCommonMessages.TR_ACCOUNT_HASH} values={{ number: account.index + 1 }} /> - {balance && ( + {balance && !props.wallet.hideBalance && ( {balance} {fiatRates && ( diff --git a/src/views/Wallet/views/Account/Summary/components/Balance/index.js b/src/views/Wallet/views/Account/Summary/components/Balance/index.js index f20a4d7a..2dc821ca 100644 --- a/src/views/Wallet/views/Account/Summary/components/Balance/index.js +++ b/src/views/Wallet/views/Account/Summary/components/Balance/index.js @@ -17,6 +17,7 @@ type Props = { balance: string, fiat: $ElementType, localCurrency: string, + isHidden: boolean, }; type State = { @@ -105,11 +106,19 @@ class AccountBalance extends PureComponent { constructor(props: Props) { super(props); this.state = { - isHidden: false, - canAnimateHideBalanceIcon: false, + isHidden: props.isHidden, + canAnimateHideBalanceIcon: props.isHidden, }; } + componentDidUpdate(prevProps) { + if (prevProps.isHidden !== this.props.isHidden) { + this.setState({ + isHidden: this.props.isHidden, + }); + } + } + handleHideBalanceIconClick() { this.setState(previousState => ({ isHidden: !previousState.isHidden, diff --git a/src/views/Wallet/views/Account/Summary/components/Token/index.js b/src/views/Wallet/views/Account/Summary/components/Token/index.js index e4791f28..ae6e2f5b 100644 --- a/src/views/Wallet/views/Account/Summary/components/Token/index.js +++ b/src/views/Wallet/views/Account/Summary/components/Token/index.js @@ -84,7 +84,11 @@ class AddedToken extends PureComponent { {this.props.token.name} - {this.getTokenBalance(this.props.token)} {this.props.token.symbol} + {this.props.hideBalance ? ( + + ) : ( + `${this.getTokenBalance(this.props.token)} ${this.props.token.symbol}` + )} { balance={balance} fiat={props.fiat} localCurrency={props.wallet.localCurrency} + isHidden={props.wallet.hideBalance} />

@@ -164,6 +165,7 @@ const AccountSummary = (props: Props) => { token={token} pending={pending} removeToken={props.removeToken} + hideBalance={props.wallet.hideBalance} /> ))} diff --git a/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js b/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js index 967b9f83..fcbd25ba 100644 --- a/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js +++ b/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js @@ -15,6 +15,7 @@ type Props = { reserve: string, fiat: $ElementType, localCurrency: string, + isHidden: boolean, }; type State = { @@ -103,11 +104,20 @@ class AccountBalance extends PureComponent { constructor(props: Props) { super(props); this.state = { - isHidden: false, - canAnimateHideBalanceIcon: false, + isHidden: props.isHidden, + canAnimateHideBalanceIcon: props.isHidden, }; } + componentDidUpdate(prevProps) { + console.log(this.props.isHidden); + if (prevProps.isHidden !== this.props.isHidden) { + this.setState({ + isHidden: this.props.isHidden, + }); + } + } + handleHideBalanceIconClick() { this.setState(previousState => ({ isHidden: !previousState.isHidden, diff --git a/src/views/Wallet/views/Account/Summary/ripple/index.js b/src/views/Wallet/views/Account/Summary/ripple/index.js index 7ff6b32b..75706096 100644 --- a/src/views/Wallet/views/Account/Summary/ripple/index.js +++ b/src/views/Wallet/views/Account/Summary/ripple/index.js @@ -86,6 +86,7 @@ const AccountSummary = (props: Props) => { reserve={reserve} fiat={props.fiat} localCurrency={props.wallet.localCurrency} + isHidden={props.wallet.hideBalance} /> {TMP_SHOW_HISTORY && (