File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -476,8 +476,9 @@ describe('reactTreeWalker', () => {
476
476
}
477
477
478
478
const Bar = React . forwardRef ( ( props , ref ) => < Foo ref = { ref } { ...props } /> )
479
+ const ref = React . createRef ( )
479
480
480
- const tree = < Bar > foo</ Bar >
481
+ const tree = < Bar ref = { ref } > foo</ Bar >
481
482
482
483
const elements = [ ]
483
484
return reactTreeWalker ( tree , element => {
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ const defaultOptions = {
9
9
componentWillUnmount : false ,
10
10
}
11
11
12
+ const forwardRefSymbol = Symbol . for ( 'react.forward_ref' )
13
+
12
14
// Lifted from https://github.com/sindresorhus/p-reduce
13
15
// Thanks @sindresorhus ! 🙏
14
16
const pReduce = ( iterable , reducer , initVal ) =>
@@ -75,9 +77,7 @@ const isClassComponent = Comp =>
75
77
Comp . prototype . isPureReactComponent )
76
78
77
79
const isForwardRef = Comp =>
78
- Comp . type &&
79
- Comp . type . $$typeof === Symbol . for ( 'react.forward_ref' ) &&
80
- typeof Comp . type . render === 'function'
80
+ Comp . type && Comp . type . $$typeof === forwardRefSymbol
81
81
82
82
const providesChildContext = instance => ! ! instance . getChildContext
83
83
You can’t perform that action at this time.
0 commit comments