1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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

This commit is contained in:
ryanml 2021-07-22 11:42:44 -07:00 committed by GitHub
parent 68c852f7c9
commit a96af9e5fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,12 +253,13 @@ export default class AccountMenu extends Component {
}
setShouldShowScrollButton = () => {
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 });