From 4e11e3ee0d6cf65e710f1105e8173eb70f0b8986 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Tue, 19 Feb 2019 15:49:17 +0100 Subject: [PATCH 1/3] fix missing indicator on account change --- src/views/Wallet/components/TopNavigationAccount/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/Wallet/components/TopNavigationAccount/index.js b/src/views/Wallet/components/TopNavigationAccount/index.js index 94977803..8d41e095 100644 --- a/src/views/Wallet/components/TopNavigationAccount/index.js +++ b/src/views/Wallet/components/TopNavigationAccount/index.js @@ -69,6 +69,7 @@ const StyledNavLink = styled(NavLink)` class TopNavigationAccount extends React.PureComponent { wrapperRefCallback = (element: ?HTMLElement) => { this.wrapper = element; + this.forceUpdate(); } wrapper: ?HTMLElement; From e116cb17cd879bee73caac076682be6cd8276469 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Tue, 19 Feb 2019 17:07:44 +0100 Subject: [PATCH 2/3] fix missing indicator on account change --- .../components/TopNavigationAccount/index.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/views/Wallet/components/TopNavigationAccount/index.js b/src/views/Wallet/components/TopNavigationAccount/index.js index 8d41e095..a320ebcc 100644 --- a/src/views/Wallet/components/TopNavigationAccount/index.js +++ b/src/views/Wallet/components/TopNavigationAccount/index.js @@ -14,6 +14,9 @@ type Props = { router: $ElementType, selectedAccount: $ElementType, }; +type StateProps = { + wrapper: ?HTMLElement, +}; const Wrapper = styled.div` position: relative; @@ -66,10 +69,18 @@ const StyledNavLink = styled(NavLink)` } `; -class TopNavigationAccount extends React.PureComponent { +class TopNavigationAccount extends React.PureComponent { + constructor(props) { + super(props); + this.state = { + wrapper: null, + }; + } + wrapperRefCallback = (element: ?HTMLElement) => { - this.wrapper = element; - this.forceUpdate(); + this.setState({ + wrapper: element, + }); } wrapper: ?HTMLElement; @@ -90,7 +101,7 @@ class TopNavigationAccount extends React.PureComponent { {network.type === 'ethereum' && Sign & Verify } - this.wrapper} /> + this.state.wrapper} /> ); } From 0422dc78baed5d4dce74e566818f324f17f6d9d6 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Tue, 19 Feb 2019 17:21:17 +0100 Subject: [PATCH 3/3] rename types --- src/views/Wallet/components/TopNavigationAccount/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/Wallet/components/TopNavigationAccount/index.js b/src/views/Wallet/components/TopNavigationAccount/index.js index a320ebcc..192c1164 100644 --- a/src/views/Wallet/components/TopNavigationAccount/index.js +++ b/src/views/Wallet/components/TopNavigationAccount/index.js @@ -14,7 +14,7 @@ type Props = { router: $ElementType, selectedAccount: $ElementType, }; -type StateProps = { +type LocalState = { wrapper: ?HTMLElement, }; @@ -69,7 +69,7 @@ const StyledNavLink = styled(NavLink)` } `; -class TopNavigationAccount extends React.PureComponent { +class TopNavigationAccount extends React.PureComponent { constructor(props) { super(props); this.state = {