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

This commit is contained in:
Nicolas Gallagher
2019-05-29 20:19:31 -07:00
committed by GitHub
parent ad9a6df58c
commit 0f7cc2ba84
+4 -1
View File
@@ -101,7 +101,10 @@ type PressEvent = {|
shiftKey: boolean,
|};
const isMac = /^Mac/.test(navigator.platform);
const isMac =
typeof window !== 'undefined' && window.navigator != null
? /^Mac/.test(window.navigator.platform)
: false;
const DEFAULT_PRESS_END_DELAY_MS = 0;
const DEFAULT_PRESS_START_DELAY_MS = 0;
const DEFAULT_LONG_PRESS_DELAY_MS = 500;