File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
rax-simulator-renderer/src
react-simulator-renderer/src Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,10 @@ function cacheReactKey(el: Element): Element {
7373 if ( REACT_KEY !== '' ) {
7474 return el ;
7575 }
76- REACT_KEY = Object . keys ( el ) . find ( ( key ) => key . startsWith ( '__reactInternalInstance$' ) ) || '' ;
76+ // react17 采用 __reactFiber 开头
77+ REACT_KEY = Object . keys ( el ) . find (
78+ ( key ) => key . startsWith ( '__reactInternalInstance$' ) || key . startsWith ( '__reactFiber$' ) ,
79+ ) || '' ;
7780 if ( ! REACT_KEY && ( el as HTMLElement ) . parentElement ) {
7881 return cacheReactKey ( ( el as HTMLElement ) . parentElement ! ) ;
7982 }
Original file line number Diff line number Diff line change @@ -530,7 +530,10 @@ function cacheReactKey(el: Element): Element {
530530 if ( REACT_KEY !== '' ) {
531531 return el ;
532532 }
533- REACT_KEY = Object . keys ( el ) . find ( ( key ) => key . startsWith ( '__reactInternalInstance$' ) ) || '' ;
533+ // react17 采用 __reactFiber 开头
534+ REACT_KEY = Object . keys ( el ) . find (
535+ ( key ) => key . startsWith ( '__reactInternalInstance$' ) || key . startsWith ( '__reactFiber$' ) ,
536+ ) || '' ;
534537 if ( ! REACT_KEY && ( el as HTMLElement ) . parentElement ) {
535538 return cacheReactKey ( ( el as HTMLElement ) . parentElement ! ) ;
536539 }
You can’t perform that action at this time.
0 commit comments