Fabric: Do not crash in attempt to mount layout-only components

Summary: We do not have a clear strategy how to deal with layout-only (view-less) components. Even if this particular solution is not so fancy, it prevents crashing during text rendering.

Reviewed By: mdvacca

Differential Revision: D7785885

fbshipit-source-id: f3ed8988aa2b41349fd1693c2a7f8c9368daee43
This commit is contained in:
Valentin Shergin 2018-05-08 18:50:19 -07:00 committed by Facebook Github Bot
parent f3893aab3b
commit 9ea7957958
3 changed files with 13 additions and 0 deletions

View File

@ -28,6 +28,11 @@
- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry
{
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:_tag];
if (componentView == nil) {
return;
}
[registry enqueueComponentViewWithName:_componentName tag:_tag componentView:componentView];
}

View File

@ -33,6 +33,10 @@
UIView<RCTComponentViewProtocol> *childComponentView = [registry componentViewByTag:_childTag];
UIView<RCTComponentViewProtocol> *parentComponentView = [registry componentViewByTag:_parentTag];
if (childComponentView == nil || parentComponentView == nil) {
return;
}
[parentComponentView mountChildComponentView:childComponentView
index:_index];
}

View File

@ -33,6 +33,10 @@
UIView<RCTComponentViewProtocol> *childComponentView = [registry componentViewByTag:_childTag];
UIView<RCTComponentViewProtocol> *parentComponentView = [registry componentViewByTag:_parentTag];
if (childComponentView == nil || parentComponentView == nil) {
return;
}
[parentComponentView unmountChildComponentView:childComponentView
index:_index];
}