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

feat: improved event handlng on full

screen for safari
parent 0b349f19
No related branches found
No related tags found
No related merge requests found
...@@ -352,7 +352,10 @@ export const App: FC<AppProps> = ({ ...@@ -352,7 +352,10 @@ export const App: FC<AppProps> = ({
}, [keyaction]); }, [keyaction]);
useEffect(() => { useEffect(() => {
const onFullChange = (event: Event) => { const onFullChange = (event: Event) => {
if (!document.fullscreenElement) { if (
!document.fullscreenElement &&
!(document as any).webkitFullscreenElement
) {
setFullscreenState(false); setFullscreenState(false);
} }
}; };
...@@ -391,11 +394,16 @@ export const App: FC<AppProps> = ({ ...@@ -391,11 +394,16 @@ export const App: FC<AppProps> = ({
showToast(params.text, params.error, params.timeout); showToast(params.text, params.error, params.timeout);
}; };
document.addEventListener("fullscreenchange", onFullChange); document.addEventListener("fullscreenchange", onFullChange);
document.addEventListener("webkitfullscreenchange", onFullChange);
document.addEventListener("keydown", onKeyDown); document.addEventListener("keydown", onKeyDown);
emulator.bind("booted", onBooted); emulator.bind("booted", onBooted);
emulator.bind("message", onMessage); emulator.bind("message", onMessage);
return () => { return () => {
document.removeEventListener("fullscreenchange", onFullChange); document.removeEventListener("fullscreenchange", onFullChange);
document.removeEventListener(
"webkitfullscreenchange",
onFullChange
);
document.removeEventListener("keydown", onKeyDown); document.removeEventListener("keydown", onKeyDown);
emulator.unbind("booted", onBooted); emulator.unbind("booted", onBooted);
emulator.unbind("message", onMessage); emulator.unbind("message", onMessage);
......
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