Skip to content

Commit

Permalink
Fix SSR ReferenceError: navigator is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Apr 28, 2021
1 parent 48c4191 commit 59ccff6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/AppExtras/ScreenSize/ScreenSize.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { compose } from 'redux';
import { setScreen } from '@eeacms/volto-block-style/actions';
import { detectTouchScreen } from './utils';

const IS_TOUCHSCREEN = detectTouchScreen();

const pixelToNumber = (pixel) => {
return parseInt(pixel.replace('px', ''));
};
Expand Down Expand Up @@ -63,6 +61,7 @@ const ScreenSize = (props) => {
if (__CLIENT__) {
updateScreen();

const IS_TOUCHSCREEN = detectTouchScreen();
if (IS_TOUCHSCREEN) {
window.addEventListener('orientationchange', function () {
setTimeout(function () {
Expand Down

0 comments on commit 59ccff6

Please sign in to comment.