File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -60,10 +60,17 @@ export default function toReact(
60
60
} ;
61
61
}
62
62
}
63
+ state = { } ;
63
64
getRef = ( ) => {
64
65
return this . props . forwardedRef || this . ref ;
65
66
} ;
66
- ref = createRef ( ) ;
67
+ setRef = ( ref ) => {
68
+ this . getRef ( ) . current = ref ;
69
+
70
+ this . setState ( {
71
+ portal : this . findPortal ( ref ) ,
72
+ } ) ;
73
+ } ;
67
74
findPortal = memorizeOne ( ( ref ) => {
68
75
const portal = ref . querySelector ( Portal ) ;
69
76
@@ -73,14 +80,14 @@ export default function toReact(
73
80
74
81
return portal ;
75
82
} ) ;
83
+ ref = createRef ( ) ;
76
84
render ( ) {
77
85
const { children, ...rest } = this . props . hostProps ;
78
86
79
87
return (
80
88
< Fragment >
81
- { this . getRef ( ) . current &&
82
- createPortal ( children , this . findPortal ( this . getRef ( ) . current ) ) }
83
- < WebComponent { ...rest } ref = { this . getRef ( ) } { ...this . wcProps } />
89
+ { this . state . portal && createPortal ( children , this . state . portal ) }
90
+ < WebComponent { ...rest } ref = { this . setRef } { ...this . wcProps } />
84
91
</ Fragment >
85
92
) ;
86
93
}
You can’t perform that action at this time.
0 commit comments