use fullscreen polyfill

This commit is contained in:
Baltazar Gomez 2019-10-13 16:28:12 -06:00 committed by Sean Yesmunt
parent 242e0cdc19
commit a2b48ccc34

View file

@ -11,6 +11,7 @@ import usePrevious from 'effects/use-previous';
import { FILE_WRAPPER_CLASS } from 'page/file/view'; import { FILE_WRAPPER_CLASS } from 'page/file/view';
import Draggable from 'react-draggable'; import Draggable from 'react-draggable';
import Tooltip from 'component/common/tooltip'; import Tooltip from 'component/common/tooltip';
import { onFullscreenChange } from 'util/full-screen';
type Props = { type Props = {
mediaType: string, mediaType: string,
@ -98,10 +99,10 @@ export default function FileViewer(props: Props) {
if (inline) { if (inline) {
handleResize(); handleResize();
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
window.addEventListener('fullscreenchange', handleResize); onFullscreenChange(window, 'add', handleResize);
return () => { return () => {
window.removeEventListener('resize', handleResize); window.removeEventListener('resize', handleResize);
window.removeEventListener('fullscreenchange', handleResize); onFullscreenChange(window, 'remove', handleResize);
}; };
} }
}, [setFileViewerRect, inline]); }, [setFileViewerRect, inline]);