Skip to content

Commit ac8af6e

Browse files
committed
Merge branch 'master' of https://github.com/reduxjs/react-redux into migrate-typetests-to-vitest
2 parents 8c073e2 + d44ff74 commit ac8af6e

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-redux",
3-
"version": "9.1.0",
3+
"version": "9.1.1",
44
"description": "Official React bindings for Redux",
55
"keywords": [
66
"react",

src/utils/useIsomorphicLayoutEffect.native.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/utils/useIsomorphicLayoutEffect.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ export const canUseDOM = !!(
1616
typeof window.document.createElement !== 'undefined'
1717
)
1818

19-
export const useIsomorphicLayoutEffect = canUseDOM
20-
? React.useLayoutEffect
21-
: React.useEffect
19+
// Under React Native, we know that we always want to use useLayoutEffect
20+
21+
/**
22+
* Checks if the code is running in a React Native environment.
23+
*
24+
* @see {@link https://github.com/facebook/react-native/issues/1331 Reference}
25+
*/
26+
export const isReactNative =
27+
typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
28+
29+
export const useIsomorphicLayoutEffect =
30+
canUseDOM || isReactNative ? React.useLayoutEffect : React.useEffect

0 commit comments

Comments
 (0)