Skip to content
Snippets Groups Projects
Verified Commit 0b349f19 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: initial support for safari fullscreen

parent a4adb809
No related branches found
No related tags found
No related merge requests found
...@@ -97,9 +97,14 @@ export const Display: FC<DisplayProps> = ({ ...@@ -97,9 +97,14 @@ export const Display: FC<DisplayProps> = ({
// requests the browser to go fullscreen using the // requests the browser to go fullscreen using the
// body of the document as the entry HTML element // body of the document as the entry HTML element
nativeFullscreen && if (nativeFullscreen && document.body.requestFullscreen) {
document.body.requestFullscreen &&
document.body.requestFullscreen().catch(() => {}); document.body.requestFullscreen().catch(() => {});
} else if (
nativeFullscreen &&
(document.body as any).webkitRequestFullscreen
) {
(document.body as any).webkitRequestFullscreen();
}
} else { } else {
setWidth(undefined); setWidth(undefined);
setHeight(undefined); setHeight(undefined);
...@@ -110,9 +115,14 @@ export const Display: FC<DisplayProps> = ({ ...@@ -110,9 +115,14 @@ export const Display: FC<DisplayProps> = ({
// restores the window mode, returning from the // restores the window mode, returning from the
// fullscreen browser // fullscreen browser
nativeFullscreen && if (nativeFullscreen && document.exitFullscreen) {
document.exitFullscreen &&
document.exitFullscreen().catch(() => {}); document.exitFullscreen().catch(() => {});
} else if (
nativeFullscreen &&
(document as any).webkitExitFullscreen
) {
(document as any).webkitExitFullscreen();
}
} }
return () => { return () => {
window.removeEventListener("resize", resizeRef.current); window.removeEventListener("resize", resizeRef.current);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment