1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-14 02:28:21 +00:00

fix missing indicator on account change

This commit is contained in:
slowbackspace 2019-02-19 17:07:44 +01:00
parent 4e11e3ee0d
commit e116cb17cd

View File

@ -14,6 +14,9 @@ type Props = {
router: $ElementType<State, 'router'>, router: $ElementType<State, 'router'>,
selectedAccount: $ElementType<State, 'selectedAccount'>, selectedAccount: $ElementType<State, 'selectedAccount'>,
}; };
type StateProps = {
wrapper: ?HTMLElement,
};
const Wrapper = styled.div` const Wrapper = styled.div`
position: relative; position: relative;
@ -66,10 +69,18 @@ const StyledNavLink = styled(NavLink)`
} }
`; `;
class TopNavigationAccount extends React.PureComponent<Props> { class TopNavigationAccount extends React.PureComponent<Props, StateProps> {
constructor(props) {
super(props);
this.state = {
wrapper: null,
};
}
wrapperRefCallback = (element: ?HTMLElement) => { wrapperRefCallback = (element: ?HTMLElement) => {
this.wrapper = element; this.setState({
this.forceUpdate(); wrapper: element,
});
} }
wrapper: ?HTMLElement; wrapper: ?HTMLElement;
@ -90,7 +101,7 @@ class TopNavigationAccount extends React.PureComponent<Props> {
{network.type === 'ethereum' {network.type === 'ethereum'
&& <StyledNavLink to={`${basePath}/signverify`}>Sign &amp; Verify</StyledNavLink> && <StyledNavLink to={`${basePath}/signverify`}>Sign &amp; Verify</StyledNavLink>
} }
<Indicator pathname={pathname} wrapper={() => this.wrapper} /> <Indicator pathname={pathname} wrapper={() => this.state.wrapper} />
</Wrapper> </Wrapper>
); );
} }