@@ -54,17 +54,17 @@ export type HostConfig<T, P, I, TI, C> = {
5454
5555type OpaqueNode = Fiber ;
5656
57- export type Reconciler < C > = {
57+ export type Reconciler < C , I > = {
5858 mountContainer ( element : ReactElement < any > , containerInfo : C ) : OpaqueNode ,
5959 updateContainer ( element : ReactElement < any > , container : OpaqueNode ) : void ,
6060 unmountContainer ( container : OpaqueNode ) : void ,
6161 performWithPriority ( priorityLevel : PriorityLevel , fn : Function ) : void ,
6262
6363 // Used to extract the return value from the initial render. Legacy API.
64- getPublicRootInstance ( container : OpaqueNode ) : ( C | null ) ,
64+ getPublicRootInstance ( container : OpaqueNode ) : ( ReactComponent < any , any , any > | I | null ) ,
6565} ;
6666
67- module . exports = function < T , P , I , TI , C > ( config : HostConfig < T , P , I , TI , C > ) : Reconciler < C > {
67+ module . exports = function < T , P , I , TI , C > ( config : HostConfig < T , P , I , TI , C > ) : Reconciler < C , I > {
6868
6969 var { scheduleWork, performWithPriority } = ReactFiberScheduler ( config ) ;
7070
@@ -106,8 +106,13 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) :
106106
107107 performWithPriority ,
108108
109- getPublicRootInstance ( container : OpaqueNode ) : ( C | null ) {
110- return null ;
109+ getPublicRootInstance ( container : OpaqueNode ) : ( ReactComponent < any , any , any > | I | null ) {
110+ const root : FiberRoot = ( container . stateNode : any ) ;
111+ const containerFiber = root . current ;
112+ if ( ! containerFiber . child ) {
113+ return null ;
114+ }
115+ return containerFiber . child . stateNode ;
111116 } ,
112117
113118 } ;
0 commit comments