1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-22 14:00:58 +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'>,
selectedAccount: $ElementType<State, 'selectedAccount'>,
};
type StateProps = {
wrapper: ?HTMLElement,
};
const Wrapper = styled.div`
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) => {
this.wrapper = element;
this.forceUpdate();
this.setState({
wrapper: element,
});
}
wrapper: ?HTMLElement;
@ -90,7 +101,7 @@ class TopNavigationAccount extends React.PureComponent<Props> {
{network.type === 'ethereum'
&& <StyledNavLink to={`${basePath}/signverify`}>Sign &amp; Verify</StyledNavLink>
}
<Indicator pathname={pathname} wrapper={() => this.wrapper} />
<Indicator pathname={pathname} wrapper={() => this.state.wrapper} />
</Wrapper>
);
}