Fabric: Consistency assurance asserts in RCTComponentViewRegistry

Summary:
@public
We have found that because of some bugs Mounting Manager can request creation of views with same tag several times (which should not happen).
Now, we can fail earlier in such cases.

Reviewed By: fkgozali

Differential Revision: D8585164

fbshipit-source-id: 63c6391de5adfe711552918a20a18396f54ec201
This commit is contained in:
Valentin Shergin 2018-06-22 11:54:03 -07:00 committed by Facebook Github Bot
parent 483c45cff0
commit b1c4fee6af
1 changed files with 7 additions and 0 deletions

View File

@ -87,6 +87,10 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 256;
tag:(ReactTag)tag
{
RCTAssertMainQueue();
RCTAssert(![_registry objectForKey:(__bridge id)(void *)tag],
@"RCTComponentViewRegistry: Attempt to dequeue already registered component.");
UIView<RCTComponentViewProtocol> *componentView =
[self _dequeueComponentViewWithName:componentName];
componentView.tag = tag;
@ -105,6 +109,9 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 256;
{
RCTAssertMainQueue();
RCTAssert([_registry objectForKey:(__bridge id)(void *)tag],
@"RCTComponentViewRegistry: Attempt to enqueue unregistered component.");
#ifdef LEGACY_UIMANAGER_INTEGRATION_ENABLED
[RCTUIManager unregisterView:componentView];
#endif