Simplify CKComponentHostingViewProtocol
Summary: All current implementations of `CKComponentHostingViewProtocol` *contain* a `CKInspectableView`, so there is no need for the hosting view itself to conform. This also simplifies the Flipper plugin. Reviewed By: d16r Differential Revision: D20457822 fbshipit-source-id: 472f80f5bb2ee507862487d076cfb0e3de6416fa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
952cb7783a
commit
1725fd6bf1
@@ -14,7 +14,6 @@
|
||||
|
||||
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
|
||||
|
||||
#import "SKComponentHostingViewDescriptor.h"
|
||||
#import "SKComponentLayoutDescriptor.h"
|
||||
#import "SKComponentLayoutWrapper.h"
|
||||
#import "SKComponentRootViewDescriptor.h"
|
||||
@@ -24,9 +23,6 @@
|
||||
|
||||
+ (void)setUpWithDescriptorMapper:(SKDescriptorMapper*)mapper
|
||||
subDescriptors:(NSArray<SKSubDescriptor*>*)subDescriptors {
|
||||
[mapper registerDescriptor:[[SKComponentHostingViewDescriptor alloc]
|
||||
initWithDescriptorMapper:mapper]
|
||||
forClass:[CKComponentHostingView class]];
|
||||
[mapper registerDescriptor:[[SKComponentRootViewDescriptor alloc]
|
||||
initWithDescriptorMapper:mapper]
|
||||
forClass:[CKComponentRootView class]];
|
||||
@@ -40,9 +36,6 @@
|
||||
+ (void)setUpWithDescriptorMapper:(SKDescriptorMapper*)mapper {
|
||||
// What we really want here is "forProtocol:@protocol(CKInspectableView)" but
|
||||
// no such luck.
|
||||
[mapper registerDescriptor:[[SKComponentHostingViewDescriptor alloc]
|
||||
initWithDescriptorMapper:mapper]
|
||||
forClass:[CKComponentHostingView class]];
|
||||
[mapper registerDescriptor:[[SKComponentRootViewDescriptor alloc]
|
||||
initWithDescriptorMapper:mapper]
|
||||
forClass:[CKComponentRootView class]];
|
||||
|
||||
@@ -4,12 +4,3 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <FlipperKitLayoutPlugin/SKNodeDescriptor.h>
|
||||
|
||||
@class CKComponentHostingView;
|
||||
|
||||
@interface SKComponentHostingViewDescriptor
|
||||
: SKNodeDescriptor<CKComponentHostingView*>
|
||||
|
||||
@end
|
||||
|
||||
@@ -4,45 +4,3 @@
|
||||
* 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 "SKComponentHostingViewDescriptor.h"
|
||||
#import <ComponentKit/CKComponentAttachController.h>
|
||||
#import <ComponentKit/CKComponentAttachControllerInternal.h>
|
||||
#import <ComponentKit/CKComponentHostingView.h>
|
||||
#import <ComponentKit/CKComponentHostingViewInternal.h>
|
||||
#import <ComponentKit/CKComponentLayout.h>
|
||||
|
||||
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
|
||||
|
||||
#import "SKComponentLayoutWrapper.h"
|
||||
|
||||
@implementation SKComponentHostingViewDescriptor
|
||||
|
||||
- (NSString*)identifierForNode:(CKComponentHostingView*)node {
|
||||
return [NSString stringWithFormat:@"%p", node];
|
||||
}
|
||||
|
||||
- (NSUInteger)childCountForNode:(CKComponentHostingView*)node {
|
||||
return node.mountedLayout.component ? 1 : 0;
|
||||
}
|
||||
|
||||
- (id)childForNode:(CKComponentHostingView*)node atIndex:(NSUInteger)index {
|
||||
return [SKComponentLayoutWrapper
|
||||
newFromRoot:node
|
||||
parentKey:[NSString stringWithFormat:@"%@.", node.uniqueIdentifier]];
|
||||
}
|
||||
|
||||
- (void)setHighlighted:(BOOL)highlighted forNode:(CKComponentHostingView*)node {
|
||||
SKNodeDescriptor* viewDescriptor = [self descriptorForClass:[UIView class]];
|
||||
[viewDescriptor setHighlighted:highlighted forNode:node];
|
||||
}
|
||||
|
||||
- (void)hitTest:(SKTouch*)touch forNode:(CKComponentHostingView*)node {
|
||||
[touch continueWithChildIndex:0 withOffset:(CGPoint){0, 0}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user