File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -476,8 +476,9 @@ describe('reactTreeWalker', () => {
476476 }
477477
478478 const Bar = React . forwardRef ( ( props , ref ) => < Foo ref = { ref } { ...props } /> )
479+ const ref = React . createRef ( )
479480
480- const tree = < Bar > foo</ Bar >
481+ const tree = < Bar ref = { ref } > foo</ Bar >
481482
482483 const elements = [ ]
483484 return reactTreeWalker ( tree , element => {
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ const defaultOptions = {
99 componentWillUnmount : false ,
1010}
1111
12+ const forwardRefSymbol = Symbol . for ( 'react.forward_ref' )
13+
1214// Lifted from https://github.com/sindresorhus/p-reduce
1315// Thanks @sindresorhus ! 🙏
1416const pReduce = ( iterable , reducer , initVal ) =>
@@ -75,9 +77,7 @@ const isClassComponent = Comp =>
7577 Comp . prototype . isPureReactComponent )
7678
7779const 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
8181
8282const providesChildContext = instance => ! ! instance . getChildContext
8383
You can’t perform that action at this time.
0 commit comments