Add size prop to layout inspector
Summary: Size is passed as a prop to every `CKComponent` and `CKFlexboxChild`. It is useful to see where it was set exactly Reviewed By: kevin0571 Differential Revision: D16688496 fbshipit-source-id: 5f8dc39a967ab2d7d89d6a37a8152aa6b59db220
This commit is contained in:
committed by
Facebook Github Bot
parent
d0a3cb5f74
commit
dbf0e3db43
@@ -27,6 +27,7 @@
|
||||
#import "CKInsetComponent+Sonar.h"
|
||||
#import "CKStatelessComponent+Sonar.h"
|
||||
#import "FKDataStorageForLiveEditing.h"
|
||||
#import "Utils.h"
|
||||
|
||||
/** This protocol isn't actually adopted anywhere, it just lets us use the SEL below */
|
||||
@protocol SonarKitLayoutComponentKitOverrideInformalProtocol
|
||||
@@ -138,6 +139,7 @@ static CK::StaticMutex _mutex = CK_MUTEX_INITIALIZER;
|
||||
withValue: @{
|
||||
@"frame": SKObject(self.viewContext.frame),
|
||||
@"controller": SKObject(NSStringFromClass([self.controller class])),
|
||||
@"size": SKObject(ckcomponentSize([self size])),
|
||||
}]];
|
||||
|
||||
auto const canBeReusedCounter = self.flipper_canBeReusedCounter;
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
@"flexGrow": SKObject(@(child.flexGrow)),
|
||||
@"flexShrink": SKObject(@(child.flexShrink)),
|
||||
@"zIndex": SKObject(@(child.zIndex)),
|
||||
@"sizeConstraints": SKObject(ckcomponentSize(child.sizeConstraints)),
|
||||
@"useTextRounding": SKObject(@(child.useTextRounding)),
|
||||
@"margin": flexboxRect(child.margin),
|
||||
@"flexBasis": relativeDimension(child.flexBasis),
|
||||
|
||||
@@ -10,3 +10,4 @@
|
||||
NSString *relativeDimension(CKRelativeDimension dimension);
|
||||
NSDictionary<NSString *, NSString *> *flexboxRect(CKFlexboxSpacing spacing);
|
||||
CKRelativeDimension relativeStructDimension(NSString *dimension);
|
||||
NSDictionary<NSString *, NSString *> *ckcomponentSize(CKComponentSize size);
|
||||
|
||||
@@ -39,4 +39,15 @@ NSDictionary<NSString *, NSString *> *flexboxRect(CKFlexboxSpacing spacing) {
|
||||
};
|
||||
}
|
||||
|
||||
NSDictionary<NSString *, NSString *> *ckcomponentSize(CKComponentSize size) {
|
||||
return @{
|
||||
@"width": relativeDimension(size.width),
|
||||
@"height": relativeDimension(size.height),
|
||||
@"minWidth": relativeDimension(size.minWidth),
|
||||
@"minHeight": relativeDimension(size.minHeight),
|
||||
@"maxWidth": relativeDimension(size.maxWidth),
|
||||
@"maxHeight": relativeDimension(size.maxHeight),
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user