Files
flipper/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/FlipperKitLayoutComponentKitSupport.mm
Adam Ernst d0803ecd56 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
2020-04-21 11:53:10 -07:00

42 lines
1.4 KiB
Plaintext

/*
* 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.
*/
#if FB_SONARKIT_ENABLED
#import "FlipperKitLayoutComponentKitSupport.h"
#import <ComponentKit/CKComponentHostingView.h>
#import <ComponentKit/CKComponentRootView.h>
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
#import "SKComponentLayoutDescriptor.h"
#import "SKComponentLayoutWrapper.h"
#import "SKComponentMountedView.h"
#import "SKComponentMountedViewDescriptor.h"
#import "SKComponentRootViewDescriptor.h"
@implementation FlipperKitLayoutComponentKitSupport
+ (void)setUpWithDescriptorMapper:(SKDescriptorMapper*)mapper {
// What we really want here is "forProtocol:@protocol(CKInspectableView)" but
// no such luck.
[mapper registerDescriptor:[[SKComponentRootViewDescriptor alloc]
initWithDescriptorMapper:mapper]
forClass:[CKComponentRootView class]];
[mapper registerDescriptor:[[SKComponentLayoutDescriptor alloc]
initWithDescriptorMapper:mapper]
forClass:[SKComponentLayoutWrapper class]];
[mapper registerDescriptor:[[SKComponentMountedViewDescriptor alloc]
initWithDescriptorMapper:mapper]
forClass:[SKComponentMountedView class]];
}
@end
#endif