Fix watch tab bug
Summary: This solves the watch tab crash discussed here D15266478, which got reverted. Bug: [Here](diffusion/FBS/browse/master/xplat/sonar/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.mm;57c596a566bec49e343af51b93df65ed1377a2b9$338), when the node is `CKComponentRootView` the `[descriptor childForNode: node atIndex: i]` returns `SKComponentLayoutWrapper`. In the next iteration of the loop, node is `SKComponentLayoutWrapper`, the `[descriptor childForNode: node atIndex: i]` returns `CKComponentRootView`, and hence the infinite recursion I also tested T44431259, it is not regressed. Reviewed By: passy Differential Revision: D15451821 fbshipit-source-id: 25f10112f5f52bb1fa964316a4c7e91a3b29156d
This commit is contained in:
committed by
Facebook Github Bot
parent
2c024a4488
commit
7576e1c61d
@@ -58,7 +58,8 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
|
||||
[[SKComponentLayoutWrapper alloc] initWithLayout:layout
|
||||
position:CGPointMake(0, 0)
|
||||
parentKey:[NSString stringWithFormat: @"%p.", layout.component]
|
||||
reuseWrapper:reuseWrapper];
|
||||
reuseWrapper:reuseWrapper
|
||||
rootNode: root];
|
||||
// Cache the result.
|
||||
if (layout.component) {
|
||||
objc_setAssociatedObject(layout.component, &kLayoutWrapperKey, wrapper, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
@@ -70,8 +71,10 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
|
||||
position:(CGPoint)position
|
||||
parentKey:(NSString *)parentKey
|
||||
reuseWrapper:(CKComponentReuseWrapper *)reuseWrapper
|
||||
rootNode:(id<CKInspectableView>)node
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_rootNode = node;
|
||||
_component = layout.component;
|
||||
_size = layout.size;
|
||||
_position = position;
|
||||
@@ -93,7 +96,9 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
|
||||
SKComponentLayoutWrapper *childWrapper = [[SKComponentLayoutWrapper alloc] initWithLayout:child.layout
|
||||
position:child.position
|
||||
parentKey:[_identifier stringByAppendingFormat:@"[%d].", index++]
|
||||
reuseWrapper:reuseWrapper];
|
||||
reuseWrapper:reuseWrapper
|
||||
rootNode: nil
|
||||
];
|
||||
childWrapper->_isFlexboxChild = [_component isKindOfClass:[CKFlexboxComponent class]];
|
||||
childWrapper->_flexboxChild = findFlexboxLayoutParams(_component, child.layout.component);
|
||||
_children.push_back(childWrapper);
|
||||
|
||||
Reference in New Issue
Block a user