File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-param-reassign */
2
2
import type * as React from 'react' ;
3
3
import { isValidElement , ReactNode } from 'react' ;
4
- import { isFragment , isMemo } from 'react-is' ;
4
+ import { ForwardRef , isFragment , isMemo } from 'react-is' ;
5
5
import useMemo from './hooks/useMemo' ;
6
6
7
7
export function fillRef < T > ( ref : React . Ref < T > , node : T ) {
@@ -43,14 +43,19 @@ export function supportRef(nodeOrComponent: any): boolean {
43
43
: nodeOrComponent . type ;
44
44
45
45
// Function component node
46
- if ( typeof type === 'function' && ! type . prototype ?. render ) {
46
+ if (
47
+ typeof type === 'function' &&
48
+ ! type . prototype ?. render &&
49
+ type . $$typeof !== ForwardRef
50
+ ) {
47
51
return false ;
48
52
}
49
53
50
54
// Class component
51
55
if (
52
56
typeof nodeOrComponent === 'function' &&
53
- ! nodeOrComponent . prototype ?. render
57
+ ! nodeOrComponent . prototype ?. render &&
58
+ nodeOrComponent . $$typeof !== ForwardRef
54
59
) {
55
60
return false ;
56
61
}
You can’t perform that action at this time.
0 commit comments