Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reduxjs/react-redux into …
Browse files Browse the repository at this point in the history
…migrate-typetests-to-vitest
  • Loading branch information
aryaemami59 committed Apr 15, 2024
2 parents 8c073e2 + d44ff74 commit ac8af6e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-redux",
"version": "9.1.0",
"version": "9.1.1",
"description": "Official React bindings for Redux",
"keywords": [
"react",
Expand Down
5 changes: 0 additions & 5 deletions src/utils/useIsomorphicLayoutEffect.native.ts

This file was deleted.

15 changes: 12 additions & 3 deletions src/utils/useIsomorphicLayoutEffect.ts
Expand Up @@ -16,6 +16,15 @@ export const canUseDOM = !!(
typeof window.document.createElement !== 'undefined'
)

export const useIsomorphicLayoutEffect = canUseDOM
? React.useLayoutEffect
: React.useEffect
// Under React Native, we know that we always want to use useLayoutEffect

/**
* Checks if the code is running in a React Native environment.
*
* @see {@link https://github.com/facebook/react-native/issues/1331 Reference}
*/
export const isReactNative =
typeof navigator !== 'undefined' && navigator.product === 'ReactNative'

export const useIsomorphicLayoutEffect =
canUseDOM || isReactNative ? React.useLayoutEffect : React.useEffect

0 comments on commit ac8af6e

Please sign in to comment.