Show mounted ComponentKit views in Flipper

Summary:
Before this diff, Flipper showed *leaf* views created by ComponentKit, but not any intermediate views. Now we show both.

A new node type `SKComponentMountedView` is used for this purpose. Its descriptor `SKComponentMountedViewDescriptor` mostly delegates to its view's descriptor, but redirects back into ComponentKit for children.

Reviewed By: Andrey-Mishanin

Differential Revision: D21130997

fbshipit-source-id: b3c12ea7cc1200962b3ba7c269c48d68b1809948
This commit is contained in:
Adam Ernst
2020-04-21 11:51:02 -07:00
committed by Facebook GitHub Bot
parent 756987e4bf
commit d0803ecd56
8 changed files with 274 additions and 50 deletions

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <vector>
NS_ASSUME_NONNULL_BEGIN
@class SKComponentLayoutWrapper;
/**
Represents a non-leaf view created by ComponentKit. Its corresponding
descriptor CKComponentMountedViewDescriptor delegates to the view's descriptor
for attributes and most other behaviors, but redirects back into ComponentKit's
SKComponentLayoutWrapper when queried for children.
In this way, non-leaf views created by ComponentKit appear in the Flipper
layout hierarchy as the child of the component that created their view.
*/
@interface SKComponentMountedView : NSObject
- (instancetype)initWithView:(UIView*)view
children:(std::vector<SKComponentLayoutWrapper*>)children;
@property(nonatomic, readonly) UIView* view;
@property(nonatomic, readonly) std::vector<SKComponentLayoutWrapper*> children;
@end
NS_ASSUME_NONNULL_END