1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 17:28:10 +00:00

Fix eslint errors

This commit is contained in:
Vasek Mlejnsky 2018-08-17 06:48:12 +02:00
parent fa52ec41ca
commit 4b9ebce7d0

View File

@ -35,20 +35,12 @@ export default class StickyContainer extends React.PureComponent<Props> {
subscribers = []; subscribers = [];
handleResize = (event: Event) => { // handleResize = (event: Event) => {
} // }
handleScroll = (event: ?Event) => {
if (!this.framePending) {
this.framePending = true;
raf(this.update);
}
}
shouldUpdate = () => { shouldUpdate = () => {
const wrapper: ?HTMLElement = this.wrapper; const { wrapper, aside }: {wrapper: ?HTMLElement, aside: ?HTMLElement} = this;
const aside: ?HTMLElement = this.aside;
if (!wrapper || !aside) return; if (!wrapper || !aside) return;
const bottom: ?HTMLElement = wrapper.querySelector('.sticky-bottom'); const bottom: ?HTMLElement = wrapper.querySelector('.sticky-bottom');
if (!bottom) return; if (!bottom) return;
@ -107,11 +99,6 @@ export default class StickyContainer extends React.PureComponent<Props> {
raf(this.update); raf(this.update);
} }
componentWillUnmount() {
window.removeEventListener('scroll', this.handleScroll);
window.removeEventListener('resize', this.handleScroll);
}
componentDidUpdate(prevProps: Props) { componentDidUpdate(prevProps: Props) {
if (this.props.location !== prevProps.location && this.aside) { if (this.props.location !== prevProps.location && this.aside) {
const asideBounds = this.aside.getBoundingClientRect(); const asideBounds = this.aside.getBoundingClientRect();
@ -128,6 +115,18 @@ export default class StickyContainer extends React.PureComponent<Props> {
} }
} }
componentWillUnmount() {
window.removeEventListener('scroll', this.handleScroll);
window.removeEventListener('resize', this.handleScroll);
}
handleScroll = (/* event: ?Event */) => {
if (!this.framePending) {
this.framePending = true;
raf(this.update);
}
}
render() { render() {
return ( return (
<aside <aside