fixes 'Video player out of whack after resize of window #3423' by adding event listeners prior to cleanup

This commit is contained in:
Dalton 2019-12-30 21:09:20 -06:00 committed by Sean Yesmunt
parent c5c02f0ad9
commit aa16c83f27

View file

@ -105,10 +105,10 @@ export default function FileViewer(props: Props) {
setFileViewerRect(rect);
}
handleResize();
window.addEventListener('resize', handleResize);
onFullscreenChange(window, 'add', handleResize);
return () => {
handleResize();
window.addEventListener('resize', handleResize);
onFullscreenChange(window, 'add', handleResize);
window.removeEventListener('resize', handleResize);
onFullscreenChange(window, 'remove', handleResize);
};