This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
756987e
commit d0803ec
Showing
8 changed files
with
274 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentMountedView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
25 changes: 25 additions & 0 deletions
25
...gins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentMountedView.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* 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 "SKComponentMountedView.h" | ||
|
||
@implementation SKComponentMountedView | ||
|
||
- (instancetype)initWithView:(UIView*)view | ||
children:(std::vector<SKComponentLayoutWrapper*>)children { | ||
if (self = [super init]) { | ||
_view = view; | ||
_children = std::move(children); | ||
} | ||
return self; | ||
} | ||
|
||
@end | ||
|
||
#endif |
15 changes: 15 additions & 0 deletions
15
...perKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentMountedViewDescriptor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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 <FlipperKitLayoutPlugin/SKNodeDescriptor.h> | ||
|
||
@class SKComponentMountedView; | ||
|
||
@interface SKComponentMountedViewDescriptor | ||
: SKNodeDescriptor<SKComponentMountedView*> | ||
|
||
@end |
Oops, something went wrong.