Skip to content

Commit

Permalink
fix: Use addListener instead of addEventListener for media queries (#394
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci authored Dec 17, 2020
1 parent adf740b commit 5104ef5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/src/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ on(layoutsB, layouts => {
listener = (mq: MediaQueryListEvent) => { if (mq.matches) layoutB({ layout, index }) },
bp: Breakpoint = { layout, min, max, mq, listener }

mq.addEventListener('change', listener)
mq.addListener(listener)
if (mq.matches) layoutB({ layout, index })

return bp
})

for (const { mq, listener } of breakpointsB()) mq.removeEventListener('change', listener)
for (const { mq, listener } of breakpointsB()) mq.removeListener(listener)
breakpointsB(bps)
})

Expand Down Expand Up @@ -166,6 +166,7 @@ const
css.width = zone.size
} else {
css.height = zone.size
css.minHeight = zone.size // Needed for Safari.
}
} else {
css.flexGrow = 1
Expand Down

0 comments on commit 5104ef5

Please sign in to comment.