diff --git a/Libraries/ReactNative/ReactNativeBaseComponent.js b/Libraries/ReactNative/ReactNativeBaseComponent.js index 8b60d8682..0beef9334 100644 --- a/Libraries/ReactNative/ReactNativeBaseComponent.js +++ b/Libraries/ReactNative/ReactNativeBaseComponent.js @@ -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 );