1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00
This commit is contained in:
Matthias Kretschmann 2019-11-07 13:57:21 +01:00
parent ccdef8143e
commit 826cb07953
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -21,13 +21,17 @@ export default class Pagination extends PureComponent<
private mq = window.matchMedia && window.matchMedia('(min-width: 600px)') private mq = window.matchMedia && window.matchMedia('(min-width: 600px)')
public componentDidMount() { public componentDidMount() {
if (window && window.matchMedia) {
this.mq.addListener(this.viewportChange) this.mq.addListener(this.viewportChange)
this.viewportChange(this.mq) this.viewportChange(this.mq)
} }
}
public componentWillUnmount() { public componentWillUnmount() {
if (window && window.matchMedia) {
this.mq.removeListener(this.viewportChange) this.mq.removeListener(this.viewportChange)
} }
}
private viewportChange = (mq: { matches: boolean }) => { private viewportChange = (mq: { matches: boolean }) => {
if (mq.matches) { if (mq.matches) {