From 288171bdf421c7e42ab22001cc579154f82246e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sat, 12 Nov 2022 03:21:53 +0000
Subject: [PATCH] fix: safari issue with fullscreen

---
 examples/web/react/components/display/display.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/web/react/components/display/display.tsx b/examples/web/react/components/display/display.tsx
index 987921bc..e5137bb2 100644
--- a/examples/web/react/components/display/display.tsx
+++ b/examples/web/react/components/display/display.tsx
@@ -98,7 +98,8 @@ export const Display: FC<DisplayProps> = ({
             // requests the browser to go fullscreen using the
             // body of the document as the entry HTML element
             nativeFullscreen &&
-                document.body?.requestFullscreen().catch(() => {});
+                document.body.requestFullscreen &&
+                document.body.requestFullscreen().catch(() => {});
         } else {
             setWidth(undefined);
             setHeight(undefined);
@@ -109,7 +110,9 @@ export const Display: FC<DisplayProps> = ({
 
             // restores the window mode, returning from the
             // fullscreen browser
-            nativeFullscreen && document?.exitFullscreen().catch(() => {});
+            nativeFullscreen &&
+                document.exitFullscreen &&
+                document.exitFullscreen().catch(() => {});
         }
         return () => {
             window.removeEventListener("resize", resizeRef.current);
-- 
GitLab