@samitouri / QOS-React-2 / commits / 0f7cc2ba84

React Events: check window before using navigator (#15768)

Nicolas Gallagher committed May 29, 2019 at 20:19 UTC 0f7cc2ba845e34d7a312819e27bbfa88cdb7d49f
1 file changed +4 -1
packages/react-events/src/Press.js
+4 -1
@@ -101,7 +101,10 @@ type PressEvent = {|
101 shiftKey: boolean,
102 |};
103
104 -const isMac = /^Mac/.test(navigator.platform);
104 +const isMac =
105 + typeof window !== 'undefined' && window.navigator != null
106 + ? /^Mac/.test(window.navigator.platform)
107 + : false;
108 const DEFAULT_PRESS_END_DELAY_MS = 0;
109 const DEFAULT_PRESS_START_DELAY_MS = 0;
110 const DEFAULT_LONG_PRESS_DELAY_MS = 500;