No longer deconstructing account menu ref if it isn't rendered (#11585)

feature/default_network_editable
ryanml 3 years ago committed by GitHub
parent 68c852f7c9
commit a96af9e5fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      ui/components/app/account-menu/account-menu.component.js

@ -253,12 +253,13 @@ export default class AccountMenu extends Component {
}
setShouldShowScrollButton = () => {
const { scrollTop, offsetHeight, scrollHeight } = this.accountsRef;
if (!this.accountsRef) {
return;
}
const { scrollTop, offsetHeight, scrollHeight } = this.accountsRef;
const canScroll = scrollHeight > offsetHeight;
const atAccountListBottom = scrollTop + offsetHeight >= scrollHeight;
const shouldShowScrollButton = canScroll && !atAccountListBottom;
this.setState({ shouldShowScrollButton });

Loading…
Cancel
Save