File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " overlay-kit " : patch
3+ ---
4+
5+ Export ` isClientEnvironment ` function for mocking
Original file line number Diff line number Diff line change @@ -2,12 +2,16 @@ import { useLayoutEffect } from 'react';
22import { createEmitter } from './emitter' ;
33
44const emitter = createEmitter ( ) ;
5- function useClientLayoutEffect ( ...args : Parameters < typeof useLayoutEffect > ) {
5+
6+ export function isClientEnvironment ( ) {
67 const isBrowser = typeof document !== 'undefined' ;
78 const isReactNative = typeof navigator !== 'undefined' && navigator . product === 'ReactNative' ;
89
9- if ( ! isBrowser && ! isReactNative ) return ;
10+ return isBrowser || isReactNative ;
11+ }
1012
13+ function useClientLayoutEffect ( ...args : Parameters < typeof useLayoutEffect > ) {
14+ if ( ! isClientEnvironment ( ) ) return ;
1115 useLayoutEffect ( ...args ) ;
1216}
1317
You can’t perform that action at this time.
0 commit comments