Skip to content

Commit

Permalink
React Events: check window before using navigator (facebook#15768)
Browse files Browse the repository at this point in the history
  • Loading branch information
necolas authored May 30, 2019
1 parent ad9a6df commit 0f7cc2b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/react-events/src/Press.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0f7cc2b

Please sign in to comment.