0

I am making a div fullscreen in React and want to change its class if the browser is in fullscreen mode. Unfortunately, the only proper way to detect that browser is in fullscreen mode is a variable document.webkitIsFullScreen (or something else similar in Firefox). I cannot rely on a state in this case, because the fullscreen may be closed by pressing Escape, and it's a native browser way I want to keep. How can I watch this variable and rerender my component?

  • Did you tried this https://stackoverflow.com/questions/16755129/detect-fullscreen-mode – Learner Nov 17 '20 at 11:24
  • Please, read the question carefully. I am not using jquery. And I can detect the fullscreen mode. The problem is that I don't know the best way on how to force react component update if it happens. – Mika Drakolis Nov 17 '20 at 11:30
  • Kindly check the answer you can check with innerHeight of window and height of screen. if( window.innerHeight == screen.height) { // browser is fullscreen } – Learner Nov 17 '20 at 11:47

0 Answers0