Skip to content

Commit

Permalink
only set isSSR true if !isReactNative
Browse files Browse the repository at this point in the history
  • Loading branch information
tplorts committed Aug 20, 2023
1 parent dba6c40 commit 7811fd6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/shared/util/Recoil_Environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@

'use strict';

const isReactNative: boolean =
typeof navigator !== 'undefined' && navigator.product === 'ReactNative'; // eslint-disable-line fb-www/typeof-undefined

/* eslint-disable fb-www/typeof-undefined */
const isSSR: boolean =
// $FlowFixMe(site=recoil) Window does not have a FlowType definition https://github.com/facebook/flow/issues/6709
typeof Window === 'undefined' || typeof window === 'undefined';
(!isReactNative &&
// $FlowFixMe(site=recoil) Window does not have a FlowType definition https://github.com/facebook/flow/issues/6709
typeof Window === 'undefined') ||
typeof window === 'undefined';
/* eslint-enable fb-www/typeof-undefined */

const isWindow = (value: mixed): boolean =>
!isSSR &&
// $FlowFixMe(site=recoil) Window does not have a FlowType definition https://github.com/facebook/flow/issues/6709
(value === window || value instanceof Window);

const isReactNative: boolean =
typeof navigator !== 'undefined' && navigator.product === 'ReactNative'; // eslint-disable-line fb-www/typeof-undefined

module.exports = {
isSSR,
isReactNative,
Expand Down

0 comments on commit 7811fd6

Please sign in to comment.