@@ -10,11 +10,14 @@ import { React } from '../utils/react'
1010// subscription is created and an inconsistent state may be observed
1111
1212// Matches logic in React's `shared/ExecutionEnvironment` file
13- export const canUseDOM = ! ! (
14- typeof window !== 'undefined' &&
15- typeof window . document !== 'undefined' &&
16- typeof window . document . createElement !== 'undefined'
17- )
13+ const canUseDOM = ( ) =>
14+ ! ! (
15+ typeof window !== 'undefined' &&
16+ typeof window . document !== 'undefined' &&
17+ typeof window . document . createElement !== 'undefined'
18+ )
19+
20+ const isDOM = /* @__PURE__ */ canUseDOM ( )
1821
1922// Under React Native, we know that we always want to use useLayoutEffect
2023
@@ -23,11 +26,13 @@ export const canUseDOM = !!(
2326 *
2427 * @see {@link https://github.com/facebook/react-native/issues/1331 Reference }
2528 */
26- export const isReactNative =
29+ export const isRunningInReactNative = ( ) =>
2730 typeof navigator !== 'undefined' && navigator . product === 'ReactNative'
2831
32+ const isReactNative = /* @__PURE__ */ isRunningInReactNative ( )
33+
2934const getUseIsomorphicLayoutEffect = ( ) =>
30- canUseDOM || isReactNative ? React . useLayoutEffect : React . useEffect
35+ isDOM || isReactNative ? React . useLayoutEffect : React . useEffect
3136
3237export const useIsomorphicLayoutEffect =
3338 /* @__PURE__ */ getUseIsomorphicLayoutEffect ( )
0 commit comments