This repository was archived by the owner on Jan 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ import type { AstLocation } from "../workers/parser";
2828
2929async function getReactProps ( evaluate ) {
3030 const reactDisplayName = await evaluate (
31- "this._reactInternalInstance.getName()"
31+ "this.hasOwnProperty('_reactInternalFiber') ? " +
32+ "this._reactInternalFiber.type.name : " +
33+ "this._reactInternalInstance.getName()"
3234 ) ;
3335
3436 return {
Original file line number Diff line number Diff line change @@ -91,9 +91,14 @@ describe("setPreview", () => {
9191 it ( "react instance" , async ( ) => {
9292 await setup ( "foo.js" ) ;
9393 evaluationResult = {
94- this : react ,
95- "this._reactInternalInstance.getName()" : "Foo"
94+ this : react
9695 } ;
96+ evaluationResult [
97+ "this.hasOwnProperty('_reactInternalFiber') ? " +
98+ "this._reactInternalFiber.type.name : " +
99+ "this._reactInternalInstance.getName()"
100+ ] =
101+ "Foo" ;
97102
98103 await dispatch (
99104 actions . setPreview (
Original file line number Diff line number Diff line change @@ -33,5 +33,8 @@ export function isReactComponent(result: Grip) {
3333 return ;
3434 }
3535
36- return Object . keys ( ownProperties ) . includes ( "_reactInternalInstance" ) ;
36+ return (
37+ Object . keys ( ownProperties ) . includes ( "_reactInternalInstance" ) ||
38+ Object . keys ( ownProperties ) . includes ( "_reactInternalFiber" )
39+ ) ;
3740}
You can’t perform that action at this time.
0 commit comments