@@ -36,6 +36,7 @@ var ReactTypeOfWork = require('ReactTypeOfWork');
3636var emptyObject = require ( 'emptyObject' ) ;
3737var getIteratorFn = require ( 'getIteratorFn' ) ;
3838var invariant = require ( 'invariant' ) ;
39+ var ReactFeatureFlags = require ( 'ReactFeatureFlags' ) ;
3940
4041if ( __DEV__ ) {
4142 var { getCurrentFiberStackAddendum } = require ( 'ReactDebugCurrentFiber' ) ;
@@ -1100,6 +1101,39 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
11001101 // not as a fragment. Nested arrays on the other hand will be treated as
11011102 // fragment nodes. Recursion happens at the normal flow.
11021103
1104+ if ( ReactFeatureFlags . disableNewFiberFeatures ) {
1105+ // Support only the subset of return types that Stack supports. Treat
1106+ // everything else as empty, but log a warning.
1107+ if ( typeof newChild === 'object' && newChild !== null ) {
1108+ switch ( newChild . $$typeof ) {
1109+ case REACT_ELEMENT_TYPE :
1110+ return placeSingleChild ( reconcileSingleElement (
1111+ returnFiber ,
1112+ currentFirstChild ,
1113+ newChild ,
1114+ priority
1115+ ) ) ;
1116+
1117+ case REACT_PORTAL_TYPE :
1118+ return placeSingleChild ( reconcileSinglePortal (
1119+ returnFiber ,
1120+ currentFirstChild ,
1121+ newChild ,
1122+ priority
1123+ ) ) ;
1124+ }
1125+ }
1126+
1127+ const Component = returnFiber . type ;
1128+ invariant (
1129+ newChild === null || newChild === false ,
1130+ '%s.render(): A valid React element (or null) must be returned. You ' +
1131+ 'may have returned undefined, an array or some other invalid object.' ,
1132+ Component . displayName || Component . name || 'Component'
1133+ ) ;
1134+ return deleteRemainingChildren ( returnFiber , currentFirstChild ) ;
1135+ }
1136+
11031137 if ( typeof newChild === 'string' || typeof newChild === 'number' ) {
11041138 return placeSingleChild ( reconcileSingleTextNode (
11051139 returnFiber ,
0 commit comments