Add invariant for null root ids

Reviewed By: astreet

Differential Revision: D2911414

fb-gh-sync-id: 7d7a4144765e093de18b442f7304693556fdfc2f
This commit is contained in:
Andrei Coman 2016-02-08 09:16:24 -08:00 committed by facebook-github-bot-7
parent 1cf605dda3
commit 6b63afb097

View File

@ -19,6 +19,7 @@ var ReactMultiChild = require('ReactMultiChild');
var UIManager = require('UIManager');
var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev');
var invariant = require('invariant');
var warning = require('warning');
var registrationNames = ReactNativeEventEmitter.registrationNames;
@ -79,7 +80,7 @@ ReactNativeBaseComponent.Mixin = {
// no children - let's avoid calling out to the native bridge for a large
// portion of the children.
if (mountImages.length) {
// TODO: Pool these per platform view class. Reusing the `mountImages`
// array would likely be a jit deopt.
var createdTags = [];
@ -189,10 +190,16 @@ ReactNativeBaseComponent.Mixin = {
);
var nativeTopRootID = ReactNativeTagHandles.getNativeTopRootIDFromNodeID(rootID);
if (nativeTopRootID == null) {
invariant(
false,
'nativeTopRootID not found for tag ' + tag + ' view type ' +
this.viewConfig.uiViewClassName + ' with rootID ' + rootID);
}
UIManager.createView(
tag,
this.viewConfig.uiViewClassName,
nativeTopRootID ? ReactNativeTagHandles.rootNodeIDToTag[nativeTopRootID] : null,
ReactNativeTagHandles.rootNodeIDToTag[nativeTopRootID],
updatePayload
);