Skip to content

Commit

Permalink
Merge pull request alibaba#1755 from KangXinzhi/fix/useFullscreen-exi…
Browse files Browse the repository at this point in the history
…tFullscreen

fix(useFullscreen): replace the initial value with screenfull.isFullscreen
  • Loading branch information
crazylxr authored Jul 18, 2022
2 parents 00042a2 + 8048728 commit 472dd83
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/hooks/src/useFullscreen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const useFullscreen = (target: BasicTarget, options?: Options) => {
const onExitRef = useLatest(onExit);
const onEnterRef = useLatest(onEnter);

const [state, setState] = useState(false);
const [state, setState] = useState(Boolean(screenfull.isFullscreen));

const onChange = () => {
if (screenfull.isEnabled) {
Expand Down Expand Up @@ -49,9 +49,6 @@ const useFullscreen = (target: BasicTarget, options?: Options) => {
};

const exitFullscreen = () => {
if (!state) {
return;
}
if (screenfull.isEnabled) {
screenfull.exit();
}
Expand Down

0 comments on commit 472dd83

Please sign in to comment.