@@ -75,7 +75,7 @@ export type HostConfig<T, P, I, TI, C, CX> = {
7575} ;
7676
7777export type Reconciler < C , I , TI > = {
78- mountContainer ( element : ReactNodeList , containerInfo : C , parentComponent : ? ReactComponent < any , any , any > ) : OpaqueNode ,
78+ createContainer ( containerInfo : C ) : OpaqueNode ,
7979 updateContainer ( element : ReactNodeList , container : OpaqueNode , parentComponent : ?ReactComponent < any , any, any > ) : void ,
8080 performWithPriority ( priorityLevel : PriorityLevel , fn : Function ) : void ,
8181 /* eslint-disable no-undef */
@@ -119,17 +119,10 @@ module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C
119119
120120 return {
121121
122- mountContainer ( element : ReactNodeList , containerInfo : C , parentComponent : ?ReactComponent < any , any , any > , callback : ?Function ) : OpaqueNode {
123- const context = getContextForSubtree ( parentComponent ) ;
124- const root = createFiberRoot ( containerInfo , context ) ;
122+ createContainer ( containerInfo : C ) : OpaqueNode {
123+ const root = createFiberRoot ( containerInfo ) ;
125124 const current = root . current ;
126125
127- scheduleTopLevelUpdate ( current , element , callback ) ;
128-
129- if ( __DEV__ && ReactFiberInstrumentation . debugTool ) {
130- ReactFiberInstrumentation . debugTool . onMountContainer ( root ) ;
131- }
132-
133126 // It may seem strange that we don't return the root here, but that will
134127 // allow us to have containers that are in the middle of the tree instead
135128 // of being roots.
@@ -141,13 +134,20 @@ module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C
141134 const root : FiberRoot = ( container . stateNode : any ) ;
142135 const current = root . current ;
143136
144- root . pendingContext = getContextForSubtree ( parentComponent ) ;
137+ const context = getContextForSubtree ( parentComponent ) ;
138+ if ( root . context === null ) {
139+ root . context = context ;
140+ } else {
141+ root . pendingContext = context ;
142+ }
145143
146144 scheduleTopLevelUpdate ( current , element , callback ) ;
147145
148146 if ( __DEV__ ) {
149147 if ( ReactFiberInstrumentation . debugTool ) {
150- if ( element === null ) {
148+ if ( current . type === null ) {
149+ ReactFiberInstrumentation . debugTool . onMountContainer ( root ) ;
150+ } else if ( element === null ) {
151151 ReactFiberInstrumentation . debugTool . onUnmountContainer ( root ) ;
152152 } else {
153153 ReactFiberInstrumentation . debugTool . onUpdateContainer ( root ) ;
0 commit comments