mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
fix: access document on client 2
This commit is contained in:
1 parent
9818c9868a
commit
886c2aa1d1
2 files changed
+2
-4
No files matched your search
@@ -183,9 +183,7 @@ export function Options({ isFullScreen }: OptionsProps) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
document.exitFullscreen();
|
document.exitFullscreen();
|
||||||
} else if (typeof document !== 'undefined') {
|
} else document.body.requestFullscreen();
|
||||||
document.body.requestFullscreen();
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isFullScreen ? <ExitFullScreenIcon /> : <EnterFullScreenIcon />}
|
{isFullScreen ? <ExitFullScreenIcon /> : <EnterFullScreenIcon />}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|||||||
|
|
||||||
export function useFullScreen() {
|
export function useFullScreen() {
|
||||||
const [isFullScreen, setIsFullScreen] = useState(
|
const [isFullScreen, setIsFullScreen] = useState(
|
||||||
document.fullscreenElement !== null,
|
typeof document !== 'undefined' && document.fullscreenElement !== null,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user