From b6c3db70ac61fc69acb4edcc22e688ba5f5a7917 Mon Sep 17 00:00:00 2001 From: Logan Williams Date: Wed, 11 Jan 2023 11:32:40 +0100 Subject: [PATCH] Check to see if screenfull is initialized (#62) Co-authored-by: Miguel Sozinho Ramalho <19508417+msramalho@users.noreply.github.com> --- src/components/controls/FullScreenToggle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/controls/FullScreenToggle.js b/src/components/controls/FullScreenToggle.js index 1df02eb..890b48c 100644 --- a/src/components/controls/FullScreenToggle.js +++ b/src/components/controls/FullScreenToggle.js @@ -15,11 +15,11 @@ export class FullscreenToggle extends React.Component { } componentDidMount() { - screenfull.on("change", this.onFullscreenStateChange); + if (screenfull.on) screenfull.on("change", this.onFullscreenStateChange); } componentWillUnmount() { - screenfull.off("change", this.onFullscreenStateChange); + if (screenfull.off) screenfull.off("change", this.onFullscreenStateChange); } onFullscreenStateChange(evt) {