From 59ccff65603f825a84a156b972035272872abd63 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Wed, 28 Apr 2021 20:23:36 +0300 Subject: [PATCH] Fix SSR ReferenceError: navigator is not defined --- src/AppExtras/ScreenSize/ScreenSize.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/AppExtras/ScreenSize/ScreenSize.jsx b/src/AppExtras/ScreenSize/ScreenSize.jsx index 05ed337..1af78ba 100644 --- a/src/AppExtras/ScreenSize/ScreenSize.jsx +++ b/src/AppExtras/ScreenSize/ScreenSize.jsx @@ -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', '')); }; @@ -63,6 +61,7 @@ const ScreenSize = (props) => { if (__CLIENT__) { updateScreen(); + const IS_TOUCHSCREEN = detectTouchScreen(); if (IS_TOUCHSCREEN) { window.addEventListener('orientationchange', function () { setTimeout(function () {