fix missing indicator on account change

pull/374/head
slowbackspace 5 years ago
parent 4e11e3ee0d
commit e116cb17cd

@ -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>
);
}

Loading…
Cancel
Save