react-native/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm
Valentin Shergin 9ea7957958 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
2018-05-08 19:24:10 -07:00

40 lines
867 B
Plaintext

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTDeleteMountItem.h"
#import "RCTComponentViewRegistry.h"
@implementation RCTDeleteMountItem {
NSString *_componentName;
ReactTag _tag;
}
- (instancetype)initWithComponentName:(NSString *)componentName
tag:(ReactTag)tag
{
if (self = [super init]) {
_componentName = componentName;
_tag = tag;
}
return self;
}
- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry
{
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:_tag];
if (componentView == nil) {
return;
}
[registry enqueueComponentViewWithName:_componentName tag:_tag componentView:componentView];
}
@end